/* --- Modern Light Theme / "Breathing" UI --- */
:root {
    /* Palette */
    --bg-body: #f3f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;

    --primary: #667eea;
    --primary-light: #ebf4ff;
    --accent-purple: #764ba2;
    --accent-pink: #ed64a6;
    
    --success: #48bb78;
    --warning: #ecc94b;
    --danger: #f56565;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(148, 163, 184, 0.1);
    --shadow-md: 0 6px 12px rgba(148, 163, 184, 0.15);
    --shadow-lg: 0 15px 30px rgba(148, 163, 184, 0.15);
    --shadow-hover: 0 20px 40px rgba(102, 126, 234, 0.2);

    /* Radii */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    font-size: 15px;
}

/* --- Animated Background --- */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #f3f5f9;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out alternate;
}

.blob-1 { top: -10%; left: -10%; width: 500px; height: 500px; background: #e0e7ff; animation-delay: 0s; }
.blob-2 { bottom: -10%; right: -10%; width: 600px; height: 600px; background: #fce7f3; animation-delay: -5s; }
.blob-3 { top: 40%; left: 40%; width: 400px; height: 400px; background: #e6fffa; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* --- Sidebar --- */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    height: 100%;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.logo i {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px;
    border-radius: 12px;
    min-width: 40px; /* Ensure icon size */
    text-align: center;
}

.nav-menu { list-style: none; flex-grow: 1; }
.nav-item { margin-bottom: 0.8rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background-color: #f7fafc;
    color: var(--primary);
    transform: translateX(5px);
}

.nav-link.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.nav-link i { 
    min-width: 20px; 
    text-align: center; 
    font-size: 1.1rem;
}

.sidebar-footer { margin-top: auto; padding-top: 1.5rem; border-top: 1px solid #e2e8f0; white-space: nowrap; }

/* --- Main Content --- */
.main-content {
    flex: 1;
    padding: 1.5rem; /* Reduced padding for better fit */
    overflow-y: auto;
    position: relative;
}

/* --- Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.breadcrumbs {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    margin-right: 10px;
    padding: 5px;
}

.header-actions { display: flex; gap: 15px; align-items: center; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.user-profile {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: none;
    margin-bottom: 2rem;
    transition: var(--transition);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.card-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* --- Inputs & Forms --- */
.form-control {
    width: 100%;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: var(--transition);
    font-weight: 500;
}

.form-control:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-group { margin-bottom: 1.2rem; }
.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    margin-left: 4px;
}

/* --- Buttons --- */
.btn {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* --- Lists & Tables --- */
.student-item {
    background: white;
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 20px;
    align-items: center;
    transition: var(--transition);
    border: 1px solid #f1f5f9;
}

.student-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: scale(1.01);
}

.student-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.student-info h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-main); }
.student-meta { display: flex; gap: 20px; font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; flex-wrap: wrap; }

.progress-container { width: 100%; max-width: 250px; margin-top: 12px; }
.progress-bar { height: 8px; background: #edf2f7; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-primary); border-radius: 4px; transition: width 1s ease; }

/* --- Status & Actions --- */
.status-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active { background: #def7ec; color: #2f855a; }
.status-paused { background: #fefcbf; color: #b7791f; }

.action-menu { display: flex; gap: 10px; flex-wrap: wrap; }
.action-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    border: none;
    background: #f7fafc;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    gap: 8px;
}

.action-btn:hover { background: white; box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.action-btn.delete:hover { color: var(--danger); background: #fff5f5; }
.action-btn.link:hover { color: var(--primary); background: var(--primary-light); }

/* --- Layouts --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr; /* Slightly smaller sidebar column */
    gap: 30px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); /* Responsive */
    gap: 25px;
    margin-bottom: 30px;
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); /* Responsive charts */
    gap: 30px;
}

/* --- KPI Cards --- */
.kpi-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 20px;
    border-radius: var(--radius-md);
    background: white;
}

.kpi-value { font-size: 2rem; font-weight: 800; color: var(--text-main); line-height: 1; margin-bottom: 5px; }
.kpi-label { color: var(--text-secondary); font-weight: 500; font-size: 0.9rem; }

/* --- Filter Tabs --- */
.filter-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 5px;
    border-radius: var(--radius-sm);
}

