/*========================================
   1. المتغيرات (الوضع الفاتح والداكن)
======================================== */

:root {
    --main-color: #7C3AED;
    --main-dark: #5B21B6;
    --light-color: #EDE9FE;
    --ink: #1F1637;
    --text-gray: #6B6785;
    --line: #ECE6FB;
    --bg: #F7F5FC;
    --surface: #FFFFFF;
    --footer-bg: #3B0764;
    --footer-text: #DDD6FE;

    --gradient: linear-gradient(135deg, #7C3AED, #5B21B6);
    --shadow: 0 2px 10px rgba(91, 33, 182, 0.05);
    --shadow-hover: 0 14px 30px rgba(91, 33, 182, 0.14);
}

[data-bs-theme="dark"] {
    --main-color: #A78BFA;
    --main-dark: #C4B5FD;
    --light-color: #2B2150;
    --ink: #EDE9FE;
    --text-gray: #B3A9D6;
    --line: #2F2557;
    --bg: #130B26;
    --surface: #1C1338;
    --footer-bg: #10071F;
    color-scheme: dark;
}


/* ========================================
   2. التنسيق العام
======================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--ink);
    font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

button,
input {
    font-family: inherit;
}

h2 {
    color: var(--ink);
    font-weight: 800;
}

p {
    line-height: 1.7;
}

.page {
    display: none;
    min-height: 70vh;
}

.page.active {
    display: block;
}

/* شبكة عامة: عمود في الموبايل، عمودين في التابلت، 3 في الشاشات الكبيرة */
.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 576px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}


/* ========================================
   3. الكروت (شكل مشترك)
======================================== */

.course-card,
.chart-card,
.teacher-card,
.teacher-course-card,
.todo,
.flip-timer {
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.course-card:hover,
.teacher-card:hover,
.teacher-course-card:hover {
    transform: translateY(-6px);
    border-color: var(--main-color);
    box-shadow: var(--shadow-hover);
}


/* ========================================
   4. النافبار
======================================== */

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 20px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(91, 33, 182, 0.07);
}

.page-title {
    color: var(--main-dark);
    font-size: 23px;
    font-weight: 800;
}

.nav-button,
.profile {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: background-color 0.3s, filter 0.3s;
}

.nav-button {
    background: transparent;
    color: var(--main-dark);
}

.nav-button:hover {
    background-color: var(--light-color);
}

.profile {
    background-image: linear-gradient(135deg, #8B5CF6, #5B21B6);
    color: white;
}

.profile:hover {
    filter: brightness(1.12);
}


/* ========================================
   5. القائمة الجانبية
======================================== */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    width: 260px;
    height: 100vh;
    padding: 24px 16px;
    overflow-y: auto;
    background-color: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: -8px 0 30px rgba(91, 33, 182, 0.08);
    transform: translateX(110%);
    transition: transform 0.3s ease;
}

.sidebar.show {
    transform: none;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 35px;
    padding: 0 8px;
    color: var(--main-dark);
    font-size: 21px;
    font-weight: 800;
}

.sidebar-brand svg {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-inline-start: auto;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-gray);
    font-size: 18px;
    cursor: pointer;
}

.sidebar-close:hover {
    background: var(--light-color);
}

.sidebar-title {
    margin: 0 8px 14px;
    color: var(--text-gray);
    font-size: 13px;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 8px;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-gray);
    font-size: 15px;
    text-align: right;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.menu-btn i {
    font-size: 20px;
}

.menu-btn:hover {
    background: var(--light-color);
    color: var(--main-dark);
}

.menu-btn.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 6px 15px rgba(124, 58, 237, 0.2);
}

@media (max-width: 991px) {
    .sidebar-close { display: flex; }
}


/* ========================================
   6. الصفحة الرئيسية
======================================== */

