/* Premium LMS Theme Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* GREEN BRANDING COLORS */
    --primary: #10b981;
    --primary-hover: #059669;
    --primary-light: rgba(16, 185, 129, 0.1);
    --secondary: #14b8a6;
    --secondary-hover: #0d9488;
    
    /* DEFAULT DARK MODE COLORS */
    --dark-bg: #0b0f19;
    --card-bg: #111827;
    --card-border: rgba(255, 255, 255, 0.06);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-bg: rgba(17, 24, 39, 0.7);
    --grad-1: rgba(16, 185, 129, 0.12);
    --grad-2: rgba(20, 184, 166, 0.08);
    --bg-muted: rgba(255, 255, 255, 0.02);
    --input-bg: rgba(255, 255, 255, 0.04);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus-bg: rgba(255, 255, 255, 0.07);
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --auth-shadow: rgba(0, 0, 0, 0.3);
    --discussion-bg: rgba(255, 255, 255, 0.015);
    --reply-bg: rgba(255, 255, 255, 0.01);
    --reply-border: rgba(255, 255, 255, 0.03);
    --card-glow-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(20, 184, 166, 0.05));
}

/* LIGHT MODE OVERRIDES - RETAINS GREEN BRANDING */
html.theme-light, body.theme-light {
    --dark-bg: #f4f6f9;
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.06);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --grad-1: rgba(16, 185, 129, 0.08);
    --grad-2: rgba(20, 184, 166, 0.05);
    --bg-muted: rgba(0, 0, 0, 0.02);
    --input-bg: rgba(0, 0, 0, 0.02);
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus-bg: rgba(0, 0, 0, 0.04);
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --auth-shadow: rgba(0, 0, 0, 0.08);
    --discussion-bg: rgba(0, 0, 0, 0.01);
    --reply-bg: rgba(0, 0, 0, 0.005);
    --reply-border: rgba(0, 0, 0, 0.03);
    --card-glow-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.03), rgba(20, 184, 166, 0.03));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, var(--grad-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--grad-2) 0px, transparent 50%);
    background-attachment: fixed;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--dark-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Authentication Page */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 45px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.8s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 35px;
}

.auth-logo {
    font-weight: 800;
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

/* Form Styling */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
    background: var(--input-focus-bg);
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    gap: 10px;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Alert system */
.alert {
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 25px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Layout System */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 280px;
    background: var(--card-bg);
    border-right: 1px solid var(--card-border);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 35px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-left: 10px;
}

.sidebar-user {
    padding: 15px;
    background: var(--bg-muted);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.user-info .user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 550;
    color: var(--text-muted);
    transition: var(--transition);
    gap: 12px;
}

.menu-item.active a, .menu-item a:hover {
    color: var(--primary);
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.sidebar-footer {
    margin-top: auto;
}

/* Main Content Area */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 40px;
    min-height: 100vh;
    transition: var(--transition);
}

/* Header Banner */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* Grid System */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 35px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 24px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: var(--card-glow-bg);
    border-radius: 0 0 0 100%;
}

.stat-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-val {
    font-size: 32px;
    font-weight: 800;
    margin-top: 10px;
    color: var(--text-main);
}

/* Cards & Sections */
.card-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 30px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Class Grid */
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.class-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.class-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.class-card-banner {
    height: 120px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 20px;
    display: flex;
    align-items: flex-end;
}

.class-code {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    margin-bottom: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    width: max-content;
}

.class-card-body {
    padding: 24px;
}

.class-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.class-lecturer {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.class-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--card-border);
    padding-top: 15px;
    font-size: 13px;
}

/* Modern Tab System */
.tab-container {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--card-border);
    gap: 10px;
    margin-bottom: 30px;
}

.tab-nav {
    padding: 14px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-nav.active, .tab-nav:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

/* Discussion Forum */
.discussions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.discussion-card {
    background: var(--discussion-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.discussion-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.discussion-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}

.discussion-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 18px;
}

.replies-box {
    margin-top: 20px;
    padding-left: 20px;
    border-left: 2px solid var(--card-border);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reply-card {
    background: var(--reply-bg);
    border: 1px solid var(--reply-border);
    padding: 15px;
    border-radius: var(--radius-sm);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    padding: 35px;
    animation: scaleUp 0.3s ease;
}

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

.modal-close {
    cursor: pointer;
    font-size: 24px;
    color: var(--text-muted);
}

/* Attendance Styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

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

.data-table th, .data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.data-table th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
}

.data-table tr:hover td {
    background: var(--reply-bg);
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
}

/* Badge values */
.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Circle Progress bar */
.circle-progress {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quiz Player Custom Styling */
.quiz-wrapper {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 30px;
}

.quiz-timer-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    position: sticky;
    top: 30px;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
}

.timer-countdown {
    font-size: 28px;
    font-weight: 800;
    color: var(--warning);
    margin-top: 10px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============================================
   RESPONSIVE — TABLET (≤ 992px)
   ============================================ */
@media (max-width: 992px) {
    /* Sidebar becomes off-canvas overlay */
    .sidebar {
        transform: translateX(-100%);
        width: 270px;
        padding: 25px 18px;
        z-index: 1000;
        box-shadow: 4px 0 30px rgba(0,0,0,0.4);
    }

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

    /* Restore all sidebar content that was hidden */
    .sidebar-brand,
    .user-info,
    .menu-item a span {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 24px 18px;
    }

    /* Hamburger button */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Overlay behind open sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    /* Page header stacks vertically */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    /* Stats / card grids become 2-column */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    /* Form rows stack */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Quiz layout stacks */
    .quiz-wrapper {
        grid-template-columns: 1fr;
    }

    .quiz-timer-box {
        position: static;
        order: -1;
    }

    /* Tables get horizontal scroll */
    .table-wrapper, table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Class tabs scroll horizontally */
    .class-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .class-tabs .tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤ 576px)
   ============================================ */
@media (max-width: 576px) {
    /* Auth card full width */
    .auth-card {
        padding: 28px 20px;
        border-radius: var(--radius-md);
    }

    /* Page title smaller */
    .page-title h1 {
        font-size: 20px;
    }

    .main-content {
        padding: 18px 14px;
    }

    /* Stats grid becomes single column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Stat card row layout on very small screens */
    .stat-card {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    /* Buttons full-width stacked */
    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Modal wider on mobile */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 22px 16px !important;
        margin: 10px;
    }

    /* Hide table columns selectively via data-mobile attribute */
    th[data-mobile="hide"],
    td[data-mobile="hide"] {
        display: none;
    }

    /* Class tabs font size */
    .class-tabs .tab-btn {
        font-size: 12px;
        padding: 10px 14px;
    }

    /* Dashboard chart grid */
    .charts-grid {
        grid-template-columns: 1fr !important;
    }

    /* Card actions wrap */
    .card-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-actions .btn {
        flex: 1;
        min-width: 120px;
    }

    /* Timer countdown smaller */
    .timer-countdown {
        font-size: 22px;
    }
}

/* ============================================
   HAMBURGER MENU BUTTON (Hidden on desktop)
   ============================================ */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}
