:root {
    /* Colors */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Brand Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    --secondary: #ec4899;
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 1rem;
    --radius-lg: 1.5rem;

    /* Font */
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
}

.badge-student {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.badge-teacher {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary-gradient);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    font-size: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-left: auto;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.logout-btn span {
    font-size: 1.25rem;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.topbar-actions {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.content-wrapper {
    padding: 2rem;
    flex: 1;
}

/* --- Components --- */

/* Cards */
.card,
.glass-panel,
.welcome-card,
.stat-card,
.subject-card,
.action-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle border for definition */
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* Buttons */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary,
.btn-premium {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover,
.btn-premium:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: white;
    font-family: inherit;
}

.form-group input:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Page Layout & Grid --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* --- Subject Card Premium Design --- */
.subject-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.subject-card:hover {
    transform: translateY(-5px);
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.subject-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.subject-card:hover::before {
    opacity: 1;
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.subject-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #818cf8;
}

.subject-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s ease;
}

.subject-card:hover .subject-actions {
    opacity: 1;
    transform: translateX(0);
}

.btn-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.subject-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.subject-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex: 1;
    /* Pushes stats to bottom */
}

.subject-stats {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.subject-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.subject-stat-value {
    font-weight: 700;
    color: white;
    font-size: 1rem;
}

.subject-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Landing Page Specific Styles (Scoped) --- */

/* --- Global Components --- */

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: 1.5rem;
    padding: 2rem;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.close-modal,
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover,
.modal-close:hover {
    color: white;
}

.modal-body {
    margin-bottom: 2rem;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.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);
    }
}

/* Gradebook / Results Table (Dark Theme) */
.gradebook-container {
    position: relative;
    height: calc(100vh - 240px);
    overflow: auto;
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gradebook-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.gradebook-table th,
.gradebook-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-card);
    white-space: nowrap;
    color: var(--text-primary);
}

/* Sticky Header */
.gradebook-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-sidebar);
    /* Slightly darker */
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Sticky First Column */
.gradebook-table tbody td:first-child,
.gradebook-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 30;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--bg-card);
}

.gradebook-table thead th:first-child {
    z-index: 40;
    background: var(--bg-sidebar);
}

.gradebook-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

.gradebook-table tbody tr:hover td:first-child {
    background-color: #27354f;
    /* Highlight for sticky col */
}

/* Cells */
.score-cell {
    text-align: center;
}

.score-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
}

.score-val {
    font-weight: 700;
    font-size: 1rem;
}

.score-type {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Status Colors */
.score-high {
    color: #10b981;
}

.score-mid {
    color: #f59e0b;
}

.score-low {
    color: #ef4444;
}

.score-none {
    color: var(--text-muted);
}

/* --- Landing Page Specific Styles (Scoped) --- */
/* Navbar Overlay */
.landing-page .navbar {
    display: flex;

    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 5%;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 50;
    background: transparent;
}

.landing-page .nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.landing-page .nav-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    cursor: pointer;
    font-weight: 600;
}

.landing-page .nav-btn:hover {
    background: white;
    color: var(--primary);
}

/* Hero Section */
.landing-page .hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.landing-page .hero h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    max-width: 800px;
}

.landing-page .hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

/* Background Animation */
.landing-page .bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.landing-page .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blob-bounce 10s infinite ease-in-out;
}

.landing-page .blob-1 {
    width: 500px;
    height: 500px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.landing-page .blob-2 {
    width: 400px;
    height: 400px;
    background: #ec4899;
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes blob-bounce {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Stats Section (Landing) */
.landing-page .stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: -4rem auto 4rem auto;
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.landing-page .stats-container .stat-card {
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 1.5rem;
    text-align: center;
    transition: transform 0.3s;
    display: block;
}

.landing-page .stats-container .stat-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.8);
}

.landing-page .stats-container .stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Resources Section */
.landing-page .resources {
    padding: 4rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.landing-page .section-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 3rem;
    text-align: center;
}

.landing-page .resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.landing-page .resource-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    padding: 2rem;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.landing-page .resource-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.landing-page .resource-img {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
}

.landing-page .resource-content h3 {
    font-size: 1.25rem;
    color: white;
    margin-bottom: 1rem;
}

.landing-page .resource-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.landing-page .btn-link {
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.2s;
}

.landing-page .btn-link:hover {
    gap: 0.75rem;
}

/* Login Modal Specifics (Scoped to avoid affecting other modals) */
.landing-page .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
}

.landing-page .modal-overlay.active {
    display: flex;
    opacity: 1;
}

.landing-page .modal {
    background: #1e293b;
    width: 100%;
    max-width: 450px;
    border-radius: 1.5rem;
    padding: 2rem;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s;
    border: 1px solid #334155;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.landing-page .modal-overlay.active .modal {
    transform: scale(1);
}