.welcome-box {
    position: relative;
    overflow: hidden;
    min-height: 174px;
    padding: 25px;
    background: linear-gradient(115deg, #A78BFA 0%, #7C3AED 50%, #3B0764 100%);
    border-radius: 18px;
    color: white;
}

.welcome-box::before {
    content: "";
    position: absolute;
    top: -45px;
    left: -45px;
    width: 400px;
    height: 240px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.welcome-box h2 {
    position: relative;
    margin-bottom: 5px;
    color: white;
    font-size: 27px;
}

.welcome-description {
    position: relative;
    margin-bottom: 16px;
    font-size: 13px;
}

.welcome-message {
    position: relative;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    font-size: 12px;
}

.welcome-message p {
    margin: 0;
}

/* كروت الملخص */

.course-card {
    position: relative;
    cursor: pointer;
    --c: #6D28D9;
    --t: #EDE9FE;
    height: 100%;
    padding: 25px;
}

.course-card.pink { --c: #A21CAF; --t: #FAE8FF; }
.course-card.indigo { --c: #4338CA; --t: #E0E7FF; }

.student-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 24px;
    height: 100%;
}

.student-summary-grid .course-card {
    min-width: 0;
    min-height: 100%;
}

@media (max-width: 991px) {
    .student-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .student-summary-grid .course-card:last-child {
        grid-column: 1 / -1;
        width: calc(50% - 12px);
        justify-self: center;
    }
}

@media (max-width: 575px) {
    .student-summary-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .student-summary-grid .course-card:last-child {
        grid-column: auto;
        width: auto;
        justify-self: stretch;
    }
}

[data-bs-theme="dark"] .course-card { --c: #C4B5FD; --t: #2B2150; }
[data-bs-theme="dark"] .course-card.pink { --c: #E879F9; --t: #3A1A4A; }
[data-bs-theme="dark"] .course-card.indigo { --c: #A5B4FC; --t: #1E2358; }

.course-card:hover {
    border-color: var(--c);
}

.card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    border-radius: 14px;
    background-color: var(--t);
    color: var(--c);
    font-size: 22px;
    transition: background-color 0.3s, color 0.3s;
}

.course-card:hover .card-icon {
    background-color: var(--c);
    color: white;
}

[data-bs-theme="dark"] .course-card:hover .card-icon {
    color: var(--surface);
}

.course-card h3 {
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 800;
}

.course-card p {
    margin: 0;
    color: var(--text-gray);
}

/* الرسم البياني */

.chart-card {
    padding: 25px;
}

.chart-card h3 {
    margin-bottom: 4px;
    font-size: 20px;
    font-weight: 800;
}

.chart-card .sub {
    margin-bottom: 18px;
    color: var(--text-gray);
}

.chart-box {
    position: relative;
    height: 260px;
}

/* كروت المدرسين */

.teachers {
    margin: 8px auto 48px;
}

.teacher-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.teacher-card img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    object-position: center 20%;
    background-color: var(--light-color);
}

.teacher-card .teacher-avatar {
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
    margin: 24px auto 4px;
    object-fit: contain;
    object-position: center;
    background: #fff;
    border: 3px solid var(--light-color);
    border-radius: 50%;
}

.teacher-card .teacher-subject {
    margin: 0 22px 10px;
    color: var(--main-color);
    font-weight: 700;
}

.teacher-card h3 {
    margin: 20px 22px 6px;
    font-size: 20px;
    font-weight: 800;
}

.teacher-card p {
    margin: 0 22px 18px;
    color: var(--text-gray);
}

.teacher-card button {
    height: 46px;
    margin: auto 22px 22px;
    border: none;
    border-radius: 12px;
    background-image: linear-gradient(100deg, #7C3AED, #5B21B6);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: box-shadow 0.2s, filter 0.2s;
}

.teacher-card button:hover {
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.35);
    filter: brightness(1.06);
}


/* ========================================
   7. صفحات الكورسات
======================================== */

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--main-dark);
    cursor: pointer;
    transition: background-color 0.2s;
}

.back-home:hover {
    background: var(--light-color);
}

.teacher-heading {
    margin: 25px 0;
}

.teacher-heading h2 {
    color: var(--main-dark);
    font-size: 25px;
}

.teacher-heading p {
    margin-top: 10px;
    color: var(--text-gray);
}

.pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 26px;
}

.pills button {
    padding: 8px 20px;
    border: 1px solid var(--line);
    border-radius: 50px;
    background: var(--surface);
    color: var(--text-gray);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.pills button:hover {
    background: var(--light-color);
    color: var(--main-dark);
}

.pills button.active {
    border-color: transparent;
    background: var(--gradient);
    color: white;
}

.teacher-course-card {
    height: 100%;
    padding: 24px;
    text-align: center;
}

.course-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--light-color);
}

