/* File uploader container styles */
.parse-fit-file-uploader {
	font-family: Arial, sans-serif;
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	background-color: #f5f5f5;
	box-sizing: border-box;
}

.parse-fit-file-uploader .upload-container {
	background: white;
	padding: 30px;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	text-align: center;
	margin-bottom: 20px;
}

.parse-fit-file-uploader .upload-area {
	border: 3px dashed #007cba;
	border-radius: 10px;
	padding: 40px;
	margin: 20px 0;
	background-color: #f8f9fa;
	transition: all 0.3s ease;
	cursor: pointer;
}

.parse-fit-file-uploader .upload-area:hover {
	background-color: #e3f2fd;
	border-color: #0056b3;
}

.parse-fit-file-uploader .upload-area.dragover {
	background-color: #e3f2fd;
	border-color: #0056b3;
	transform: scale(1.02);
}

.parse-fit-file-uploader .file-input {
	display: none;
}

.parse-fit-file-uploader .upload-button {
	background-color: #007cba;
	color: white;
	padding: 12px 30px;
	border: none;
	border-radius: 5px;
	font-size: 16px;
	cursor: pointer;
	margin: 10px;
	transition: background-color 0.3s;
}

.parse-fit-file-uploader .upload-button:hover {
	background-color: #0056b3;
}

.parse-fit-file-uploader .upload-button:disabled {
	background-color: #ccc;
	cursor: not-allowed;
}

.parse-fit-file-uploader .file-info {
	margin: 15px 0;
	padding: 10px;
	background-color: #e8f5e8;
	border-radius: 5px;
	display: none;
	transition: opacity 0.5s ease-out, max-height 0.5s ease-out, margin 0.5s ease-out, padding 0.5s ease-out;
	overflow: hidden;
	max-height: 100px;
}

.parse-fit-file-uploader .file-info.fade-out {
	opacity: 0;
	max-height: 0;
	margin: 0;
	padding: 0;
}

.parse-fit-file-uploader .progress-container {
	margin: 20px 0;
	display: none;
}

.parse-fit-file-uploader .progress-bar {
	width: 100%;
	height: 20px;
	background-color: #e0e0e0;
	border-radius: 10px;
	overflow: hidden;
}

.parse-fit-file-uploader .progress-fill {
	height: 100%;
	background: linear-gradient(90deg, #007cba, #00a8e8);
	width: 0%;
	transition: width 0.3s ease;
}

.parse-fit-file-uploader .progress-text {
	margin-top: 10px;
	font-size: 14px;
	color: #666;
}

.parse-fit-file-uploader .overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);
	display: none;
	justify-content: center;
	align-items: center;
	z-index: 1000;
}

.parse-fit-file-uploader .overlay-content {
	background: white;
	padding: 30px;
	border-radius: 10px;
	text-align: center;
	min-width: 300px;
	box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.parse-fit-file-uploader .spinner {
	border: 4px solid #f3f3f3;
	border-top: 4px solid #007cba;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	animation: uploader-spin 1s linear infinite;
	margin: 20px auto;
}

@keyframes uploader-spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.parse-fit-file-uploader .results-container {
	margin-top: 30px;
	text-align: left;
	max-height: 80vh;
	overflow-y: auto;
	background: white;
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0,0,0,0.1);
	display: none;
}

.parse-fit-file-uploader .results-header {
	padding: 20px;
	border-bottom: 1px solid #ddd;
	background-color: #f8f9fa;
	border-radius: 10px 10px 0 0;
}

.parse-fit-file-uploader .results-content {
	padding: 20px;
}

.parse-fit-file-uploader .error-message {
	color: #d32f2f;
	background-color: #ffebee;
	padding: 15px;
	border-radius: 5px;
	margin: 15px 0;
	border-left: 4px solid #d32f2f;
}

.parse-fit-file-uploader .success-message {
	color: #2e7d32;
	background-color: #e8f5e9;
	padding: 15px;
	border-radius: 5px;
	margin: 15px 0;
	border-left: 4px solid #2e7d32;
}

/* Repair section styles */
.parse-fit-file-uploader .repair-section {
	margin: 15px 0;
	padding: 15px;
	background-color: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 6px;
}

.parse-fit-file-uploader .repair-button {
	background-color: #28a745;
	color: white;
	border: none;
	padding: 10px 20px;
	border-radius: 5px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	transition: background-color 0.3s ease;
}

.parse-fit-file-uploader .repair-button:hover:not(:disabled) {
	background-color: #218838;
}

.parse-fit-file-uploader .repair-button:disabled {
	background-color: #6c757d;
	cursor: not-allowed;
}

.parse-fit-file-uploader .repair-status {
	margin-top: 10px;
	font-size: 14px;
}

