/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 30px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    font-size: 28px;
    color: #4ade80;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: #4ade80;
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: #4ade80;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    background-color: #f5f7fa;
}

.top-header {
    background: white;
    padding: 25px 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.top-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date {
    color: #6b7280;
    font-weight: 500;
}

.content {
    padding: 40px;
    max-width: 1400px;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stat-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.stat-header i {
    font-size: 24px;
}

.stat-number {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

/* Card Color Themes */
.stat-card.ready {
    border-left: 4px solid #10b981;
}

.stat-card.ready .stat-header i {
    color: #10b981;
}

.stat-card.ready .stat-number {
    color: #10b981;
}

.stat-card.not-ready {
    border-left: 4px solid #f59e0b;
}

.stat-card.not-ready .stat-header i {
    color: #f59e0b;
}

.stat-card.not-ready .stat-number {
    color: #f59e0b;
}

.stat-card.overdue {
    border-left: 4px solid #ef4444;
}

.stat-card.overdue .stat-header i {
    color: #ef4444;
}

.stat-card.overdue .stat-number {
    color: #ef4444;
}

.stat-card.total-scans {
    border-left: 4px solid #3b82f6;
}

.stat-card.total-scans .stat-header i {
    color: #3b82f6;
}

.stat-card.total-scans .stat-number {
    color: #3b82f6;
}

.stat-card.total-mushrooms {
    border-left: 4px solid #8b5cf6;
}

.stat-card.total-mushrooms .stat-header i {
    color: #8b5cf6;
}

.stat-card.total-mushrooms .stat-number {
    color: #8b5cf6;
}

.stat-card.avg-per-scan {
    border-left: 4px solid #06b6d4;
}

.stat-card.avg-per-scan .stat-header i {
    color: #06b6d4;
}

.stat-card.avg-per-scan .stat-number {
    color: #06b6d4;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.upload-card h3 {
    font-size: 22px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-content i {
    font-size: 48px;
    color: #9ca3af;
    margin-bottom: 20px;
}

.upload-content p {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 25px;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

/* Image Display Section */
.image-display-section {
    margin-bottom: 40px;
}

.image-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.image-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.image-card h4 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 20px;
    text-align: center;
}

.image-wrapper {
    text-align: center;
    border-radius: 12px;
    overflow: hidden;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.image-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
}

/* Recent Scans / History */
.recent-scans,
.history-table-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.recent-scans h3 {
    font-size: 22px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scans-table-container,
.table-container {
    overflow-x: auto;
}

.scans-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.scans-table th,
.scans-table td,
.history-table th,
.history-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.scans-table th,
.history-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
    cursor: pointer;
    transition: background 0.3s ease;
}

.scans-table th:hover,
.history-table th:hover {
    background: #f3f4f6;
}

.scans-table th i,
.history-table th i {
    margin-left: 5px;
    opacity: 0.5;
}

.scans-table tr:hover,
.history-table tr:hover {
    background: #f9fafb;
}

/* History Page Specific */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.history-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-actions {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.table-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group,
.search-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.search-group {
    position: relative;
    margin-left: auto;
}

.search-group input {
    padding: 8px 40px 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    width: 250px;
}

.search-group i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 22px;
    font-weight: 600;
    color: #374151;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #9ca3af;
    transition: color 0.3s ease;
}

.close:hover {
    color: #374151;
}

.modal-body {
    padding: 30px;
}

.modal-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.modal-image-container {
    text-align: center;
}

.modal-image-container h4 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
}

.modal-image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

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

.loading-spinner {
    background: white;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
}

.loading-spinner p {
    font-size: 16px;
    color: #374151;
    font-weight: 600;
}

/* Badge Styles for Count Values */
.count-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.count-badge.ready {
    background: #10b981;
}

.count-badge.not-ready {
    background: #f59e0b;
}

.count-badge.overdue {
    background: #ef4444;
}

.count-badge.total {
    background: #6b7280;
}

/* Action Buttons in Tables */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 5px;
}

.action-btn.view {
    background: #3b82f6;
    color: white;
}

.action-btn.view:hover {
    background: #2563eb;
}

.action-btn.delete {
    background: #ef4444;
    color: white;
}

.action-btn.delete:hover {
    background: #dc2626;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .image-container {
        grid-template-columns: 1fr;
    }
    
    .modal-images {
        grid-template-columns: 1fr;
    }
    
    .table-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-group {
        margin-left: 0;
    }
    
    .search-group input {
        width: 100%;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 4000;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast.warning {
    background: #f59e0b;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
