/* DESIGN SYSTEM & GLOBAL VARIABLES */
:root {
    /* Fonts */
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Light Theme (Default Moodle-inspired Premium) */
    --bg-primary: #f4f6f9;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --accent-color: #0c5ca7; /* Moodle Navy Blue */
    --accent-light: #e6f0fa;
    --accent-pink: #d92562;  /* Moodle Pink/Red header icon */
    --accent-pink-light: #fce8ef;
    
    --question-bg: #f0f7fc;  /* Light blue container for questions */
    --question-border: #cbdce9;
    
    --feedback-bg: #fff3cd;  /* Soft orange/cream for correct answer feedback */
    --feedback-border: #ffeeba;
    --feedback-text: #856404;
    
    --correct-bg: #d1e7dd;
    --correct-border: #badbcc;
    --correct-text: #0f5132;
    
    --incorrect-bg: #f8d7da;
    --incorrect-border: #f5c2c7;
    --incorrect-text: #842029;

    --border-color: #e5e7eb;
    --input-bg: #ffffff;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme overrides */
body.dark-theme {
    --bg-primary: #0f172a; /* Slate 900 */
    --bg-card: #1e293b;    /* Slate 800 */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --accent-color: #3b82f6; /* Blue 500 */
    --accent-light: #1e3a8a;
    --accent-pink: #f43f5e;
    --accent-pink-light: #4c0519;
    
    --question-bg: #1e293b;  /* Slate 800 */
    --question-border: #334155;
    
    --feedback-bg: #451a03;  /* Dark warm orange */
    --feedback-border: #7c2d12;
    --feedback-text: #fdba74;
    
    --correct-bg: #064e3b;
    --correct-border: #047857;
    --correct-text: #a7f3d0;
    
    --incorrect-bg: #7f1d1d;
    --incorrect-border: #b91c1c;
    --incorrect-text: #fca5a5;

    --border-color: #334155;
    --input-bg: #0f172a;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* BASE STYLES */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* THEME TOGGLE BUTTON */
.theme-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-btn:hover {
    transform: scale(1.1);
    background: var(--accent-light);
    color: var(--accent-color);
}

/* GLOBAL CONTAINER */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* SECTION MANAGEMENT */
section {
    display: none;
    min-height: 100vh;
}

section.active-section {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* COMMON BUTTONS */
.btn-primary {
    background-color: var(--accent-color);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
    background-color: #0a4f91;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--accent-pink);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-danger:hover {
    background-color: #b81b51;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: var(--accent-color);
    color: white;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-large {
    padding: 14px 28px;
    font-size: 1.1rem;
    border-radius: var(--border-radius-lg);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-link:hover {
    color: #083c6d;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--accent-pink);
    background: var(--border-color);
}

/* 1. AUTH SCREEN STYLING (LOGIN / REGISTER TABS) */
#auth-section {
    background: radial-gradient(circle at 10% 20%, rgba(12, 92, 167, 0.08) 0%, rgba(217, 37, 98, 0.04) 90%), var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 35px 30px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    transition: var(--transition);
}

.auth-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-pink));
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 8px 16px rgba(12, 92, 167, 0.2);
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 25px;
}

.auth-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 10px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.auth-tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.auth-card h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 25px;
}

.input-group {
    text-align: left;
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(12, 92, 167, 0.15);
}