.course-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.teacher-course-card h3 {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.7;
}

.teacher-course-card p {
    min-height: 48px;
    margin: 12px 0 20px;
    color: var(--text-gray);
    line-height: 1.8;
}

.open-course {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--gradient);
    color: white;
    cursor: pointer;
    transition: filter 0.2s;
}

.open-course:hover {
    filter: brightness(1.1);
}

.open-course:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: none;
}

.enrollment-card .open-course {
    margin-top: 16px;
}


/* ========================================
   8. صفحة المهام (التودو + المؤقت)
======================================== */

.tools {
    display: grid;
    gap: 24px;
}

.todo,
.flip-timer {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 25px;
}

/* التودو لست */

.input-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

#taskInput {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 16px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background-color: var(--bg);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

#taskInput::placeholder {
    color: var(--text-gray);
}

#taskInput:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.15);
    background-color: var(--surface);
}

#addBtn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 12px;
    background-image: var(--gradient);
    color: white;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: box-shadow 0.2s, filter 0.2s;
}

#addBtn:hover {
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.35);
    filter: brightness(1.06);
}

#taskList {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.task {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background-color: var(--surface);
    transition: border-color 0.2s, background-color 0.2s;
}

.task:hover {
    border-color: var(--main-color);
}

.task input {
    width: 20px;
    height: 20px;
    accent-color: var(--main-color);
    cursor: pointer;
}

.task span {
    flex: 1;
    overflow-wrap: anywhere;
}

.task .delete {
    color: var(--text-gray);
    cursor: pointer;
    transition: color 0.2s;
}

.task .delete:hover {
    color: #DC2626;
}

.task.completed {
    background-color: var(--bg);
}

.task.completed span {
    color: var(--text-gray);
    text-decoration: line-through;
}

/* المؤقت */

.flip-timer {
    text-align: center;
}

.flip-modes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.flip-modes button {
    padding: 7px 18px;
    border: 1px solid var(--line);
    border-radius: 50px;
    background: var(--surface);
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.flip-modes button:hover {
    background: var(--light-color);
    color: var(--main-dark);
}

.flip-modes button.active {
    border-color: transparent;
    background: var(--gradient);
    color: white;
}

.flip-row {
    --w: clamp(72px, 24vw, 130px);
    direction: ltr;
    display: flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 20px);
}

.flip {
    position: relative;
    width: var(--w);
    aspect-ratio: 3 / 4;
    perspective: 500px;
    font-size: calc(var(--w) * 0.7);
}

.flip::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    z-index: 5;
    height: 3px;
    margin-top: -1.5px;
    background: rgba(0, 0, 0, 0.35);
}

.half,
.face {
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
}

.half {
    height: 50%;
}

