:root {
    
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #14b8a6;
    --accent-color: #f59e0b;
    --background-color: #f6f8fc;
    --sidebar-color: #ffffff;
    --card-color: #ffffff;
    --text-color: #0f172a;
    --muted-color: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    background: var(--background-color);
    color: var(--text-color);
    font-family: "Segoe UI", Tahoma, sans-serif;
}
body[data-theme="dark"] {
    --primary-color: #60a5fa;
    --primary-dark: #3b82f6;
    --secondary-color: #2dd4bf;
    --accent-color: #fbbf24;
    --background-color: #0f172a;
    --sidebar-color: #111827;
    --card-color: #1e293b;
    --text-color: #f8fafc;
    --muted-color: #cbd5e1;
    --border-color: #334155;
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.35);
}

body[data-theme="purple"] {
    --primary-color: #7c3aed;
    --primary-dark: #6d28d9;
    --secondary-color: #a855f7;
    --accent-color: #f59e0b;
    --background-color: #faf5ff;
    --sidebar-color: #ffffff;
    --card-color: #ffffff;
    --text-color: #2e1065;
    --muted-color: #6b21a8;
    --border-color: #e9d5ff;
    --shadow-soft: 0 12px 32px rgba(88, 28, 135, 0.10);
}
/* =========================
   LAYOUT
========================= */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--sidebar-color);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    z-index: 1001;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.sidebar-brand {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-color);
}

.sidebar-close {
    display: none;
    background: transparent;
    border: 0;
    font-size: 30px;
    color: var(--text-color);
}

.sidebar-menu a {
    display: block;
    color: #334155;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 14px;
    margin-bottom: 7px;
    font-size: 15px;
    font-weight: 600;
    transition: 0.2s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 800;
}

.menu-toggle {
    display: none;
    border: 0;
    background: var(--primary-color);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 22px;
}

.content-area {
    padding: 32px;
}

.content-area h1 {
    font-size: 36px;
    font-weight: 850;
    letter-spacing: -0.7px;
    margin-bottom: 8px;
}

/* =========================
   CARDS
========================= */

.dashboard-card {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 26px;
    box-shadow: var(--shadow-soft);
}

.dashboard-card h4,
.dashboard-card h5 {
    font-weight: 800;
}

.dashboard-card h2 {
    font-size: 40px;
    font-weight: 850;
    margin: 8px 0;
}

.dashboard-card p {
    color: var(--muted-color);
}

/* =========================
   TABLE MODERN
========================= */