.auth-options {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.auth-footer {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 2. STUDENT DASHBOARD STYLING */
.dashboard-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.user-info-bar {
    display: flex;
    align-items: center;
    gap: 15px;
}

#student-user-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.welcome-card {
    background: linear-gradient(135deg, rgba(12, 92, 167, 0.04), rgba(217, 37, 98, 0.04)), var(--bg-card);
    border-left: 6px solid var(--accent-color);
}

.welcome-card h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.welcome-card h1 i {
    color: var(--accent-color);
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.student-dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    margin-bottom: 20px;
}

.empty-state-message {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state-message i {
    font-size: 2.5rem;
    color: var(--text-muted);
}

/* Quiz Module Cards in Student Selection */
.quiz-modules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.quiz-module-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    cursor: pointer;
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.quiz-module-item:hover {
    border-color: var(--accent-color);
    background-color: var(--accent-light);
    transform: translateX(5px);
}

body.dark-theme .quiz-module-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.quiz-module-item.active {
    border-color: var(--accent-color);
    background-color: var(--accent-light);
    font-weight: 600;
}

body.dark-theme .quiz-module-item.active {
    background-color: rgba(59, 130, 246, 0.15);
}

.quiz-module-info h4 {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quiz-module-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.selected-module-badge {
    background: var(--accent-pink-light);
    color: var(--accent-pink);
    border: 1px solid #f9a8d4;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-color);
}

/* Time & Date inputs — đồng bộ màu với theme, icon dễ thấy */
input[type="time"],
input[type="date"] {
    color-scheme: light;
    accent-color: var(--accent-color);
}

body.dark-theme input[type="time"],
body.dark-theme input[type="date"] {
    color-scheme: dark;
    accent-color: var(--accent-color);
}

/* Icon đồng hồ / lịch nằm bên trong input */
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
    filter: invert(30%) sepia(80%) saturate(600%) hue-rotate(190deg) brightness(95%);
    opacity: 0.85;
    transition: opacity 0.2s, filter 0.2s;
}

input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    filter: invert(30%) sepia(80%) saturate(800%) hue-rotate(190deg) brightness(110%);
}

body.dark-theme input[type="time"]::-webkit-calendar-picker-indicator,
body.dark-theme input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(60%) sepia(70%) saturate(400%) hue-rotate(190deg) brightness(130%);
    opacity: 0.9;
}

body.dark-theme input[type="time"]::-webkit-calendar-picker-indicator:hover,
body.dark-theme input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    filter: invert(65%) sepia(80%) saturate(500%) hue-rotate(190deg) brightness(150%);
}


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

.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

.styled-table th, .styled-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.styled-table th {
    background-color: var(--accent-light);
    color: var(--accent-color);
    font-weight: 600;
}

body.dark-theme .styled-table th {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.text-center {
    text-align: center;
}

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

.text-excel {
    color: #107c41;
}

.mt-15 { margin-top: 15px; }
.mt-25 { margin-top: 25px; }
.ml-10 { margin-left: 10px; }

/* 3. TEACHER DASHBOARD STYLING */
#teacher-section {
    min-height: 100vh;
    background-color: var(--bg-primary);
}

.teacher-dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.teacher-sidebar {
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 25px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.teacher-brand {
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.teacher-brand i {
    font-size: 1.8rem;
    color: var(--accent-color);
}

.teacher-brand h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
}

.teacher-brand span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.teacher-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.teacher-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 4px solid transparent;
    transition: var(--transition);
}

.teacher-tab-btn:hover {
    background-color: var(--bg-primary);
    color: var(--accent-color);
}

.teacher-tab-btn.active {
    background-color: var(--accent-light);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

body.dark-theme .teacher-tab-btn.active {
    background-color: rgba(59, 130, 246, 0.15);
}

.teacher-sidebar-footer {
    padding: 0 20px;
}

.teacher-content {
    padding: 30px;
    overflow-y: auto;
    max-height: 100vh;
}

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

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

.content-header {
    margin-bottom: 25px;
}

.content-header h1 {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.content-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.teacher-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.form-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.flex-align {
    display: flex;
    align-items: center;
}

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

.max-height-table {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.max-height-table .styled-table {
    margin-top: 0;
}

.max-height-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-card) !important; /* Fix sticky header transparent scroll bleed */
}

/* Badge tags */
.badge-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-approved {
    background-color: #d1e7dd;
    color: #0f5132;
}

/* Drop Zone Styles */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius-lg);
    padding: 35px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(248, 250, 252, 0.5);
    transition: var(--transition);
    margin-top: 15px;
}