.filter-tab {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.filter-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* --- Toast --- */
.toast-container { position: fixed; top: 30px; right: 30px; z-index: 2000; }
.toast {
    background: white;
    color: var(--text-main);
    padding: 16px 24px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-hover);
    animation: slideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--primary);
    font-weight: 500;
}
.toast.error { border-left-color: var(--danger); }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }

@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Skeleton & Scrollbar --- */
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%); background-size: 200% 100%; animation: loading 1.5s infinite; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* --- Table --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.full-table {
    width: 100%;
    min-width: 800px; /* Force scroll on small screens */
    border-collapse: collapse;
}
.full-table th { 
    color: var(--text-secondary); 
    font-weight: 600; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 0.5px; 
    padding: 1rem; 
    border-bottom: 2px solid #f1f5f9; 
    text-align: left;
}
.full-table td { 
    padding: 1rem; 
    border-bottom: 1px solid #f1f5f9; 
    color: var(--text-main); 
}
.full-table tr:hover { background: #f8fafc; }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
    padding: 0;
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover { color: var(--danger); }

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.quick-dates {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.quick-date-btn {
    padding: 8px 12px;
    background: #edf2f7;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.quick-date-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* --- Custom Select --- */
.custom-select-container {
    position: relative;
    user-select: none;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.custom-select-trigger:hover {
    background: #ffffff;
    border-color: #e2e8f0;
}

.custom-select-container.open .custom-select-trigger {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.custom-select-trigger i.arrow {
    transition: transform 0.3s;
    color: var(--text-secondary);
}

.custom-select-container.open .custom-select-trigger i.arrow {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    display: block;
    top: 110%;
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid #f1f5f9;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
}

.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.custom-option:hover {
    background-color: #f7fafc;
    color: var(--primary);
}

.custom-option.selected {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* --- Full List Layout (Replacement for Table) --- */
.list-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #f1f5f9;
    background: white;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.list-header-col {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.list-header-col:hover {
    color: var(--primary);
}

.list-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.list-item {
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid #f1f5f9;
    padding: 1.5rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.list-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.list-item-main {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr;
    align-items: center;
    gap: 15px;
}

.list-item-actions {
    display: flex;
    gap: 10px;
    padding-top: 1.2rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.action-btn-labeled {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn-labeled:hover {
    background: white;
    border-color: #e2e8f0;
    box-shadow: var(--shadow-sm);
    color: var(--primary);
    transform: translateY(-1px);
}

.action-btn-labeled.delete:hover {
    color: var(--danger);
    background: #fff5f5;
    border-color: #feb2b2;
}

.action-btn-labeled i {
    font-size: 1rem;
}

/* Responsive for List */
@media (max-width: 1000px) {
    .list-header { display: none; } /* Hide header on smaller screens */
    .list-item-main {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* --- Responsive --- */
@media (max-width: 1400px) {
    .full-table th:nth-child(4), /* Expiration column usually */
    .full-table td:nth-child(4) {
        display: none;
    }
}

@media (max-width: 1200px) {
    /* Mini Sidebar Mode */
    .sidebar {
        width: 80px;
        padding: 2.5rem 15px;
    }
    
    .logo-text, 
    .logo span:not(.logo-icon),
    .nav-text {
        display: none;
        opacity: 0;
    }
    
    .logo { 
        justify-content: center; 
        margin-bottom: 2rem;
    }
    
    .nav-link {
        justify-content: center;
        padding: 14px;
    }
    
    .nav-link:hover {
        transform: none;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid .left-column {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    /* Mobile Mode - Sidebar Hidden */
    .sidebar { 
        position: fixed; 
        left: -280px; 
        width: 280px; /* Restore full width on mobile menu */
        padding: 2.5rem 1.5rem;
    }
    
    .sidebar.open { 
        transform: translateX(280px); 
        box-shadow: 0 0 100px rgba(0,0,0,0.5); 
    }
    
    /* Restore text for mobile menu */
    .logo-text, 
    .nav-text {
        display: inline-block;
        opacity: 1;
    }
    
    .logo { justify-content: flex-start; }
    .nav-link { justify-content: flex-start; }
    
    .menu-toggle {
        display: inline-block;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    /* Hide less critical columns on mobile */
    .full-table th:nth-child(2), 
    .full-table td:nth-child(2) {
        display: none; /* Hide Config on very small screens */
    }
}
