/* ================================================================
   DASHBOARD.CSS - Dashboard Layout, Sidebar, Tables, Stats
   ================================================================ */

/* ===== DASHBOARD CONTAINER ===== */
.dashboard-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-lg);
    min-height: calc(100vh - 150px);
}

/* ===== SIDEBAR NAVIGATION ===== */
.sidebar {
    background-color: var(--bg-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    height: fit-content;
    position: sticky;
    top: 100px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.sidebar-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 500;
    color: var(--text-light);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-item:hover {
    background-color: var(--primary-green-light);
    color: var(--bg-white);
    transform: translateX(4px);
}

.sidebar-item.active {
    background-color: var(--primary-green);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
}

/* ===== DASHBOARD CONTENT ===== */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ===== STATISTICS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-light));
    color: var(--bg-white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-orange-light));
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, var(--info), #60a5fa);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, var(--success), #4ade80);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin: var(--spacing-md) 0;
}

.stat-label {
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

.stat-change {
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-md);
    opacity: 0.85;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background-color: var(--bg-light);
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-dark);
}

td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

tbody tr {
    transition: background-color 0.3s ease;
}

tbody tr:hover {
    background-color: var(--bg-lighter);
}

/* ===== TABS ===== */
.tab-content {
    display: none;
    animation: slideIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.action-buttons .btn {
    flex: 1;
}
/* responsive.css - Add these rules */

/* Mobile devices */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .sidebar {
        position: static;
        margin-bottom: var(--spacing-md);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .stat-value {
        font-size: var(--font-size-2xl);
    }
    
    .table-container {
        font-size: 14px;
    }
    
    .nav-links {
        display: none;
    }
    
    .user-menu {
        gap: 10px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: var(--spacing-md);
    }
    
    table th, table td {
        padding: var(--spacing-sm);
        font-size: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Prevent zoom on input focus */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* DASHBOARD MOBILE EMERGENCY FIXES */
@media (max-width: 768px) {
    /* Force full width */
    body, html, main, .container, .dashboard-content {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    /* Fix stats grid once and for all */
    .stats-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        justify-content: space-between !important;
        width: 100% !important;
    }
    
    .stat-card {
        flex: 0 0 calc(50% - 6px) !important;
        min-width: 0 !important;
        max-width: calc(50% - 6px) !important;
        padding: 16px 12px !important;
        box-sizing: border-box !important;
    }
    
    .stat-value {
        font-size: 22px !important;
        line-height: 1.3 !important;
        margin: 8px 0 !important;
        min-height: 30px !important;
    }
    
    /* Special handling for long numbers */
    .stat-card:nth-child(1) .stat-value {
        font-size: 20px !important;
        letter-spacing: -0.3px !important;
    }
    
    /* Ensure all text is visible */
    .stat-label,
    .stat-value,
    .stat-change {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        gap: 8px !important;
    }
    
    .stat-card {
        flex: 0 0 calc(50% - 4px) !important;
        max-width: calc(50% - 4px) !important;
        padding: 12px 8px !important;
    }
    
    .stat-value {
        font-size: 18px !important;
    }
    
    .stat-card:nth-child(1) .stat-value {
        font-size: 16px !important;
    }
}

@media (max-width: 360px) {
    /* For very small screens, stack vertically */
    .stats-grid {
        flex-direction: column !important;
    }
    
    .stat-card {
        flex: 1 1 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
}