body.dark-theme .drop-zone {
    background: rgba(30, 41, 59, 0.2);
    border-color: #475569;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}

.upload-icon {
    font-size: 2.8rem;
    color: var(--accent-color);
    margin-bottom: 12px;
}

.drop-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.or-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.btn-excel-upload {
    display: inline-block;
    background: #107c41;
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
}

.btn-excel-upload:hover {
    background: #0d6233;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border: 1px solid var(--correct-border);
    background-color: var(--correct-bg);
    color: var(--correct-text);
    border-radius: var(--border-radius);
    margin-top: 15px;
}

.file-icon {
    font-size: 1.8rem;
    color: #107c41;
}

.file-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.file-size {
    font-size: 0.75rem;
    opacity: 0.8;
}

.template-download-box {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 4. QUIZ SCREEN (MOODLE LMS VISUALS) */
.lms-navbar {
    background-color: #e9ecef;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    font-size: 0.85rem;
    transition: var(--transition);
}

body.dark-theme .lms-navbar {
    background-color: #1e293b;
}

.lms-container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.breadcrumb-trail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.breadcrumb-link {
    color: #0f6cb5;
    text-decoration: none;
    font-weight: 500;
}

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

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb-active {
    color: var(--text-primary);
    font-weight: 500;
}

.main-quiz-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    padding-top: 30px;
    padding-bottom: 60px;
}

.quiz-content-area {
    display: flex;
    flex-direction: column;
}

.quiz-main-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.check-icon-wrapper {
    width: 50px;
    height: 50px;
    background-color: var(--accent-pink);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 10px rgba(217, 37, 98, 0.2);
}

.quiz-main-header h1 {
    font-size: 1.8rem;
    color: #1f2937;
    font-weight: 600;
}

body.dark-theme .quiz-main-header h1 {
    color: #f8fafc;
}

.quiz-summary-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

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

.summary-table tr {
    border-bottom: 1px solid var(--border-color);
}

.summary-table tr:last-child {
    border-bottom: none;
}

.summary-table td {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.summary-label {
    font-weight: 700;
    width: 25%;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.02);
}

body.dark-theme .summary-label {
    background-color: rgba(255, 255, 255, 0.02);
}

.summary-value {
    color: var(--text-primary);
}

.highlight-status {
    font-weight: 600;
}

.highlight-grade {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent-color);
}

/* Question panel block */
.moodle-question-block {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.q-info-panel {
    background: #f8f9fa;
    border-right: 1px solid var(--border-color);
    padding: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.dark-theme .q-info-panel {
    background: #1e293b;
}

.q-number {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.q-status {
    font-size: 0.8rem;
    opacity: 0.9;
}

.q-points {
    font-size: 0.8rem;
    font-weight: 500;
}

.q-flag-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    width: fit-content;
    transition: var(--transition);
}

.q-flag-btn:hover {
    color: #e0245e;
}

.q-flag-btn.flagged {
    color: #e0245e;
    font-weight: 600;
}

.q-body-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.q-text-container {
    background-color: var(--question-bg);
    border: 1px solid var(--question-border);
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.q-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.q-option-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
}

.q-option-label:hover {
    background-color: var(--accent-light);
    border-color: var(--accent-color);
}

body.dark-theme .q-option-label:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.q-option-label.selected {
    background-color: var(--accent-light);
    border-color: var(--accent-color);
    font-weight: 500;
}

body.dark-theme .q-option-label.selected {
    background-color: rgba(59, 130, 246, 0.15);
}

.q-option-label input[type="radio"] {
    margin-top: 4px;
    transform: scale(1.1);
    accent-color: var(--accent-color);
}

.option-prefix {
    font-weight: 700;
    color: var(--text-secondary);
}

.q-option-label.option-correct {
    background-color: var(--correct-bg) !important;
    border-color: var(--correct-border) !important;
    color: var(--correct-text) !important;
}

.q-option-label.option-incorrect {
    background-color: var(--incorrect-bg) !important;
    border-color: var(--incorrect-border) !important;
    color: var(--incorrect-text) !important;
}

.option-status-icon {
    margin-left: auto;
    font-size: 1.1rem;
}

.option-status-icon.fa-check-circle {
    color: var(--correct-text);
}

.option-status-icon.fa-times-circle {
    color: var(--incorrect-text);
}

.feedback-container {
    background-color: var(--feedback-bg);
    border: 1px solid var(--feedback-border);
    color: var(--feedback-text);
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 8px;
}

.feedback-container strong {
    font-weight: 700;
}

.feedback-explanation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(133, 100, 4, 0.25);
    font-size: 0.85rem;
    opacity: 0.95;
}

/* Sidebar Quiz Nav Widgets */
.quiz-nav-sidebar {
    position: relative;
}

.sticky-sidebar-container {
    position: sticky;
    top: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.timer-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    border-top: 4px solid var(--accent-pink);
}

.timer-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.timer-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 5px;
}

.timer-widget.timer-warning {
    border-top-color: #dc3545;
    animation: pulse 1s infinite alternate;
}

.timer-widget.timer-warning .timer-value {
    color: #dc3545;
}

@keyframes pulse {
    from { box-shadow: 0 0 5px rgba(220, 53, 69, 0.2); }
    to { box-shadow: 0 0 15px rgba(220, 53, 69, 0.5); }
}