.landing-page .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.landing-page .modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.landing-page .close-modal {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.landing-page .tabs {
    display: flex;
    background: #0f172a;
    padding: 0.5rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
}

.landing-page .tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: none;
    color: #94a3b8;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.landing-page .tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.landing-page .tab-content {
    display: none;
}

.landing-page .tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

.landing-page .btn-submit {
    width: 100%;
    padding: 1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.landing-page .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

/* --- Dashboard Specific Styles (Teacher/Student) --- */

/* Stat Card Colors */
.stat-card.stat-green .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-card.stat-blue .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.stat-card.stat-purple .stat-icon {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-card.stat-orange .stat-icon {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.stat-card.stat-pink .stat-icon {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

/* Welcome Card */
.welcome-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: white;
    border: none;
    /* Override default card border if needed */
}

.welcome-text h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.welcome-text p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.welcome-date {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(4px);
    font-weight: 500;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
}

.action-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
}

.action-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.05);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    transition: background-color 0.2s;
}

.action-card:hover .action-icon {
    background: var(--primary);
    color: white;
}

.action-text {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.activity-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.2rem;
}

.activity-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.activity-user {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.activity-action {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-score {
    font-weight: 700;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.section {
    margin-bottom: 1.5rem;
    text-align: left;
    /* Dashboard standard */
}

/* --- Modules and Topics (Subject Detail) --- */
.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: white;
}

.modules-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s;
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
}

.module-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.module-card.open .module-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.module-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.module-icon {
    font-size: 1.5rem;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
}

.module-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.module-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.module-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.module-toggle {
    color: var(--text-secondary);
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.module-card.open .module-toggle {
    transform: rotate(180deg);
}

.module-content {
    display: none;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
}

.module-card.open .module-content {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.topic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    transition: transform 0.2s;
}

.topic-item:hover {
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.1);
}

.topic-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topic-icon {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.topic-title {
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1rem;
}

.topic-title:hover {
    color: var(--primary);
}

.topic-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.topic-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.topic-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.topic-item:hover .topic-actions {
    opacity: 1;
}

/* Forms in Modals */
.form-divider {
    font-weight: 600;
    color: white;
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* --- Choices.js Dark Theme Overrides --- */
.choices__inner {
    background-color: var(--bg-card) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 0.75rem !important;
    min-height: 45px;
    display: flex;
    align-items: center;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
    background-color: var(--bg-card) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 0.75rem !important;
    margin-top: 0.5rem;
}

.choices__item {
    color: var(--text-primary) !important;
}

.choices__item--choice.is-highlighted {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.choices__input {
    background-color: transparent !important;
    color: white !important;
}

/* Fallback for form-select if not using Choices */
.form-select {
    background-color: var(--bg-card);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

/* --- Topic Detail Page Styles --- */

.topic-qr {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qr-code {
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.topic-settings-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

/* Questions List */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.question-num {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.question-content {
    flex: 1;
}

.question-text {
    font-weight: 500;
    margin-bottom: 12px;
    color: white;
}

.question-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.option.correct {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
    font-weight: 500;
}

/* Assignments */
.assignments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.assignment-info h4 {
    font-weight: 600;
    margin-bottom: 4px;
    color: white;
}

.assignment-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.assignment-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
}

.file-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.file-link:hover {
    text-decoration: underline;
}

/* Resources */
.resources-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.resource-type {
    font-size: 24px;
}

.resource-info {
    flex: 1;
}

.resource-info h4 a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.resource-info h4 a:hover {
    color: var(--primary);
}

.resource-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* AI Preview */
.ai-preview-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

.ai-question-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    margin-bottom: 8px;
}

.ai-question-num {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.ai-question-content {
    flex: 1;
    color: var(--text-secondary);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}
/* --- Resources System (New) --- */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.resource-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.resource-card:hover {
    transform: translateY(-5px);
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    background: var(--bg-card); /* Keep bg same but shadow does the work */
}

.resource-card:hover::before {
    content: ''; /* Top highlight */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #ec4899);
}

.resource-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.resource-icon-box {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.resource-card:hover .resource-icon-box {
    transform: scale(1.05) rotate(-3deg);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Icon Variants */
.icon-box-pdf { color: #f43f5e; background: rgba(244, 63, 94, 0.1); }
.icon-box-word { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.icon-box-video { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.icon-box-image { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.icon-box-audio { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
.icon-box-link { color: #06b6d4; background: rgba(6, 182, 212, 0.1); }

.resource-info {
    flex: 1;
    min-width: 0;
}

.resource-title {
    font-weight: 600;
    color: white;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-title a {
    text-decoration: none;
    transition: color 0.2s;
}

.resource-title a:hover {
    color: var(--primary);
}

.resource-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.resource-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: auto;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.resource-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 500;
}

.resource-actions {
    display: flex;
    gap: 0.5rem;
}
