/* Custom CSS for AI Crop Monitoring System - Light Mode */

:root {
    --bs-body-bg: #f8f9fa;
    --bs-border-color: #dee2e6;
    --bs-primary: #0d6efd;
    --bs-primary-bg-subtle: #e7f1ff;
    --bs-success: #198754;
    --bs-success-bg-subtle: #d1e7dd;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-dark: #212529;
    --bs-light: #f8f9fa;
    --bs-gray-100: #f8f9fa;
    --bs-gray-200: #e9ecef;
    --bs-gray-300: #dee2e6;
    --bs-gray-600: #6c757d;
    --bs-primary-rgb: 13, 110, 253;
}

/* Image Upload Area Styling */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 200px;
    background-color: white;
}

.image-upload-area:hover {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}

.image-upload-area.dragover {
    border-color: var(--bs-success);
    background-color: var(--bs-success-bg-subtle);
    transform: scale(1.02);
}

/* Color Legend for NDVI */
.color-box {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    display: inline-block;
    border: 1px solid var(--bs-border-color);
}

/* Chart Container Styling */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
    background-color: white;
    border-radius: 0.375rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
}

/* Custom Card Styling */
.card {
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
    background-color: white;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

/* Statistics Cards */
.card.bg-primary,
.card.bg-success,
.card.bg-info,
.card.bg-warning,
.card.bg-danger {
    border: none;
    color: white;
}

/* Table Enhancements */
.table {
    background-color: white;
}

.table-hover tbody tr:hover {
    background-color: var(--bs-gray-200);
}

/* Alert Enhancements */
.alert {
    border: none;
    border-radius: 0.5rem;
    border-left: 4px solid;
    background-color: white;
}

.alert-success {
    border-left-color: var(--bs-success);
    background-color: #d1e7dd;
}

.alert-warning {
    border-left-color: var(--bs-warning);
    background-color: #fff3cd;
}

.alert-danger {
    border-left-color: var(--bs-danger);
    background-color: #f8d7da;
}

.alert-info {
    border-left-color: var(--bs-info);
    background-color: #cff4fc;
}

/* Navigation Enhancements */
.navbar {
    background-color: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-link {
    color: var(--bs-gray-600);
}

.nav-link:hover {
    color: var(--bs-primary) !important;
}

.nav-link.active {
    color: var(--bs-primary) !important;
    font-weight: 600;
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1);
    background-color: white;
}

.modal-header {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 1.5rem;
}

/* Form Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Annotation UI Styles */
.annotation-box {
    background-color: transparent !important;
    transition: border-color 0.2s ease;
    border: 2px solid var(--bs-primary);
}

.annotation-box:hover {
    border-width: 3px !important;
}

.annotation-item {
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: white;
}

.annotation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.annotation-item.active {
    border: 2px solid var(--bs-primary);
    background-color: var(--bs-primary) !important;
    color: white;
}

.annotation-item.active .text-muted {
    color: rgba(255,255,255,0.8) !important;
}

/* Dark text for better readability */
body {
    color: #212529;
    background-color: var(--bs-body-bg);
}

/* Text colors for light mode */
.text-muted {
    color: #6c757d !important;
}

/* Button styling */
.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    color: white;
    background-color: var(--bs-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .image-upload-area {
        padding: 1rem;
        min-height: 150px;
    }
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: var(--bs-dark);
}

/* Dark text for cards */
.card-body {
    color: #212529;
}

/* Table styling */
.table {
    color: #212529;
}

.table-dark {
    background-color: #343a40;
    color: white;
}

/* Text contrast adjustments */
h1, h2, h3, h4, h5, h6 {
    color: #212529;
}

/* Footer styling */
footer {
    background-color: white;
    color: #212529;
    border-top: 1px solid var(--bs-border-color);
}

/* Chart tooltip styling */
.chartjs-tooltip {
    background: var(--bs-dark) !important;
    color: white !important;
}

/* Form label styling */
.form-label {
    color: #495057;
}

/* Progress bar styling */
.progress {
    background-color: var(--bs-gray-200);
}

/* Image thumbnail styling */
.img-thumbnail {
    background-color: white;
    border: 1px solid var(--bs-border-color);
}

/* Add these styles to your light mode CSS */

/* Table header styling for light mode */
.table thead th {
    background-color: #f1f3f5; /* Light gray background */
    color: #212529; /* Dark text for contrast */
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

/* Specific styling for dark tables in light mode */
.table-dark thead th {
    background-color: #343a40; /* Dark background for dark tables */
    color: white; /* White text for dark headers */
    border-bottom: 2px solid #454d55;
}

/* Hover effects for table rows */
.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* Field History specific table styling */
#field-history-table thead th {
    background-color: #e9ecef;
    color: #495057;
    position: sticky;
    top: 0;
}

/* Make sure striped tables have proper contrast */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Status badges in tables */
.table .badge {
    font-weight: 500;
}

/* Health status colors */
.table .text-success {
    color: #198754 !important;
}
.table .text-warning {
    color: #fd7e14 !important;
}
.table .text-danger {
    color: #dc3545 !important;
}

/* Image thumbnails in tables */
.table .img-thumbnail {
    background-color: white;
    border: 1px solid #dee2e6;
    padding: 0.25rem;
}

/* Action buttons in tables */
.table .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Form Input Styling - Light Mode */
.form-control, 
.form-select,
.form-control::placeholder,
.form-control::-webkit-input-placeholder {
    background-color: white !important;
    color: #495057 !important;
    border-color: var(--bs-border-color);
}

/* Focus states for inputs */
.form-control:focus,
.form-select:focus {
    background-color: white !important;
    color: #212529 !important;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* File upload input styling */
.form-control[type="file"]::file-selector-button {
    background-color: var(--bs-gray-200);
    color: #212529;
    border-right: 1px solid var(--bs-border-color);
    padding: 0.375rem 0.75rem;
    margin-right: 0.75rem;
}

/* Date/time inputs */
.form-control[type="date"],
.form-control[type="time"],
.form-control[type="datetime-local"] {
    color-scheme: light;
}

/* Input group additions */
.input-group-text {
    background-color: var(--bs-gray-200);
    color: #495057;
    border-color: var(--bs-border-color);
}

/* Range input styling */
.form-range::-webkit-slider-thumb {
    background: var(--bs-primary);
}

.form-range::-moz-range-thumb {
    background: var(--bs-primary);
}

.form-range::-ms-thumb {
    background: var(--bs-primary);
}

/* Checkbox and radio buttons */
.form-check-input {
    border-color: var(--bs-border-color);
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Input validation states */
.form-control.is-valid {
    border-color: var(--bs-success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
}

.form-control.is-invalid {
    border-color: var(--bs-danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
}

/* Floating labels */
.form-floating > label {
    color: #6c757d;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
    color: #495057;
}

/* Input group button addons */
.input-group .btn {
    z-index: 1;
}

/* Disabled inputs */
.form-control:disabled,
.form-control[readonly] {
    background-color: var(--bs-gray-200);
    opacity: 1;
}


/* Analysis Results Page Specific Styles */
#analysis-tab-content .table-dark {
    background-color: white !important;
    color: #212529 !important;
}

#analysis-tab-content .table-dark thead th {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border-bottom: 2px solid #dee2e6 !important;
}

#analysis-tab-content .table-dark tbody tr {
    background-color: white !important;
}

#analysis-tab-content .table-dark tbody tr:nth-of-type(odd) {
    background-color: #f8f9fa !important;
}

#analysis-tab-content .table-dark tbody td {
    border-color: #dee2e6 !important;
}

/* Force dark text in all table cells for Analysis Results */
#analysis-tab-content table td,
#analysis-tab-content table th,
#analysis-tab-content table small {
    color: #212529 !important;
}

/* Specific fix for Date and Growth Stage columns */
#analysis-tab-content table td:nth-child(1),  /* Date column */
#analysis-tab-content table td:nth-child(4) { /* Growth Stage column */
    color: #212529 !important;
    font-weight: 500;
}

/* Remove any text-muted classes from table cells */
#analysis-tab-content table .text-muted {
    color: #212529 !important;
}

/* Ensure table headers are properly contrasted */
#analysis-tab-content table thead th {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

/* Fix for striped table rows */
#analysis-tab-content table.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

#analysis-tab-content table.table-striped tbody tr:nth-of-type(even) {
    background-color: white !important;
}

/* Force dark text in all child elements */
#analysis-tab-content table * {
    color: #212529 !important;
}