.nav-widget {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.nav-widget h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.student-info-sidebar {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 15px;
}

.nav-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-card);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    text-decoration: none;
    transition: var(--transition);
}

.nav-btn:hover {
    border-color: var(--accent-color);
    background-color: var(--accent-light);
}

.nav-btn.nav-attempted {
    background: linear-gradient(to bottom, var(--bg-card) 50%, #6b7280 50%);
}

body.dark-theme .nav-btn.nav-attempted {
    background: linear-gradient(to bottom, var(--bg-card) 50%, #4b5563 50%);
}

.nav-btn.nav-flagged::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 5px;
    height: 5px;
    background-color: #dc3545;
    border-radius: 50%;
}

.nav-btn.nav-active {
    border: 2px solid var(--accent-color);
}

.nav-btn.nav-correct {
    background-color: var(--correct-bg) !important;
    border-color: var(--correct-border) !important;
    color: var(--correct-text) !important;
}

.nav-btn.nav-incorrect {
    background-color: var(--incorrect-bg) !important;
    border-color: var(--incorrect-border) !important;
    color: var(--incorrect-text) !important;
}

.nav-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    display: inline-block;
}

.legend-not-attempted {
    background-color: var(--bg-card);
    border-color: var(--text-muted);
}

.legend-attempted {
    background: linear-gradient(to bottom, var(--bg-card) 50%, #6b7280 50%);
}

.legend-flagged {
    border: none;
    color: #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.submit-shortcut-box {
    margin-top: 15px;
    font-size: 0.8rem;
}

.submit-shortcut-link {
    color: #0f6cb5;
    text-decoration: none;
}

.submit-shortcut-link:hover {
    text-decoration: underline;
}

.quiz-footer-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 5. MODAL GRADING STYLING */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.grading-form-card {
    background-color: var(--bg-primary);
    border-left: 5px solid var(--accent-pink);
    margin-bottom: 25px;
}

/* CONFETTI CANVAS */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

/* RESPONSIVE DESIGN */
@media (max-width: 992px) {
    .teacher-dashboard-layout {
        grid-template-columns: 1fr;
    }
    
    .teacher-sidebar {
        padding: 15px;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .teacher-brand {
        margin-bottom: 0;
        padding: 0;
    }
    
    .teacher-nav {
        flex-direction: row;
        width: 100%;
        order: 3;
    }
    
    .teacher-tab-btn {
        padding: 10px 15px;
        border-left: none;
        border-bottom: 3px solid transparent;
        font-size: 0.85rem;
    }
    
    .teacher-tab-btn.active {
        border-bottom-color: var(--accent-color);
    }
    
    .teacher-sidebar-footer {
        padding: 0;
    }
    
    .teacher-content {
        max-height: none;
    }
    
    .teacher-grid-two {
        grid-template-columns: 1fr;
    }

    .main-quiz-layout {
        grid-template-columns: 1fr;
    }
    
    .quiz-nav-sidebar {
        order: -1;
    }
    
    .sticky-sidebar-container {
        position: static;
        flex-direction: row;
        width: 100%;
    }
    
    .timer-widget {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .nav-widget {
        flex: 2;
    }
    
    .question-nav-grid {
        grid-template-columns: repeat(10, 1fr);
    }
    
    .student-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .moodle-question-block {
        grid-template-columns: 1fr;
    }
    
    .q-info-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 20px;
    }
    
    .q-flag-btn {
        padding: 0;
    }
    
    .sticky-sidebar-container {
        flex-direction: column;
    }
    
    .question-nav-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .summary-label {
        width: 40%;
    }

    .form-grid-two {
        grid-template-columns: 1fr;
    }
}

/* WEEKLY CALENDAR & SCHEDULE STYLES */
.calendar-weekly-grid {
    user-select: none;
}
.calendar-day-col {
    transition: var(--transition);
}
.calendar-day-col:hover {
    background-color: rgba(255,255,255,0.04) !important;
    border-color: var(--accent-color) !important;
}
.schedule-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 6px;
    padding: 10px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}
.schedule-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}
.schedule-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.schedule-card-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.schedule-card-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.schedule-card-meta strong {
    color: var(--text-primary);
}
.no-schedules-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}

/* Student Schedule Read-Only Styles */
#student-calendar-grid .schedule-card {
    cursor: default !important;
}
#student-calendar-grid .schedule-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm) !important;
    border-color: var(--border-color) !important;
}
