* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #10b981;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.logo p {
    color: #6b7280;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #10b981;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #10b981;
    color: white;
}

.btn-primary:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-block {
    width: 100%;
}

.error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
}

.success-message {
    background: #d1fae5;
    color: #059669;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #059669;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Dashboard Layout */
.dashboard {
    background: #f3f4f6;
    min-height: 100vh;
}

.navbar {
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand h2 {
    color: #10b981;
    font-size: 1.5rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 600;
    color: #374151;
}

.user-info .role {
    font-size: 0.85rem;
    color: #6b7280;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.5rem;
    color: #374151;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
}

.stat-card.green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.stat-card.green .stat-value {
    color: #059669;
}

.stat-card.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.stat-card.blue .stat-value {
    color: #2563eb;
}

.stat-card.purple {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
}

.stat-card.purple .stat-value {
    color: #9333ea;
}

.stat-card.orange {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}

.stat-card.orange .stat-value {
    color: #ea580c;
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f9fafb;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

tr:hover {
    background: #f9fafb;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-region {
    background: #e9d5ff;
    color: #7e22ce;
}

.badge-farmer {
    background: #d1fae5;
    color: #065f46;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    color: #374151;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.close-btn:hover {
    color: #374151;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #10b981;
}

select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #10b981;
}

/* Photo Gallery */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 12px;
    font-size: 0.85rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.upload-area.dragover {
    border-color: #10b981;
    background: #d1fae5;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mb-2 {
    margin-bottom: 8px;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #10b981;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
}
/* ========================================
   TAB NAVIGATION STYLES
   ======================================== */

.tab-navigation {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
}

.tab-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
}

.tab-nav-item {
    flex: 1;
    min-width: 150px;
}

.tab-nav-button {
    width: 100%;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-nav-button:hover {
    background: #f9fafb;
    color: #374151;
}

.tab-nav-button.active {
    color: #10b981;
    border-bottom-color: #10b981;
    background: #f0fdf4;
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Responsive tabs */
@media (max-width: 768px) {
    .tab-nav-list {
        flex-wrap: nowrap;
        overflow-x: scroll;
    }
    
    .tab-nav-item {
        flex: 0 0 auto;
    }

    .tab-nav-button {
        padding: 12px 16px;
        font-size: 0.875rem;
    }
}

/* ========================================
   QUALITY DASHBOARD STYLES
   ======================================== */

.quality-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.quality-stat-card {
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.alert-item {
    padding: 16px;
    border-radius: 8px;
    border: 2px solid;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.alert-high {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

.alert-medium {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.alert-low {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

.alert-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 16px;
}

.validation-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.rule-card {
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

.rule-card label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.rule-card input {
    width: 100%;
    padding: 10px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.rule-card input:focus {
    outline: none;
    border-color: #10b981;
}

.rule-card p {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}

/* ========================================
   RESPONSIVE QUALITY DASHBOARD
   ======================================== */

@media (max-width: 768px) {
    .quality-stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .validation-rules-grid {
        grid-template-columns: 1fr;
    }
    
    .alert-item {
        flex-direction: column;
    }
    
    .alert-actions {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
    }
    
    .alert-actions button {
        flex: 1;
    }
}

/* ========================================
   ADDITIONAL HELPER CLASSES
   ======================================== */

.quality-score-excellent {
    color: #10b981;
}

.quality-score-good {
    color: #f59e0b;
}

.quality-score-poor {
    color: #dc2626;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s;
}

.stat-trend-up {
    color: #10b981;
}

.stat-trend-down {
    color: #dc2626;
}

/* Alert badge styles */
.alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.alert-badge-error {
    background: #fee2e2;
    color: #dc2626;
}

.alert-badge-warning {
    background: #fef3c7;
    color: #d97706;
}

.alert-badge-info {
    background: #dbeafe;
    color: #2563eb;
}

/* Loading state */
.quality-dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6b7280;
}

.quality-dashboard-loading .spinner {
    margin-bottom: 16px;
}

/* Empty state */
.quality-dashboard-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.quality-dashboard-empty h3 {
    font-size: 1.5rem;
    color: #374151;
    margin-bottom: 8px;
}

.quality-dashboard-empty p {
    font-size: 0.875rem;
    margin-top: 8px;
}

/* Success state for no alerts */
.no-alerts-state {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-radius: 12px;
    margin: 20px 0;
}

.no-alerts-state .icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.no-alerts-state h3 {
    color: #065f46;
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.no-alerts-state p {
    color: #047857;
    font-size: 0.875rem;
}

     * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f3f4f6; }
        
        /* --- NAVBAR STYLES (Responsive) --- */
        .navbar {
            background: white;
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .navbar-brand {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .navbar-brand h2 {
            color: #10b981;
            margin: 0;
            font-size: 1.5rem;
        }

        .badge {
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            font-size: 0.75rem;
            font-weight: 600;
        }

        .badge-admin {
            background: #dbeafe;
            color: #1e40af;
        }

        .navbar-user {
            display: flex;
            align-items: center;
            gap: 1.5rem;
        }

        .user-info {
            text-align: right;
        }

        .user-info .name {
            font-weight: 600;
            color: #1f2937;
        }

        .user-info .role {
            font-size: 0.875rem;
            color: #6b7280;
        }

        .btn-logout {
            background: #fee2e2;
            color: #dc2626;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            transition: background 0.2s;
        }

        .btn-logout:hover {
            background: #fecaca;
        }

        .btn-back {
            background: #f3f4f6;
            color: #4b5563;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            margin-right: 10px;
            text-decoration: none;
            display: inline-block;
            transition: background 0.2s;
        }

        .btn-back:hover {
            background: #e5e7eb;
            color: #1f2937;
        }

        /* --- MOBILE NAVBAR FIX --- */
        @media (max-width: 768px) {
            .navbar {
                flex-direction: column;
                padding: 1rem;
                gap: 1rem;
            }

            .navbar-brand {
                width: 100%;
                justify-content: center;
                margin-bottom: 5px;
            }

            .navbar-user {
                width: 100%;
                justify-content: space-between;
                gap: 0.5rem;
                flex-wrap: wrap;
            }

            .user-info {
                display: none; /* Hide user details on mobile to save space */
            }

            .btn-back, .btn-logout {
                flex: 1; /* Make buttons share the width */
                text-align: center;
                padding: 0.75rem; /* Larger touch target */
            }
        }

        /* --- DASHBOARD CONTENT STYLES --- */
        .container { max-width: 1400px; margin: 20px auto; padding: 0 20px; }
        
        .page-header {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            color: white; padding: 30px; border-radius: 12px; margin-bottom: 30px;
        }
        .page-header h1 { font-size: 2rem; margin-bottom: 10px; }
        
        @media (max-width: 600px) {
            .page-header h1 { font-size: 1.5rem; }
            .container { padding: 0 10px; }
        }

        .controls { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
        .btn { padding: 10px 20px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.3s; }
        
        /* Make controls stack on mobile */
        @media (max-width: 600px) {
            .controls { flex-direction: column; }
            .btn, select { width: 100%; }
        }
        
        .btn-primary { background: white; color: #10b981; }
        .btn-primary:hover { background: #f0fdf4; }
        
        .btn-danger { background: #fee2e2; color: #dc2626; }
        .btn-danger:hover { background: #fecaca; }

        select { padding: 10px 16px; border: 2px solid #e5e7eb; border-radius: 8px; font-size: 1rem; background: white; }
        
        /* Stats Grid */
        .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
        .stat-card { background: white; padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
        .stat-card.green { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); }
        .stat-card.blue { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }
        .stat-card.purple { background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%); }
        .stat-card.orange { background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%); }
        
        .stat-label { font-size: 0.875rem; color: #6b7280; margin-bottom: 8px; }
        .stat-value { font-size: 2.5rem; font-weight: 700; color: #1f2937; }
        
        /* Charts & Tables */
        .chart-container { background: white; padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 20px; }
        .chart-title { font-size: 1.25rem; font-weight: 700; color: #1f2937; margin-bottom: 20px; }
        
        /* Responsive Table */
        .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
        table { width: 100%; border-collapse: collapse; min-width: 600px; /* Force scroll on small screens */ }
        th { text-align: left; padding: 12px; border-bottom: 2px solid #e5e7eb; }
        td { padding: 12px; border-bottom: 1px solid #e5e7eb; }
        
        /* Loading */
        .loading { display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column; }
        .spinner { width: 64px; height: 64px; border: 4px solid #f3f4f6; border-top: 4px solid #10b981; border-radius: 50%; animation: spin 1s linear infinite; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        
        * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ========================================
   LOADING INDICATORS
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Inline loading for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ========================================
   ENHANCED MESSAGES
   ======================================== */

.message-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9998;
    max-width: 400px;
    width: 90%;
}

.message {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    cursor: pointer;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.message-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.message-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.message-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.message-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.message-text {
    font-size: 0.9rem;
}

.message-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: inherit;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-close:hover {
    opacity: 1;
}

/* ========================================
   CONFIRMATION DIALOGS
   ======================================== */

.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9997;
    padding: 20px;
}

.confirm-dialog.active {
    display: flex;
}

.confirm-content {
    background: white;
    border-radius: 16px;
    padding: 28px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.confirm-icon.warning {
    background: #fef3c7;
    color: #f59e0b;
}

.confirm-icon.danger {
    background: #fee2e2;
    color: #ef4444;
}

.confirm-title {
    font-size: 1.4rem;
    color: #374151;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
}

.confirm-message {
    color: #6b7280;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 12px;
}

.confirm-actions .btn {
    flex: 1;
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #10b981;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.logo p {
    color: #6b7280;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: #10b981;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: #10b981;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
}

.success-message {
    background: #d1fae5;
    color: #059669;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #059669;
}

.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-size: 0.85rem;
    color: #6b7280;
}

/* ========================================
   DASHBOARD LAYOUT
   ======================================== */

.dashboard {
    background: #f3f4f6;
    min-height: 100vh;
}

.navbar {
    background: white;
    padding: 16px 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand h2 {
    color: #10b981;
    font-size: 1.5rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-info .name {
    font-weight: 600;
    color: #374151;
}

.user-info .role {
    font-size: 0.85rem;
    color: #6b7280;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1.5rem;
    color: #374151;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #374151;
}

.stat-card.green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.stat-card.green .stat-value {
    color: #059669;
}

.stat-card.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.stat-card.blue .stat-value {
    color: #2563eb;
}

.stat-card.purple {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
}

.stat-card.purple .stat-value {
    color: #9333ea;
}

.stat-card.orange {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}

.stat-card.orange .stat-value {
    color: #ea580c;
}

/* ========================================
   TABLE STYLES
   ======================================== */

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

thead {
    background: #f9fafb;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

tr:hover {
    background: #f9fafb;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-admin {
    background: #dbeafe;
    color: #1e40af;
}

.badge-region {
    background: #e9d5ff;
    color: #7e22ce;
}

.badge-farmer {
    background: #d1fae5;
    color: #065f46;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ========================================
   MODAL STYLES
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.5rem;
    color: #374151;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ========================================
   SEARCH AND FILTERS
   ======================================== */

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: #10b981;
}

select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #10b981;
}

/* ========================================
   PHOTO GALLERY
   ======================================== */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.photo-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.photo-item:hover {
    transform: translateY(-4px);
}

.photo-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: 12px;
    font-size: 0.85rem;
}

/* ========================================
   UPLOAD AREA
   ======================================== */

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #10b981;
    background: #f0fdf4;
}

.upload-area.dragover {
    border-color: #10b981;
    background: #d1fae5;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mb-2 {
    margin-bottom: 8px;
}

.hidden {
    display: none !important;
}

/* ========================================
   RESPONSIVE - MOBILE FIRST
   ======================================== */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .navbar-brand h2 {
        font-size: 1.2rem;
    }
    
    .navbar-user {
        width: 100%;
        justify-content: space-between;
    }
    
    .container {
        padding: 16px;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card-title {
        font-size: 1.2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        padding: 20px;
        max-width: 100%;
    }
    
    .login-box {
        padding: 24px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .photo-item img {
        height: 150px;
    }
    
    .message-container {
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    .confirm-content {
        padding: 20px;
    }
    
    .confirm-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .navbar-brand h2 {
        font-size: 1rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    table {
        min-width: 500px;
    }
}

/* Add these styles to style.css */

/* Photo popup specific styles */
#photo-popup-modal .modal-content {
    background: transparent;
    box-shadow: none;
}

#photo-popup-img {
    object-fit: contain;
    cursor: zoom-out;
}

#photo-popup-info {
    line-height: 1.6;
}

#photo-popup-info p {
    margin: 8px 0;
    color: #374151;
}

/* Enhanced close button for photo popup */
#photo-popup-modal .close-btn {
    font-size: 2rem;
    line-height: 1;
    padding: 0;
    transition: all 0.3s;
}

#photo-popup-modal .close-btn:hover {
    transform: scale(1.1);
    background: #f3f4f6;
}

/* Smooth modal animation */
.modal {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active .modal-content {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}