.half.top,
.face.front {
    top: 0;
    border-radius: 14px 14px 0 0;
    background-image: linear-gradient(#6D2FE0, #5B21B6);
}

.half.bottom,
.face.back {
    border-radius: 0 0 14px 14px;
    background-image: linear-gradient(#4C1D95, #3B0764);
}

.half.bottom {
    bottom: 0;
}

.digit {
    position: absolute;
    left: 0;
    right: 0;
    display: grid;
    place-items: center;
    height: 200%;
    color: white;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.half.top .digit,
.face.front .digit {
    top: 0;
}

.half.bottom .digit,
.face.back .digit {
    bottom: 0;
}

.leaf {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3;
    height: 50%;
    transform-origin: 50% 100%;
    transform-style: preserve-3d;
}

.face {
    top: 0;
    height: 100%;
    backface-visibility: hidden;
}

.face.back {
    transform: rotateX(180deg);
}

.flip.flipping .leaf {
    animation: flip-down 0.55s ease-in forwards;
}

@keyframes flip-down {
    to { transform: rotateX(-180deg); }
}

.flip-label {
    margin-top: 22px;
    color: var(--text-gray);
}

.flip-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.flip-btn {
    min-width: 120px;
    height: 46px;
    padding: 0 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--main-dark);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.flip-btn:hover {
    background: var(--light-color);
}

.flip-btn.primary {
    border-color: transparent;
    background-image: linear-gradient(100deg, #7C3AED, #5B21B6);
    color: white;
}

.flip-btn.primary:hover {
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.35);
}


/* ========================================
   8.5 صفحة حسابي
======================================== */

.big-card {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(115deg, #A78BFA 0%, #7C3AED 50%, #3B0764 100%);
    border-radius: 24px;
    box-shadow: var(--shadow-hover);
}

.small-card {
    width: 100%;
    max-width: 340px;
    padding: 28px 24px;
    text-align: center;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(59, 7, 100, 0.25);
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background-image: linear-gradient(135deg, #8B5CF6, #5B21B6);
    color: white;
    font-size: 44px;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

.small-card h2 {
    margin-bottom: 6px;
    font-size: 22px;
}

.small-card h3 {
    margin: 0;
    color: var(--text-gray);
    font-size: 16px;
    font-weight: 600;
    unicode-bidi: plaintext;
}


/* بادج وإحصائيات الحساب */

.account-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 4px 14px;
    border-radius: 50px;
    background-color: var(--light-color);
    color: var(--main-dark);
    font-size: 13px;
    font-weight: 700;
}

.account-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.account-stats .stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 4px;
}

.account-stats .stat + .stat {
    border-inline-start: 1px solid var(--line);
}

.account-stats strong {
    color: var(--main-dark);
    font-size: 22px;
    font-weight: 800;
}

.account-stats span {
    color: var(--text-gray);
    font-size: 12px;
}


/* ========================================
   8.6 صفحة محتوى الكورس (الشكل الأصلي + دعم الداكن)
======================================== */

#lesson .section-header {
    background-color: var(--light-color);   /* #EDE9FE في الفاتح */
    color: var(--main-dark);                /* #5B21B6 في الفاتح */
    cursor: pointer;
}

#lesson .arrow-btn {
    background: none;
    border: none;
    font-size: 19px;
    color: var(--main-dark);
    cursor: pointer;
    transition: transform 0.3s;
}

#lesson .arrow-btn.active {
    transform: rotate(180deg);
}

#lesson .content {
    display: none;
    padding: 20px;
    margin-top: 10px;
    background-color: #F5F3FF;
    border-radius: 15px;
}

[data-bs-theme="dark"] #lesson .content {
    background-color: var(--surface);
    border: 1px solid var(--line);
}


/* ========================================
   8.7 الإشعارات (الجرس)
======================================== */

.notif-wrap {
    position: relative;
}

#notifBtn {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50px;
    background-color: #DC2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 900;
    width: 360px;
    max-width: calc(100vw - 24px);
    overflow: hidden;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-hover);
}

.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.notif-head strong {
    color: var(--ink);
    font-size: 16px;
    font-weight: 800;
}

.notif-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.notif-head button {
    border: none;
    background: none;
    color: var(--main-color);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.notif-head #notifDeleteRead {
    color: #B91C1C;
}

[data-bs-theme="dark"] .notif-head #notifDeleteRead {
    color: #FCA5A5;
}

.notif-head button:disabled {
    opacity: 0.5;
    cursor: default;
}

.notif-status {
    margin: 0;
    padding: 0 18px;
    color: var(--text-gray);
    font-size: 13px;
}

.notif-status:not(:empty) {
    padding-block: 10px;
    border-bottom: 1px solid var(--line);
}

.notif-status.success {
    color: #15803D;
}

.notif-status.error {
    color: #B91C1C;
}

.notification-confirm-dialog {
    width: min(440px, calc(100vw - 32px));
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-hover);
}