.parse-fit-file-uploader .repair-status .success {
	color: #28a745;
	font-weight: 500;
}

.parse-fit-file-uploader .repair-status .error {
	color: #dc3545;
	font-weight: 500;
}

.parse-fit-file-uploader .repair-status .processing {
	color: #007bff;
	font-weight: 500;
}

/* FIT viewer container styles */
.fit-viewer-container {
	font-family: Arial, sans-serif;
	box-sizing: border-box;
	line-height: 1.4;
}

.fit-viewer-container .file-info {
    transition: opacity 0.5s ease-out, max-height 0.5s ease-out, margin 0.5s ease-out, padding 0.5s ease-out;
    overflow: hidden;
    max-height: 100px; /* Adjust based on your content height */
}

.fit-viewer-container .file-info.fade-out {
    opacity: 0;
    max-height: 0;
    margin: 0;
    padding: 0;
}

/* Collapsible Error Section */
.parse-fit-file-uploader .error-section {
	margin-bottom: 20px;
	border: 1px solid #d32f2f;
	border-radius: 5px;
	background-color: #ffebee;
	overflow: hidden;
}

.parse-fit-file-uploader .error-section h1 {
	color: #d32f2f;
	margin: 0;
	padding: 15px;
	background-color: #ffcdd2;
	cursor: pointer;
	user-select: none;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: background-color 0.3s ease;
}

.parse-fit-file-uploader .error-section h1:hover {
	background-color: #ef9a9a;
}

.parse-fit-file-uploader .error-section-toggle {
	font-size: 18px;
	font-weight: bold;
	transition: transform 0.3s ease;
}

.parse-fit-file-uploader .error-section-toggle.expanded {
	transform: rotate(90deg);
}

.parse-fit-file-uploader .error-section-content {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.4s ease, padding 0.4s ease;
	padding: 0 15px;
	box-sizing: border-box;
}

.parse-fit-file-uploader .error-section-content.expanded {
	max-height: 400px;
	padding: 15px;
}

.parse-fit-file-uploader .error-section-content .error-message {
	margin: 10px 0;
	border-left: none;
	background-color: transparent;
	color: #d32f2f;
	padding: 5px 0;
}

/* FIT-specific styles */
.fit-viewer-container .fit-fieldset {
	margin: 20px 0;
	border: 2px solid #007cba;
	border-radius: 8px;
	background-color: #f8f9fa;
	width: calc(100% - 4px);
	max-width: calc(100% - 4px);
	box-sizing: border-box;
	overflow: hidden;
	min-width: 0;
}

.fit-viewer-container .fit-fieldset legend {
	background-color: #007cba;
	color: white;
	padding: 8px 15px;
	border-radius: 4px;
	font-weight: bold;
	font-size: 14px;
	margin-left: 20px;
}

.fit-viewer-container .table-container {
	overflow-x: auto;
	overflow-y: auto;
	max-height: 400px;
	margin: 10px;
	border: 1px solid #ddd;
	border-radius: 5px;
	width: calc(100% - 20px);
	max-width: calc(100% - 20px);
	box-sizing: border-box;
	min-width: 0;
}

.fit-viewer-container .fit-fieldset .table-container {
	width: calc(100% - 20px);
	max-width: none;
}

.fit-viewer-container .fit-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 11px;
	min-width: 100%;
}

.fit-viewer-container .fit-table th {
	background-color: #f2f2f2;
	border: 1px solid #ddd;
	padding: 8px 6px;
	text-align: left;
	position: sticky;
	top: 0;
	z-index: 10;
}

.fit-viewer-container .fit-table td {
	border: 1px solid #ddd;
	padding: 6px 6px;
	text-align: left;
	white-space: nowrap;
}

.fit-viewer-container .fit-table tbody tr:nth-child(even) {
	background-color: #f9f9f9;
}

.fit-viewer-container .fit-table tbody tr:hover {
	background-color: #e3f2fd;
}

.fit-viewer-container .field-name {
	font-weight: bold;
	font-size: 12px;
	color: #333;
}

.fit-viewer-container .type-info {
	font-size: 10px;
	color: #666;
	font-weight: normal;
	margin-top: 2px;
}

.fit-viewer-container .invalid-value {
	color: #999;
	font-style: italic;
}

/* Pagination styles  */
.fit-viewer-container .pagination-controls {
    margin: 10px 0;
    text-align: center;
    background: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
}