.table-responsive {
    border-radius: 18px;
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table thead th {
    border-bottom: 1px solid var(--border-color);
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
    padding: 16px 10px;
    white-space: nowrap;
}

.table tbody td {
    border-bottom: 1px solid var(--border-color);
    padding: 18px 10px;
    font-size: 15px;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table strong {
    font-weight: 800;
}

.table small {
    color: var(--muted-color);
}

/* =========================
   BUTTONS
========================= */

.btn {
    border-radius: 11px;
    font-weight: 600;
}

.btn-sm {
    padding: 7px 10px;
    font-size: 13px;
}

.btn-q-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    border: 0;
    border-radius: 13px;
    padding: 11px 18px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}

.btn-q-primary:hover {
    color: #fff;
    transform: translateY(-1px);
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-danger,
.btn-outline-secondary {
    background: #fff;
}

/* Better action buttons in tables */
.table td:last-child {
    white-space: nowrap;
}

.table td:last-child .btn {
    margin: 2px;
}

/* =========================
   BADGES
========================= */

.badge {
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 700;
}

.badge-role {
    background: #dbeafe;
    color: var(--primary-dark);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

/* =========================
   FORMS
========================= */

.form-control,
.form-select {
    border-radius: 13px;
    border: 1px solid #dbe2ea;
    padding: 12px 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* =========================
   EXERCISES PAGE IMPROVEMENT
========================= */

.exercise-title-cell {
    display: flex;
    align-items: center;
    gap: 14px;
}

.exercise-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: #dbeafe;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* =========================
   STATS
========================= */

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -25px;
    top: -25px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    opacity: 0.15;
}

.stat-blue::after { background: #2563eb; }
.stat-teal::after { background: #14b8a6; }
.stat-orange::after { background: #f59e0b; }
.stat-purple::after { background: #8b5cf6; }

/* =========================
   LESSON READER
========================= */

.lesson-reader {
    max-width: 950px;
    margin: 0 auto;
}

.lesson-header-card,
.lesson-content-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 28px;
    box-shadow: var(--shadow-soft);
}

.lesson-breadcrumb {
    color: var(--muted-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.lesson-header-card h1 {
    font-size: 38px;
    font-weight: 850;
}

.lesson-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.lesson-meta span {
    background: #e0f2fe;
    color: #0369a1;
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.lesson-content {
    font-size: 19px;
    line-height: 1.9;
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 30px;
}

.exercise-card-modern,
.quiz-card-modern {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 22px;
    height: 100%;
}

/* =========================
   ANSWER OPTIONS
========================= */

.answer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 10px;
    cursor: pointer;
}

.answer-option:hover {
    background: #eef6ff;
    border-color: var(--primary-color);
}

/* =========================
   LOGIN
========================= */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    padding: 34px;
    box-shadow: var(--shadow-soft);
}

.login-title {
    font-size: 34px;
    font-weight: 850;
}

.login-subtitle {
    color: var(--muted-color);
    margin-bottom: 28px;
}

/* =========================
   MOBILE
========================= */

.mobile-overlay {
    display: none;
}

@media (max-width: 768px) {
    .app-wrapper {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 285px;
        max-width: 86%;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 20px 0 40px rgba(15, 23, 42, 0.15);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .mobile-overlay.active {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1000;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 12px 14px;
        flex-wrap: wrap;
    }

    .topbar-left {
        width: 100%;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .content-area {
        padding: 18px;
    }

    .content-area h1 {
        font-size: 30px;
    }

    .dashboard-card {
        padding: 18px;
        border-radius: 18px;
    }

    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tbody tr {
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: 18px;
        padding: 14px;
        margin-bottom: 14px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    }

    .table tbody td {
        border: 0;
        padding: 8px 0;
    }

    .table td:last-child {
        white-space: normal;
    }

    .action-buttons {
        margin-top: 8px;
    }

    .action-buttons .btn,
    .table td:last-child .btn {
        width: 100%;
        margin: 4px 0;
    }

    .lesson-header-card,
    .lesson-content-card {
        padding: 20px;
        border-radius: 18px;
    }

    .lesson-header-card h1 {
        font-size: 30px;
    }

    .lesson-content {
        font-size: 17px;
    }

    .lesson-navigation {
        flex-direction: column;
    }

    .lesson-navigation .btn {
        width: 100%;
    }
}
body,
.sidebar,
.topbar,
.dashboard-card,
.lesson-header-card,
.lesson-content-card,
.table tbody tr,
.form-control,
.form-select {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

body[data-theme="dark"] .topbar,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .dashboard-card,
body[data-theme="dark"] .lesson-header-card,
body[data-theme="dark"] .lesson-content-card,
body[data-theme="dark"] .login-card {
    background: var(--card-color);
    color: var(--text-color);
}

body[data-theme="dark"] .table,
body[data-theme="dark"] .table tbody td,
body[data-theme="dark"] .table thead th {
    color: var(--text-color);
    border-color: var(--border-color);
}

body[data-theme="dark"] .table tbody tr:hover {
    background: #273449;
}

body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] .theme-switcher {
    background: #0f172a;
    color: var(--text-color);
    border-color: var(--border-color);
}

body[data-theme="dark"] .text-muted,
body[data-theme="dark"] small {
    color: var(--muted-color) !important;
}

.theme-switcher {
    width: auto;
    min-width: 110px;
    padding: 6px 10px;
}

.student-hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 28px;
    padding: 34px;
    box-shadow: var(--shadow-soft);
}

.student-hero h1 {
    color: white;
    font-size: 38px;
    margin-bottom: 10px;
}

.student-hero p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
}

.student-welcome {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
    margin-bottom: 8px !important;
}

.section-title {
    font-size: 26px;
    font-weight: 850;
    margin-bottom: 4px;
}

.student-subject-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.student-subject-card {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

.subject-card-icon {
    width: 58px;
    height: 58px;
    border-radius: 20px;
    background: #dbeafe;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 850;
}

.student-subject-card h3 {
    font-size: 22px;
    font-weight: 850;
    margin-bottom: 8px;
}

.student-subject-card p {
    color: var(--muted-color);
    min-height: 48px;
    margin-bottom: 14px;
}

.subject-card-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.subject-card-stats span {
    background: #f1f5f9;
    color: #334155;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 13px;
    font-weight: 700;
}

body[data-theme="dark"] .subject-card-stats span {
    background: #0f172a;
    color: var(--muted-color);
}

body[data-theme="purple"] .subject-card-icon {
    background: #ede9fe;
    color: var(--primary-dark);
}

@media (max-width: 1100px) {
    .student-subject-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .student-hero {
        padding: 24px;
        border-radius: 22px;
    }

    .student-hero h1 {
        font-size: 30px;
    }

    .student-subject-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .student-subject-card {
        border-radius: 22px;
        padding: 20px;
    }

    .section-title {
        font-size: 23px;
    }
}
.student-chapter-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.student-chapter-card {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 26px;
    box-shadow: var(--shadow-soft);
}

.chapter-order {
    display: inline-block;
    background: #dbeafe;
    color: var(--primary-dark);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.student-chapter-card h3 {
    font-weight: 850;
    margin-bottom: 8px;
}

.student-chapter-card p {
    color: var(--muted-color);
}

.student-lesson-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.student-lesson-item {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-color);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    transition: 0.2s ease;
}

.student-lesson-item:hover {
    background: #eef6ff;
    transform: translateY(-2px);
}

.lesson-dot {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 850;
    flex-shrink: 0;
}

.student-lesson-item strong {
    display: block;
    font-size: 16px;
}

.student-lesson-item span {
    color: var(--muted-color);
    font-size: 13px;
    font-weight: 600;
}

body[data-theme="dark"] .student-lesson-item {
    background: #0f172a;
}

body[data-theme="dark"] .student-lesson-item:hover {
    background: #1e293b;
}

@media (max-width: 700px) {
    .student-chapter-card {
        padding: 20px;
        border-radius: 22px;
    }

    .student-lesson-item {
        padding: 14px;
    }
}

.student-lesson-item.lesson-completed {
    border-color: #22c55e;
    background: #f0fdf4;
}

.student-lesson-item.lesson-completed .lesson-dot {
    background: #22c55e;
}

body[data-theme="dark"] .student-lesson-item.lesson-completed {
    background: #052e16;
    border-color: #16a34a;
}

.quiz-timer-box {
    position: sticky;
    top: 12px;
    z-index: 50;
    background: var(--card-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-left: 6px solid var(--accent-color);
    border-radius: 18px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#quizTimer {
    font-size: 24px;
    color: var(--primary-color);
}

#quizTimer.timer-danger {
    color: var(--danger-color);
    animation: timerPulse 1s infinite;
}

@keyframes timerPulse {
    0% { opacity: 1; }
    50% { opacity: 0.45; }
    100% { opacity: 1; }
}

@media (max-width: 700px) {
    .quiz-timer-box {
        top: 8px;
        padding: 14px 16px;
        font-size: 15px;
    }

    #quizTimer {
        font-size: 20px;
    }
}


.student-lesson-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.student-lesson-card {
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.student-lesson-card h3 {
    font-size: 22px;
    font-weight: 850;
    margin-bottom: 12px;
}

.student-lesson-card.lesson-completed {
    border-color: #22c55e;
}

@media (max-width: 1100px) {
    .student-lesson-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .student-lesson-grid {
        grid-template-columns: 1fr;
    }

    .student-lesson-card {
        padding: 20px;
        border-radius: 22px;
    }
}

.teacher-action-card {
    display: block;
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: 22px;
    padding: 22px;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: var(--shadow-soft);
    transition: 0.2s ease;
    height: 100%;
}

.teacher-action-card:hover {
    transform: translateY(-3px);
    color: var(--text-color);
}

.teacher-action-card strong {
    display: block;
    font-size: 18px;
    font-weight: 850;
    margin-bottom: 8px;
}

.teacher-action-card span {
    display: block;
    color: var(--muted-color);
    font-size: 14px;
}

.print-exam-page {
    background: #ffffff;
    color: #111827;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.print-header {
    text-align: center;
    margin-bottom: 20px;
}

.print-header h1 {
    font-size: 28px;
    font-weight: 900;
}

.teacher-copy-label {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 14px;
    border: 1px solid #111827;
    border-radius: 8px;
    font-weight: 800;
}

.print-question {
    page-break-inside: avoid;
    margin-bottom: 28px;
}

.print-question h3 {
    font-size: 20px;
    font-weight: 850;
}

.print-question h3 span {
    font-size: 14px;
    font-weight: 600;
}

.print-question-image {
    max-width: 100%;
    max-height: 250px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.correct-answer {
    color: #16a34a;
    font-weight: 800;
}

.answer-line {
    height: 35px;
    border-bottom: 1px solid #111827;
    margin-bottom: 8px;
}

@media print {
    body {
        background: white !important;
    }

    .sidebar,
    .topbar,
    .navbar,
    .no-print,
    header,
    nav {
        display: none !important;
    }

    .main-content,
    .content,
    .app-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .print-exam-page {
        padding: 0;
        max-width: 100%;
    }
}

.exam-paper-header{
    display:flex;
    align-items:center;
    gap:20px;
    margin-bottom:20px;
}

.school-logo{
    width:90px;
    height:auto;
}

.school-info{
    flex:1;
    text-align:center;
}

.school-info h1{
    margin:0;
    font-size:28px;
    font-weight:900;
}

.exam-info-table{
    width:100%;
    border-collapse:collapse;
    margin-bottom:25px;
}

.exam-info-table td{
    border:1px solid #000;
    padding:12px;
}

.main-header{
    background:#ffffff;
    border-bottom:1px solid #e5e7eb;
    padding:10px 20px;
}

.logo-container{
    display:flex;
    align-items:center;
    gap:12px;
}

.logo-container img{
    height:60px;
    width:auto;
}

.logo-text h1{
    margin:0;
    color:#1E3A8A;
    font-size:28px;
    font-weight:700;
}

.logo-text span{
    color:#10B981;
    font-size:13px;
}
@media(max-width:768px){

    .logo-container img{
        height:45px;
    }

    .logo-text h1{
        font-size:20px;
    }

    .logo-text span{
        display:none;
    }
}