.notification-confirm-dialog::backdrop {
    background: rgba(31, 22, 55, 0.48);
}

.notification-confirm-dialog h2 {
    margin: 0 0 12px;
    color: var(--main-dark);
    font-size: 20px;
    font-weight: 800;
}

.notification-confirm-dialog p {
    margin: 0;
    color: var(--text-gray);
}

.notification-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.notification-confirm-actions button {
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--main-dark);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.notification-confirm-actions .notification-confirm-submit {
    border-color: transparent;
    background: var(--gradient);
    color: #fff;
}

.notification-confirm-actions button:focus-visible {
    outline: 3px solid var(--main-color);
    outline-offset: 2px;
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: block;
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-bottom: 1px solid var(--line);
    background-color: transparent;
    color: var(--ink);
    text-align: right;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background-color: var(--bg);
}

.notif-item.unread {
    background-color: var(--light-color);
}

.notif-item strong {
    display: block;
    margin-bottom: 2px;
    font-size: 15px;
}

.notif-item.unread strong::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-inline-end: 8px;
    border-radius: 50%;
    background-color: var(--main-color);
}

.notif-item p {
    margin: 0 0 4px;
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.6;
}

.notif-item p:empty {
    display: none;
}

.notif-item small {
    color: var(--text-gray);
    font-size: 12px;
}

.notif-empty {
    margin: 0;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-gray);
}

@media (max-width: 576px) {
    .notif-wrap {
        position: static;
    }

    .notif-panel {
        position: fixed;
        top: 84px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}


/* ========================================
   8.8 محتوى الكورس: التقدم، الدروس، الملفات، الاختبارات
======================================== */

.course-progress {
    margin-bottom: 20px;
}

.progress-line {
    height: 10px;
    overflow: hidden;
    border-radius: 50px;
    background-color: var(--light-color);
}

.progress-line span {
    display: block;
    height: 100%;
    border-radius: 50px;
    background: var(--gradient);
    transition: width 0.4s;
}

.course-progress small,
.report-card small {
    display: block;
    margin-top: 6px;
    color: var(--text-gray);
}

.lesson-note {
    margin: 0;
    padding: 8px 0;
    color: var(--text-gray);
}

.lesson-note.error {
    color: #DC2626;
}

.chapter + .chapter,
.file-group + .file-group {
    margin-top: 18px;
}

.chapter-title {
    margin: 0 0 10px;
    color: var(--main-dark);
    font-size: 17px;
    font-weight: 800;
}

.lesson-item,
.file-row,
.quiz-item {
    margin-bottom: 8px;
    padding: 10px 14px;
    background-color: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.lesson-row,
.file-row,
.quiz-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.lesson-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 200px;
    border: none;
    background: none;
    color: var(--ink);
    font-weight: 700;
    text-align: right;
    cursor: pointer;
}

.lesson-toggle i {
    color: var(--main-color);
    font-size: 20px;
}

.lesson-done,
.file-btn {
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 50px;
    background: var(--surface);
    color: var(--main-dark);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lesson-done:hover:not(:disabled),
.file-btn:hover:not(:disabled) {
    background: var(--light-color);
}

.file-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.lesson-done.done {
    border-color: transparent;
    background: #DCFCE7;
    color: #166534;
    cursor: default;
}

[data-bs-theme="dark"] .lesson-done.done {
    background: #12351F;
    color: #86EFAC;
}

.lesson-body {
    margin-top: 12px;
}

.video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}

.video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-player-shell {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.video-player {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    color: #fff;
    isolation: isolate;
    outline: none;
}

.video-player:focus-visible {
    box-shadow: 0 0 0 3px var(--main-color);
}

.video-player__mount,
.video-player__mount iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-player__interaction {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: transparent;
    pointer-events: auto;
}

.video-player__loading,
.video-player__error {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    background: transparent;
    color: #fff;
    text-align: center;
    text-shadow: 0 1px 4px #000;
    pointer-events: none;
}

.video-player__loading[hidden],
.video-player-message[hidden],
.video-player__error[hidden] {
    display: none;
}

.video-player__loading .spinner-border {
    color: var(--main-color);
}

.video-player-message {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--light-color);
    color: var(--ink);
    font-size: 13px;
    text-align: start;
}

.video-player__error {
    inset: auto auto 12px 12px;
    z-index: 6;
    width: calc(100% - 96px);
    min-height: 48px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.88);
    flex-direction: column;
}

