/* Global Resets & Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --color-slate-900: #0f172a;
    --color-slate-800: #1e293b;
    --color-slate-700: #334155;
    --color-slate-600: #475569;
    --color-primary: #2563eb;
    --color-text-main: #f1f5f9;
    --color-text-muted: #94a3b8;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-slate-900);
    color: var(--color-text-main);
    margin: 0;
    padding: 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-slate-900);
}
::-webkit-scrollbar-thumb {
    background: var(--color-slate-700);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-slate-600);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-up {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-slate-900);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--color-slate-800);
    border-right: 1px solid var(--color-slate-700);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
    z-index: 60;
}

/* Topbar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--color-slate-900);
}

.top-bar {
    height: 64px;
    background-color: var(--color-slate-800);
    border-bottom: 1px solid var(--color-slate-700);
    display: flex;
    align-items: center;
    padding: 0 24px;
    flex-shrink: 0;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Responsive Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        height: 100%;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Content Padding adjustments for mobile */
    .content-area {
        padding: 16px;
    }
    .top-bar {
        padding: 0 16px;
    }
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Utility Classes for Cards */
.dashboard-card {
    background: var(--color-slate-800);
    border-radius: 12px;
    border: 1px solid var(--color-slate-700);
    padding: 20px;
    transition: all 0.2s;
    color: #f8fafc;
}
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: var(--color-slate-600);
}

/* Category Card Styling (Matches App.js logic class) */
.category-card {
    background: var(--color-slate-800);
    border: 1px solid var(--color-slate-700);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.category-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
    background: var(--color-slate-800);
}
.category-card i {
    font-size: 2rem;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1); /* Blue 500/10 */
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 8px;
}
.category-card h3 {
    font-weight: 600;
    color: #f8fafc; /* Slate 50 */
    margin: 0;
}
.category-card p {
    color: #94a3b8; /* Slate 400 */
    font-size: 0.875rem;
    margin: 0;
}

/* Special Exam Card Override */
#special-exams-grid .category-card {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-top: 4px solid #fbbf24;
    color: white;
}
#special-exams-grid .category-card:hover {
    box-shadow: 0 10px 15px -3px rgba(251, 191, 36, 0.1);
}
#special-exams-grid .category-card i {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}
#special-exams-grid .category-card h3 {
    color: #fbbf24;
}
#special-exams-grid .category-card p {
    color: #94a3b8;
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Form Elements */
input, select, textarea {
    background-color: var(--color-slate-900);
    color: white;
    border-color: var(--color-slate-700);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* -------------------------------------------------------------------------- */
/* Tailwind Light-UI Overrides (Dashboard Pages)                               */
/*                                                                            */
/* Several pages (teacher/index/account/etc.) use Tailwind utility classes like */
/* bg-white/bg-gray-50/text-gray-900 that conflict with the site's dark theme */
/* defined above. These overrides keep the layout/spacing from Tailwind while */
/* forcing the dark palette inside the dashboard shell.                        */
/* -------------------------------------------------------------------------- */

.dashboard-layout .bg-white { background-color: var(--color-slate-800) !important; }
.dashboard-layout .bg-gray-50 { background-color: var(--color-slate-900) !important; }
.dashboard-layout .bg-gray-100 { background-color: var(--color-slate-700) !important; }
.dashboard-layout .bg-gray-200 { background-color: var(--color-slate-700) !important; }

.dashboard-layout .text-gray-900,
.dashboard-layout .text-gray-800,
.dashboard-layout .text-gray-700 { color: var(--color-text-main) !important; }

.dashboard-layout .text-gray-600,
.dashboard-layout .text-gray-500,
.dashboard-layout .text-gray-400 { color: var(--color-text-muted) !important; }

.dashboard-layout .border-gray-300,
.dashboard-layout .border-gray-200,
.dashboard-layout .border-gray-100 { border-color: var(--color-slate-700) !important; }

.dashboard-layout .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
.dashboard-layout .divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--color-slate-700) !important;
}

.dashboard-layout .placeholder-gray-500::placeholder,
.dashboard-layout .placeholder-gray-400::placeholder {
    color: rgba(148, 163, 184, 0.85) !important;
}

/* Form elements inside dashboard pages should always be dark (Tailwind may set bg-white). */
.dashboard-layout input,
.dashboard-layout select,
.dashboard-layout textarea {
    background-color: var(--color-slate-900) !important;
    color: var(--color-text-main) !important;
    border-color: var(--color-slate-700) !important;
}

/* Plan/limit strip: ensure it matches dark theme even if Tailwind sets a light gradient. */
#plan-limit-strip {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.92)) !important;
    border-bottom-color: var(--color-slate-700) !important;
}
#plan-limit-strip .w-px { background-color: var(--color-slate-700) !important; }