.fit-viewer-container .pagination-info {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

.fit-viewer-container .pagination-buttons {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.fit-viewer-container .pagination-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.fit-viewer-container .pagination-btn:hover:not(:disabled) {
    background: #e9e9e9;
}

.fit-viewer-container .pagination-btn.active {
    background: #007cba;
    color: white;
    border-color: #005a87;
}

.fit-viewer-container .pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fit-viewer-container .pagination-ellipsis {
    padding: 6px;
    color: #999;
    font-size: 14px;
}

.fit-viewer-container .table-wrapper {
    position: relative;
}

.fit-viewer-container .table-wrapper.loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 4px;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
}

.fit-viewer-container .summary-section .message-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.fit-viewer-container .summary-item {
    padding: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.fit-viewer-container .summary-link {
    font-weight: bold;
    text-decoration: none;
    color: #007cba;
    transition: color 0.3s ease;
}

.fit-viewer-container .summary-link:hover {
    text-decoration: underline;
    color: #005a87;
}

.fit-viewer-container .summary-count {
    color: #666;
    font-size: 0.9em;
}

/* Responsive pagination */
@media (max-width: 768px) {
    .fit-viewer-container .pagination-buttons {
        gap: 3px;
    }
    
    .fit-viewer-container .pagination-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .fit-viewer-container .pagination-info {
        font-size: 12px;
    }
}

/* Edit Form */
form[id^="edit-form-"] button[type="submit"] {
    background-color: #007cba;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    margin: 10px 0 10px 15px;
    transition: background-color 0.3s;
}
form[id^="edit-form-"] button[type="submit"]:hover {
    background-color: #0056b3;
}
form[id^="edit-form-"] button[type="submit"]:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* MODAL TO EDIT TIMESTAMP BEGIN */
.timestamp-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.timestamp-modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 400px;
    border-radius: 5px;
}

.timestamp-input-group {
    margin: 10px 0;
}

.timestamp-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.timestamp-input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.timestamp-input-group input.error {
    border-color: red;
}

/* Preview boxes for timestamp modal */
.preview-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 10px;
    margin: 5px 0;
    font-family: monospace;
    font-size: 13px;
}

.utc-preview {
    border-left: 3px solid #007cba;
}

.local-preview {
    border-left: 3px solid #28a745;
}

.preview-box strong {
    color: #495057;
    font-family: Arial, sans-serif;
    font-size: 12px;
}

.timestamp-preview {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 3px;
    margin: 10px 0;
    font-family: monospace;
}

.timestamp-modal-buttons {
    text-align: right;
    margin-top: 15px;
}

.timestamp-modal-buttons button {
    margin-left: 10px;
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.timestamp-modal-buttons .cancel {
    background-color: #ddd;
}

.timestamp-modal-buttons .save {
    background-color: #007cba;
    color: white;
}



/* Non-editable cell styling - ONLY for ENUM fields */
.non-editable-cell {
    background-color: white !important;
    cursor: not-allowed !important;
}

/* Array value styling - same as non-editable */
.array-value {
    color: #999;
    font-style: italic;
}

/* Ensure modal appears above everything */
.timestamp-modal {
    display: none;
    position: fixed;
    z-index: 10000 !important; /* Higher z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px); /* Add backdrop blur for better visibility */
}

.timestamp-modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 400px;
    border-radius: 5px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3); /* Better shadow */
    position: relative;
    z-index: 10001;
}

.f-s {
    background-color: #e6f3fa !important;
    cursor: pointer !important;
}

/* Keep the hover effect */
.f-s:hover {
    background-color: #bae7ff !important;
}

.f-s:focus {
    background-color: #fff !important;
    outline: 2px solid #007bff;
}

.f-d { /* field-dangerous */
    background-color: #ffcdd2 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.f-u { /* field-unknown */
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.ne { /* non-editable-cell */
    cursor: not-allowed;
    opacity: 0.7;
}

.iv { /* invalid-value */
    font-style: italic;
    color: #666;
}

.av { /* array-value */
    font-style: italic;
    color: #666;
}

.ts { /* timestamp-cell */
    cursor: pointer;
}



.ed { /* edited */
    background-color: #e8f5e8 !important;
    border: 1px solid #4caf50 !important;
}
 
/* Make modal more visible on mobile */
@media (max-width: 768px) {
    .timestamp-modal-content {
        width: 90%;
        margin: 20% auto;
    }
}
/* MODAL TO EDIT TIMESTAMP END */

/* Responsive design */
@media (max-width: 768px) {
	.parse-fit-file-uploader {
		padding: 10px;
	}
	
	.parse-fit-file-uploader .upload-container {
		padding: 20px;
	}
	
	.fit-viewer-container .fit-table {
		font-size: 10px;
	}
	
	.fit-viewer-container .fit-table th,
	.fit-viewer-container .fit-table td {
		padding: 4px;
	}
	
	.fit-viewer-container .error-section-content {
		max-height: 0;
	}
}