.video-player__controls {
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 8px;
    padding: 28px 12px 10px;
    background: transparent;
    direction: ltr;
    opacity: 1;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.video-player__controls::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88), transparent);
    content: "";
    pointer-events: none;
}

.video-player__controls > * {
    position: relative;
}

.video-player__controls button,
.video-player__controls input,
.video-player__controls select {
    pointer-events: auto;
}

.video-player.controls-hidden .video-player__controls {
    opacity: 0;
}

.video-player.controls-hidden {
    cursor: none;
}

.video-player.controls-hidden .video-player__controls * {
    pointer-events: none;
}

.video-player__seek,
.video-player__volume {
    margin: 0;
    accent-color: var(--main-color);
    cursor: pointer;
}

.video-player__seek {
    width: 100%;
    max-width: none;
    height: 18px;
    flex: 0 0 auto;
    align-self: stretch;
    appearance: none;
    background: transparent;
}

.video-player__seek::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--main-color) 0,
        var(--main-color) var(--video-progress, 0%),
        rgba(255, 255, 255, 0.42) var(--video-progress, 0%),
        rgba(255, 255, 255, 0.42) 100%
    );
}

.video-player__seek::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -4px;
    appearance: none;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--main-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.video-player__seek::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.42);
}

.video-player__seek::-moz-range-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--main-color);
}

.video-player__seek::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--main-color);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.video-player__transport-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    direction: ltr;
}

.video-player__control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: calc(100% - 78px);
    align-self: flex-start;
    direction: ltr;
    flex-wrap: wrap;
}

.video-player__time {
    flex: 0 0 auto;
}

.video-player__settings {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    min-width: 0;
    max-width: 100%;
    direction: rtl;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.video-player__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.video-player__button:hover:not(:disabled),
.video-player__button:focus-visible {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.16);
}

.video-player__button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.video-player__button i {
    font-size: 19px;
}

.video-player__button--primary {
    width: 48px;
    height: 48px;
    border-color: var(--main-color);
    border-radius: 50%;
    background: var(--main-color);
    color: var(--bg);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.video-player__button--primary i {
    font-size: 25px;
}

.video-player__button--primary:hover:not(:disabled),
.video-player__button--primary:focus-visible {
    border-color: var(--main-color);
    background: var(--main-dark);
    color: var(--bg);
}

.video-player__time {
    direction: ltr;
    white-space: nowrap;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.video-player__volume {
    width: 58px;
    height: 4px;
}

.video-player__speed {
    max-width: 64px;
    height: 29px;
    padding: 0 5px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 7px;
    background: rgba(20, 13, 36, 0.85);
    color: #fff;
    font: inherit;
    font-size: 11px;
}

.video-player__speed option {
    background: #1C1338;
    color: #fff;
}

.video-player.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: 0;
    background: #000;
}

.video-link {
    color: var(--main-color);
    font-weight: 700;
}

.lesson-desc {
    margin: 10px 0 0;
    color: var(--text-gray);
}

.file-row > i {
    color: #DC2626;
    font-size: 22px;
}

.file-name {
    flex: 1 1 140px;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.file-row small,
.quiz-item small {
    display: block;
    color: var(--text-gray);
}

.quiz-item__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.quiz-review-button {
    border-color: var(--main-color);
    color: var(--main-color);
}

.quiz-review {
    padding-inline-start: 24px;
    text-align: right;
}

.quiz-review__question {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.quiz-review__options {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.quiz-review__answer {
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 8px;
    overflow-wrap: anywhere;
}

.quiz-review__answer.is-correct {
    color: #15803D;
    background: rgba(34, 197, 94, .12);
}

.quiz-review__answer.is-wrong {
    color: #B91C1C;
    background: rgba(239, 68, 68, .12);
}

.quiz-review__answer.is-pending {
    color: var(--text-gray);
}

.quiz-q {
    margin: 0 0 16px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.quiz-q legend {
    float: none;
    width: auto;
    margin-bottom: 10px;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
}

.quiz-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.quiz-choice:hover {
    background: var(--light-color);
}

.quiz-choice input {
    width: 18px;
    height: 18px;
    accent-color: var(--main-color);
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.quiz-actions .open-course {
    width: auto;
    padding: 10px 24px;
}

.quiz-result {
    padding: 20px 10px;
    text-align: center;
}

.quiz-result i {
    color: #F59E0B;
    font-size: 40px;
}

.inline-msg,
.form-msg {
    margin: 8px 0 0;
    font-size: 14px;
}

.inline-msg:empty,
.form-msg:empty {
    display: none;
}

.inline-msg.error,
.form-msg.error {
    color: #DC2626;
}

@media (max-width: 576px) {
    #lesson .content {
        min-width: 0;
        padding: 12px;
    }

    #lesson .lesson-item {
        min-width: 0;
        padding: 10px 8px;
    }

    .video-player {
        border-radius: 10px;
    }

    .video-player__controls {
        padding: 24px 8px 8px;
        gap: 6px;
    }

    .video-player__control-row {
        width: 100%;
        gap: 6px;
    }

    .video-player__transport-buttons {
        gap: 3px;
    }

    .video-player__settings {
        gap: 2px;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .video-player__volume {
        width: 42px;
    }

    .video-player__button {
        min-width: 36px;
        min-height: 40px;
        padding: 0 6px;
    }

    .video-player__button--primary {
        width: 42px;
        min-width: 42px;
        height: 42px;
    }
}

@media (max-width: 420px) {
    .video-player__controls {
        padding: 20px 7px 7px;
        gap: 3px;
    }

    .video-player__volume {
        display: none;
    }

    .video-player__time {
        font-size: 10px;
    }

    .video-player__button {
        min-width: 32px;
        min-height: 34px;
        padding: 0 4px;
    }

    .video-player__button--primary {
        width: 38px;
        min-width: 38px;
        height: 38px;
    }

    .video-player__speed {
        max-width: 52px;
        font-size: 10px;
    }
}

.inline-msg.success,
.form-msg.success {
    color: #16A34A;
}


/* ========================================
   8.9 صفحة التقارير + فورم الحساب
======================================== */

.report-title {
    margin: 28px 0 12px;
    font-size: 19px;
    font-weight: 800;
}

.report-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .report-grid { grid-template-columns: repeat(2, 1fr); }
}

.report-card {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.report-card h3 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 800;
}

.report-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.report-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 14px;
}

.report-table th,
.report-table td {
    padding: 12px 14px;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

.report-table th {
    background: var(--light-color);
    color: var(--main-dark);
    font-weight: 800;
}

.report-table tr:last-child td {
    border-bottom: none;
}

.account-forms {
    display: grid;
    gap: 20px;
    width: 100%;
    max-width: 560px;
    margin: 24px auto 0;
}

.account-form {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.account-form h3 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 800;
}

.account-form .hint {
    margin: 0;
    color: var(--text-gray);
    font-size: 14px;
}

.account-form input,
.account-form select {
    display: block;
    width: 100%;
    height: 46px;
    margin-top: 10px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background-color: var(--bg);
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.account-form input::placeholder {
    color: var(--text-gray);
}

.account-form input:focus,
.account-form select:focus {
    border-color: var(--main-color);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.15);
}

.account-form .open-course {
    margin-top: 14px;
}


/* عدّاد كروت الرئيسية + حفظ الفيديو + المكتبة */

.card-count {
    position: absolute;
    top: 18px;
    left: 18px;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 50px;
    background-color: var(--t);
    color: var(--c);
    font-size: 16px;
    font-weight: 800;
    line-height: 34px;
    text-align: center;
}

.lesson-save {
    border: none;
    background: none;
    color: var(--text-gray);
    font-size: 19px;
    cursor: pointer;
    transition: color 0.2s;
}

.lesson-save:hover,
.lesson-save.saved {
    color: var(--main-color);
}

.report-card .open-course {
    margin-top: 14px;
}

.saved-meta {
    flex: 1 1 200px;
}

.saved-meta strong,
.saved-meta small {
    display: block;
}

.saved-meta small {
    color: var(--text-gray);
}

.saved-actions {
    display: flex;
    gap: 8px;
}

.saved-actions .open-course {
    width: auto;
    padding: 6px 16px;
    font-size: 13px;
}


/* ========================================
   9. الفوتر
======================================== */

.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
    padding-block: 56px 40px;
}

@media (min-width: 760px) {
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr;
        gap: 48px;
    }
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.1;
}

.footer-brand svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.footer-about {
    max-width: 26em;
    margin: 16px 0 0;
    font-size: 15px;
}

.footer h4 {
    margin-bottom: 14px;
    color: white;
    font-size: 16px;
    font-weight: 800;
}

.footer ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer li a {
    color: inherit;
    font-size: 15px;
    text-decoration: none;
    transition: color 0.2s;
}

.footer li a:hover {
    color: white;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.footer-social {
    display: flex;
    gap: 10px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: rgba(221, 214, 254, 0.12);
    color: white;
    font-size: 19px;
    transition: background-color 0.3s, transform 0.3s;
}

.footer-social a:hover {
    background-color: var(--main-color);
    transform: translateY(-3px);
}

.footer-bottom {
    padding-block: 20px;
    border-top: 1px solid rgba(221, 214, 254, 0.18);
    font-size: 14px;
    text-align: center;
}


/* ========================================
   10. الموبايل
======================================== */

@media (max-width: 576px) {
    nav {
        gap: 8px;
        padding: 10px 12px;
    }

    nav .d-flex {
        gap: 8px !important;
    }

    .nav-button,
    .profile {
        width: 38px;
        height: 38px;
        font-size: 19px;
    }

    .page-title { font-size: 19px; }
    h2 { font-size: 22px; }

    .welcome-box {
        min-height: 150px;
        padding: 18px;
    }

    .welcome-box h2 { font-size: 20px; }
    .welcome-description { font-size: 11px; }

    .welcome-message {
        padding: 10px;
        font-size: 10px;
    }

    .chart-card { padding: 18px; }
    .chart-box { height: 230px; }
    .teacher-card img { height: 240px; }
    .teacher-heading h2 { font-size: 21px; }
    .teacher-course-card { padding: 18px; }
    .footer-grid { padding-block: 36px 28px; }
}
/* ===== لوحة المتصدرين / الشهادات / إعادة تقديم الإيصال ===== */
.student-table{width:100%;border-collapse:collapse;min-width:420px}
.student-table th,.student-table td{padding:13px 15px;border-bottom:1px solid var(--line);text-align:right}
.student-table th{background:var(--light-color);color:var(--main-dark);font-weight:800}
.student-table tr.me td{background:var(--light-color);font-weight:800}
#leaderboardBox .table-wrap{overflow-x:auto;background:var(--surface);border:1px solid var(--line);border-radius:16px}
.certificate-card i{font-size:30px;color:var(--main-color)}
.certificate-card small{display:block;color:var(--text-gray);margin:4px 0}
.certificate-card .certificate-student{margin:4px 0;color:var(--ink);font-weight:700}
.certificate-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.certificate-actions .open-course{flex:1 1 130px;min-height:44px}
.resubmit-form{margin-top:14px;padding-top:14px;border-top:1px dashed var(--line)}
.resubmit-form label{display:block;font-size:13px;font-weight:700;margin-bottom:8px}
.resubmit-form input[type=file]{display:block;width:100%;margin-top:6px}
.payment-pending-note{margin:14px 0 0;padding:12px 14px;border:1px solid var(--line);border-radius:10px;color:var(--main-color);font-weight:700}
.inline-msg.info{color:var(--main-color)}
