/* =========================================================
   منصة الطالب — نظام تصميم موحد حديث (2026)
   خلفية بيضاء صافية • نصوص داكنة • أزرار نيون خضراء/حمراء
   ========================================================= */

/* ---------- خطوط ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800&display=swap');

/* ---------- إعادة تعيين ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    background: #ffffff;
    color: #1b2631;
    line-height: 1.8;
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================================
   الهيدر الثابت (زجاجي)
   ========================================================= */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    height: 72px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border-bottom: 1px solid rgba(15, 60, 35, 0.08);
    box-shadow: 0 6px 24px rgba(10, 40, 25, 0.06);
}

header .logo span {
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #0d4f2c !important;
    letter-spacing: -0.5px;
}
header .logo span::after {
    content: "";
    display: block;
    width: 34px; height: 3px;
    margin-top: 3px;
    border-radius: 4px;
    background: linear-gradient(90deg, #16a34a, #22c55e);
}

/* روابط النافج */
header nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
header nav a {
    position: relative;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 14px;
    border-radius: 10px;
    transition: color .25s ease, background .25s ease;
}
header nav a:hover {
    color: #0d4f2c;
    background: rgba(22,163,74,0.08);
}
header nav a::after {
    content: "";
    position: absolute;
    right: 14px; left: 14px; bottom: 5px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .25s ease;
}
header nav a:hover::after,
header nav a[style*="bold"]::after { transform: scaleX(1); }

/* أزرار المصادقة (تسجيل/إنشاء/خروج) في الهيدر للشاشات الكبيرة */
.header-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
}
.header-auth .ha-btn {
    border: none;
    border-radius: 10px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: transform .25s ease, box-shadow .25s ease;
}
.header-auth .ha-btn:hover { transform: translateY(-2px); }
.header-auth .ha-login {
    background: #fff;
    color: #0d4f2c;
    border: 2px solid #16a34a;
}
.header-auth .ha-signup {
    background: linear-gradient(145deg, #15803d, #16a34a);
    color: #fff;
    box-shadow: 0 6px 14px rgba(22,163,74,0.3);
}
.header-auth .ha-logout {
    background: linear-gradient(145deg, #b91c1c, #dc2626);
    color: #fff;
    border: none;
    box-shadow: 0 6px 14px rgba(220,38,38,0.4);
}

/* زر الهامبرغر */
.menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 2000;
}
.menu-btn span {
    display: block;
    width: 26px; height: 3px;
    border-radius: 3px;
    background: #0d4f2c;
    transition: transform .3s ease, opacity .3s ease;
}
.menu-btn.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-btn.active span:nth-child(2) { opacity: 0; }
.menu-btn.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* =========================================================
   السايدبار (هامبرغر) — تنزلق بحركة ناعمة
   ========================================================= */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: linear-gradient(180deg, #ffffff, #f0faf4);
    box-shadow: -12px 0 40px rgba(10,40,25,0.15);
    z-index: 1500;
    padding: 24px;
    transition: right .38s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    border-left: 1px solid rgba(22,163,74,0.1);
}
.sidebar.open { right: 0; }

.sidebar .close-btn {
    position: absolute;
    top: 14px; left: 14px;
    width: 38px; height: 38px;
    border: none;
    border-radius: 50%;
    background: #fdecec;
    color: #b91c1c;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s ease, background .25s ease;
}
.sidebar .close-btn:hover { transform: rotate(90deg); background: #fecaca; }

.sidebar-content {
    margin-top: 50px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-content .menu-item {
    display: block;
    width: 100%;
    text-align: right;
    padding: 13px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #1b2631;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .25s ease, transform .2s ease, padding-right .2s ease;
}
.sidebar-content a.menu-item:hover,
.sidebar-content button.menu-item:hover {
    background: linear-gradient(90deg, rgba(22,163,74,0.12), rgba(22,163,74,0.04));
    color: #0d4f2c;
    padding-right: 20px;
    transform: translateX(-4px);
}
.sidebar .menu-divider {
    border: none;
    border-top: 1px solid rgba(15,60,35,0.1);
    margin: 8px 4px;
}
.sidebar .sidebar-footer {
    margin-top: 8px;
    border-top: 1px solid rgba(15,60,35,0.1);
    padding-top: 14px;
}

/* قناع الشاشة عند فتح السايدبار */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 30, 18, 0.45);
    backdrop-filter: blur(3px);
    z-index: 1400;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* =========================================================
   المحتوى الرئيسي
   ========================================================= */
section {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 28px;
    flex: 1;
}

h2 {
    font-size: 28px;
    font-weight: 800;
    color: #0f2c1e;
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 10px;
}
h2::after {
    content: "";
    position: absolute;
    right: 0; bottom: 0;
    width: 52px; height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, #16a34a, #4ade80);
}
h3 { font-size: 20px; font-weight: 700; color: #163d29; margin: 16px 0 10px; }
h4 { font-size: 17px; font-weight: 700; color: #1b4a31; margin: 12px 0 8px; }
p { color: #4b5563; }

section > p { max-width: 760px; }

/* =========================================================
   الأزرار — أخضر غامق لامع (إيجابي) / أحمر غامق لامع (خروج)
   ========================================================= */
button {
    font-family: inherit;
    cursor: pointer;
    transition: all .25s ease;
}
button[type="submit"],
#processBtn,
#signupSubmitBtn,
#loginSubmitBtn,
#forgotSubmitBtn,
#resetSubmitBtn,
#saveToArchiveBtn,
.btn-primary {
    background: linear-gradient(145deg, #15803d, #16a34a);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(22,163,74,0.32), inset 0 1px 0 rgba(255,255,255,0.25);
    position: relative;
    overflow: hidden;
}
button[type="submit"]:hover,
#processBtn:hover,
#signupSubmitBtn:hover,
#loginSubmitBtn:hover,
#forgotSubmitBtn:hover,
#resetSubmitBtn:hover,
#saveToArchiveBtn:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(22,163,74,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
button[type="submit"]:active { transform: translateY(0); }

/* أزرار خروج/إلغاء — أحمر غامق لامع */
#logoutBtnSidebar,
#logoutBtn,
.logout-btn,
button[class*="cancel"],
button[class*="logout"],
.close-btn { }

/* الزرار العام للخروج */
#logoutBtnSidebar,
#logoutBtn {
    background: linear-gradient(145deg, #b91c1c, #dc2626);
    color: #fff;
    border: none;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(220,38,38,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
#logoutBtnSidebar:hover,
#logoutBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(220,38,38,0.4);
}

/* أزرار عامة داخل المحتوى (تحميل، عرض...) — بنفسجية/زرقاء داكنة هادئة غير الأخضر الرئيسي */
#downloadSummaryBtn,
#downloadExamBtn,
#week-nav button,
.view-btn,
#archiveSearch + a,
button:not([type="submit"]):not(#processBtn):not(#logoutBtnSidebar):not(#logoutBtn):not(#menuToggleBtn):not(.menu-btn):not(.close-btn):not(.notif-bell) {
    background: linear-gradient(145deg, #0e7490, #0891b2);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(8,145,178,0.25);
}
#downloadSummaryBtn:hover,
#downloadExamBtn:hover,
#week-nav button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(8,145,178,0.35);
}

/* =========================================================
   الحقول والنماذج
   ========================================================= */
input, select, textarea {
    width: 100%;
    max-width: 460px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #1b2631;
    font-family: inherit;
    font-size: 15px;
    transition: border-color .25s ease, box-shadow .25s ease;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 4px rgba(22,163,74,0.12);
}
label { font-weight: 600; color: #163d29; display: inline-block; margin-bottom: 4px; }

form div { margin-bottom: 6px; }
form {
    max-width: 520px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 12px 34px rgba(10,40,25,0.07);
}

/* =========================================================
   بنر البطل (Hero) + شريط الإحصائيات
   ========================================================= */
#hero {
    text-align: center;
    padding: 80px 28px 60px;
    background:
        radial-gradient(700px 300px at 80% 10%, rgba(74,222,128,0.12), transparent 60%),
        radial-gradient(600px 300px at 15% 20%, rgba(14,116,144,0.1), transparent 60%),
        #ffffff;
    border-bottom: 1px solid #f0f0f0;
}
#hero h1 {
    font-size: clamp(30px, 5vw, 46px);
    font-weight: 900;
    color: #0f2c1e;
    margin-bottom: 14px;
}
#hero ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-width: 720px;
    margin: 26px auto;
}
#hero ul li {
    background: #fff;
    border: 1px solid #eef2ef;
    border-radius: 14px;
    padding: 14px 18px;
    color: #163d29;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(10,40,25,0.06);
    text-align: center;
}
#hero .btn-primary {
    display: inline-block;
    text-decoration: none;
    font-size: 18px;
    padding: 14px 40px;
}

/* شريط الإحصائيات */
#stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 36px 28px;
    max-width: 1180px;
}
#stats .stat-item,
#admin-stats .stat-item {
    background: linear-gradient(160deg, #ffffff, #f6fdf9);
    border: 1px solid rgba(22,163,74,0.14);
    border-radius: 18px;
    padding: 22px;
    text-align: center;
    box-shadow: 0 10px 26px rgba(10,40,25,0.08);
}
#stats .stat-number,
#admin-stats .stat-number {
    display: block;
    font-size: 34px;
    font-weight: 900;
    color: #15803d;
    background: linear-gradient(90deg, #15803d, #22c55e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
#stats .stat-label,
#admin-stats .stat-label {
    color: #6b7280;
    font-weight: 600;
}

/* =========================================================
   الكروت (بطاقات أنيقة)
   ========================================================= */
#plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
#plans-grid > div {
    border-radius: 20px !important;
    padding: 26px !important;
    background: #fff !important;
    border: 1px solid #eef2ef !important;
    box-shadow: 0 14px 34px rgba(10,40,25,0.08);
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
    position: relative;
}
#plans-grid > div:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 44px rgba(10,40,25,0.14);
    border-color: rgba(22,163,74,0.35);
}
#plans-grid > div:last-child {
    border: 2px solid #16a34a !important;
    background: linear-gradient(170deg, #f0fdf4, #ffffff) !important;
}
#plans-grid > div:last-child::before {
    content: "المميزة";
    position: absolute;
    top: 14px; left: 14px;
    background: linear-gradient(100deg, #16a34a, #22c55e);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(22,163,74,0.4);
}
#plans-grid ul { list-style: none; padding: 0; }
#plans-grid ul li { position: relative; padding-right: 22px; margin-bottom: 6px; color: #4b5563; }
#plans-grid ul li::before {
    content: "✓";
    position: absolute;
    right: 0;
    color: #16a34a;
    font-weight: 900;
}

/* كروت الأرشيف والفيديوهات والقنوات */
#archive-list .archive-item,
#video-summary-result,
#video-segments-result,
#video-exam-smart,
#channels-results > div,
#followed-channels-list > div,
#smart-player-container {
    background: #fff !important;
    border: 1px solid #eef2ef !important;
    border-radius: 16px !important;
    padding: 18px !important;
    margin-bottom: 14px !important;
    box-shadow: 0 10px 26px rgba(10,40,25,0.07);
    transition: transform .3s ease, box-shadow .3s ease;
}
#archive-list .archive-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(10,40,25,0.12);
}
#archive-list .archive-item button { margin-top: 8px; }

/* =========================================================
   الجداول الحديثة
   ========================================================= */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 26px rgba(10,40,25,0.08);
    border: 1px solid #eef2ef;
}
th {
    background: linear-gradient(135deg, #15803d, #16a34a);
    color: #fff;
    padding: 14px;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    border: none;
}
td {
    padding: 13px;
    text-align: center;
    color: #334155;
    border-top: 1px solid #f0f4f2;
    font-size: 14px;
}
table tbody tr { transition: background .2s ease; }
table tbody tr:hover { background: #f6fdf9; }
table select {
    max-width: 130px;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

/* =========================================================
   الرسم البياني / التقدم
   ========================================================= */
#progressChart {
    border-radius: 16px !important;
    border: 1px solid #eef2ef !important;
    box-shadow: 0 10px 26px rgba(10,40,25,0.08);
    background: #fff !important;
}
#progress-section canvas {
    background: linear-gradient(180deg, #ffffff, #f8fdfa) !important;
}

/* =========================================================
   بطاقة البروفايل + أصناف التوست
   ========================================================= */
#profile-card,
#current-subscription,
#grade-edit {
    border-radius: 16px !important;
    box-shadow: 0 12px 30px rgba(10,40,25,0.08);
}
#profile-card {
    border: 1px solid #eef2ef !important;
    background: #fff !important;
}
#current-subscription {
    background: linear-gradient(160deg, #f0fdf4, #ffffff) !important;
    border: 1px solid rgba(22,163,74,0.25) !important;
}
#grade-edit {
    background: linear-gradient(160deg, #f0f9ff, #ffffff) !important;
    border: 1px solid rgba(8,145,178,0.25) !important;
}

/* =========================================================
   التوست (من الشكل الحديث)
   ========================================================= */
.toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    padding: 14px 24px;
    border-radius: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 12px 34px rgba(0,0,0,0.28);
    z-index: 12000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity .3s ease, transform .3s ease, visibility .3s;
    max-width: 92vw;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast.success { background: linear-gradient(135deg, #15803d, #16a34a); box-shadow: 0 12px 30px rgba(22,163,74,0.4); }
.toast.error { background: linear-gradient(135deg, #b91c1c, #dc2626); box-shadow: 0 12px 30px rgba(220,38,38,0.4); }
.toast.warning { background: linear-gradient(135deg, #c2410c, #ea580c); box-shadow: 0 12px 30px rgba(234,88,12,0.4); }
.toast.info { background: #0e7490; }

/* أخطاء الحقول */
.error-message {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #dc2626;
    font-size: 13px;
    margin-top: 5px;
    font-weight: 600;
    animation: fadeIn .3s ease;
}
.error-message::before { content: "⚠️"; font-size: 14px; }

/* =========================================================
   الإشعارات (الجرس)
   ========================================================= */
.notif-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-inline: 8px;
}
.notif-bell {
    position: relative;
    background: #f0fdf4;
    border: 1px solid rgba(22,163,74,0.2);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(22,163,74,0.15);
    transition: transform .2s ease;
}
.notif-bell:hover { transform: scale(1.08); }
.notif-badge {
    position: absolute;
    top: -5px; left: -5px;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    min-width: 19px; height: 19px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(220,38,38,0.4);
}
.notif-panel {
    position: absolute;
    top: 48px; left: 0;
    width: 360px;
    max-width: 92vw;
    background: #fff;
    border: 1px solid #eef2ef;
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(10,40,25,0.16);
    z-index: 10000;
    overflow: hidden;
}
.notif-header {
    background: linear-gradient(135deg, #15803d, #16a34a);
    color: #fff;
}
.notif-header button { background: none !important; color: #fff !important; box-shadow: none !important; text-decoration: underline; }
.notif-list::-webkit-scrollbar { width: 6px; }
.notif-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.notif-item { transition: background .2s ease; }
.notif-item:hover { background: #f6fdf9 !important; }

/* =========================================================
   الفوتر الاحترافي متعدد الأعمدة
   ========================================================= */
footer {
    width: 100%;
    margin-top: auto;
    background: #0f2c1e;
    color: #d1d5db;
    padding: 44px 28px 28px;
}
footer hr { display: none; }
footer p {
    color: #9ca3af;
    text-align: center;
    margin: 6px 0;
}
footer p:first-of-type {
    font-weight: 700;
    color: #fff;
    font-size: 18px;
}
footer p:last-child::before {
    content: "✉️ ";
}
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.footer-brand img {
    border-radius: 9px;
}
.footer-title {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}
.footer-copy {
    font-weight: 600;
    color: #d1d5db;
    font-size: 15px;
}
.footer-dev {
    color: #9ca3af;
    font-size: 13px;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.footer-links a {
    color: #22c55e;
    font-weight: 600;
    text-decoration: none;
}
.footer-links a:hover {
    text-decoration: underline;
    color: #86efac;
}

/* =========================================================
   الحالات العامة
   ========================================================= */
a { color: #15803d; text-decoration: none; }
a:hover { text-decoration: underline; }

.spinner {
    display: inline-block;
    border-radius: 50%;
    animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* =-===-=--==- الأنماط الوظيفية (تُحفظ كما هي) =-===-=--==- */

/* إخفاء الروابط المشروطة بالصلاحية */
nav a[href="my-archive.html"],
nav a[href="admin-dashboard.html"],
nav a[href="subscription.html"] { display: none; }

/* أنماط PDF (html2pdf) */
#__pdftemp__ { font-family: 'Cairo', sans-serif; direction: rtl; text-align: right; color: #263238; background: #ffffff; padding: 24px; box-sizing: border-box; }
.pdf-wm { position: absolute; top: 42%; left: 0; width: 100%; text-align: center; font-size: 44px; font-weight: bold; color: #2196f3; opacity: 0.10; letter-spacing: 1px; z-index: 0; }
.pdf-wm-sub { position: absolute; top: 50%; left: 0; width: 100%; text-align: center; font-size: 20px; color: #90a4ae; opacity: 0.10; z-index: 0; }
.pdf-title { font-size: 24px; font-weight: bold; color: #0d47a1; border-bottom: 2px solid #2196f3; padding-bottom: 8px; margin-bottom: 16px; position: relative; z-index: 1; }
.pdf-body { font-size: 15px; line-height: 2; position: relative; z-index: 1; }
.pdf-body p { margin: 0 0 8px 0; }

/* =========================================================
   ملف PDF المُولّد (تصوير HTML -> صفحات عالية الجودة)
   الهيدر (لوجو + اسم) يُرسم على كل صفحة برمجياً في script.js
   ========================================================= */
#__pdftemp__ { box-sizing: border-box; padding: 32px 40px; }
#__pdftemp__ .pdf-title {
    font-size: 26px; font-weight: 800; color: #0d47a1;
    border-bottom: 3px solid #2196f3; padding-bottom: 10px;
    margin: 0 0 18px; text-align: right;
}
#__pdftemp__ .pdf-body { font-size: 15px; line-height: 1.9; color: #263238; text-align: right; }
#__pdftemp__ .pdf-body p { margin: 0 0 8px 0; }

.notif-toast-link { color: #fff; font-weight: 700; text-decoration: underline; }

/* =========================================================
   تجاوز الأنماط القديمة (inline) لتوحيد الشكل الحديث
   ========================================================= */
#subscribe-btn,
#video-exam-start-btn {
    background: linear-gradient(145deg, #15803d, #16a34a) !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 26px !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    box-shadow: 0 6px 16px rgba(22,163,74,0.32) !important;
    transition: transform .25s ease, box-shadow .25s ease !important;
}
#subscribe-btn:hover,
#video-exam-start-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 22px rgba(22,163,74,0.4) !important;
}
#subscribe-btn { display: block; width: 100%; margin-top: 14px !important; }

/* أزرار السابق/التالي في الكويز */
#video-quiz-prev, #video-quiz-next {
    background: #e8f6ef !important;
    color: #0d4f2c !important;
    border: 1px solid #16a34a !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
}
#play-summary-btn, #stop-summary-btn {
    background: linear-gradient(145deg, #0e7490, #0891b2) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 10px 20px !important;
    cursor: pointer !important;
    margin-inline: 4px !important;
}

/* حقل البحث في الأرشيف ورأس الفيديو */
#archiveSearch, #archiveSearch + *,
input, select {
    max-width: 100%;
}

/* منطقة تحميل الملف */
#upload-area {
    background: linear-gradient(170deg, #ffffff, #f6fdf9);
    border: 2px dashed rgba(22,163,74,0.35);
    border-radius: 20px;
    padding: 34px;
    margin-bottom: 26px;
}
#upload-area input[type="file"] {
    border: 2px dashed rgba(22,163,74,0.4);
    background: #fff;
}
#results > *,
#video-summary-result > *,
#video-segments-result > * {
    background: #fff;
    border: 1px solid #eef2ef;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 8px 22px rgba(10,40,25,0.06);
}

/* أقسام الفيديو والكويز */
#video-quiz-question {
    border-radius: 12px !important;
    background: #f8fdfa !important;
    border: 1px solid #eef2ef !important;
    padding: 16px !important;
}
#video-quiz-result {
    border-radius: 12px !important;
    border: 2px solid #16a34a !important;
    background: #f0fdf4 !important;
}
#video-quiz-progress { color: #0d4f2c !important; }

/* =========================================================
   الاستجابة (موبايل)
   ========================================================= */
@media (max-width: 860px) {
    header { padding: 0 16px; height: 64px; }
    header nav { display: none; }
    .menu-btn { display: flex; }
    .header-auth { display: none; }
    section { padding: 28px 18px; }
    #hero { padding: 56px 18px 44px; }
    #stats { grid-template-columns: 1fr 1fr; padding: 24px 18px; }
    .notif-panel { position: fixed; top: 58px; left: 8px; right: 8px; width: auto; margin: 0; }

    /* جداول تتناسب مع الموبايل (تمرير أفقي بدل التكسر) */
    table { display: block; overflow-x: auto; white-space: nowrap; }
    header .logo span { font-size: 19px !important; }
    header { gap: 10px; }
}

@media (max-width: 640px) {
    #plans-grid > div { min-width: 100% !important; }
    #stats { grid-template-columns: 1fr 1fr; }
    #stats .stat-number, #admin-stats .stat-number { font-size: 26px; }
    form { padding: 18px; }
    footer { padding: 34px 18px 22px; }
    #hero h1 { font-size: 26px; }
    #hero ul { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    #stats, #plans-grid { grid-template-columns: 1fr; }
    h2 { font-size: 22px; }
    header { height: 60px; padding: 0 12px; }
    #stats .stat-item { padding: 16px; }
    #plans-grid { gap: 14px; }
    section { padding: 22px 14px; }
    #hero { padding: 44px 14px 34px; }
    button { width: auto; }

    /* الفوتر بأعمدة تتكدس للعمود الواحد */
    footer p:first-of-type { font-size: 16px; }
    footer p { font-size: 13px; }

    /* لوحة الإشعارات: شاشة صغيرة جداً، توضع بعرض كامل تحت الهيدر مباشرة */
    .notif-panel { left: 0; right: 0; width: 100%; max-width: 100%; border-radius: 12px; }
}

@media (max-width: 360px) {
    #hero h1 { font-size: 23px; }
    #stats { grid-template-columns: 1fr; }
    input, select { font-size: 14px; padding: 11px 12px; }
    .sidebar { width: 84vw; }
}

/* =========================================================
   سبينر تحميل أنيق (SVG) — يظهر في أي عملية تحميل/معالجة
   ========================================================= */
.loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    color: #4b5563;
    font-weight: 600;
    font-size: 15px;
}
.loading-box .spinner-svg {
    width: 46px;
    height: 46px;
    color: #16a34a;
    animation: spin-svg 1s linear infinite;
}
@keyframes spin-svg { to { transform: rotate(360deg); } }

/* =========================================================
   زر العين لإظهار/إخفاء كلمة المرور (أيقونة SVG مثل جوجل)
   ========================================================= */
.pwd-wrapper {
    position: relative;
    display: block;
    width: 100%;
    max-width: 460px;
}
.pwd-wrapper input { padding-left: 44px; }
.pwd-toggle {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    border-radius: 8px;
    transition: color .2s ease, background .2s ease;
}
.pwd-toggle:hover { color: #15803d; background: rgba(22,163,74,0.08); }
.pwd-toggle svg { width: 22px; height: 22px; pointer-events: none; }

/* =========================================================
   أزرار الفيديو الموحدة (تلخيص الفيديو + الإبلاغ)
   ========================================================= */
.vbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    white-space: normal;
    text-align: center;
    margin: 4px 4px 4px 0;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.vbtn:hover { transform: translateY(-1px); }
.vbtn-primary {
    background: linear-gradient(145deg, #15803d, #16a34a);
    color: #fff;
    box-shadow: 0 4px 10px rgba(22,163,74,0.3);
}
.vbtn-primary:hover { box-shadow: 0 6px 14px rgba(22,163,74,0.4); }
.vbtn-report {
    background: linear-gradient(145deg, #b91c1c, #dc2626);
    color: #fff;
    border: none;
    box-shadow: 0 4px 10px rgba(220,38,38,0.35);
}
.vbtn-report:hover { box-shadow: 0 6px 14px rgba(220,38,38,0.45); background: linear-gradient(145deg, #dc2626, #ef4444); }

@media (max-width: 640px) {
    .vbtn { padding: 9px 12px; font-size: 13px; width: 100%; margin: 5px 0; }
    .video-card .vbtn { width: 100%; }
    .video-card {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .video-card img {
        width: 100% !important;
        height: auto !important;
        border-radius: 6px;
    }
}

/* =========================================================
   نافذة تحكم الفيديو والامتحان (المنبثقة)
   تصميم متناسق مع نظام الموقع (أخضر/أحمر + زجاجي)
   ========================================================= */
.vc-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 20, 15, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: 'Cairo', 'Tajawal', sans-serif;
}
.vc-box {
    background: #ffffff;
    border-radius: 18px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(8, 40, 25, 0.28);
    border: 1px solid rgba(15, 60, 35, 0.08);
    color: #1b2631;
    direction: rtl;
}
.vc-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.vc-title {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #0d4f2c;
    letter-spacing: -0.3px;
}
.vc-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    height: 34px; width: 34px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    transition: color .2s ease, background .2s ease;
}
.vc-close:hover { color: #dc2626; background: rgba(220,38,38,0.08); }
.vc-desc {
    margin: 0 0 14px;
    font-size: 13px;
    color: #6b7280;
}
.vc-section {
    margin-bottom: 16px;
    border: 1px solid rgba(15,60,35,0.08);
    border-radius: 14px;
    padding: 14px;
    background: #fafcfa;
}
.vc-section-title {
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 10px;
    color: #0d4f2c;
    display: flex;
    align-items: center;
    gap: 6px;
}
.vc-mode-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.vc-mode-btn {
    flex: 1;
    min-width: 130px;
    padding: 11px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    color: #374151;
    transition: all .2s ease;
}
.vc-mode-btn:hover { border-color: #22c55e; }
.vc-mode-btn.active {
    background: rgba(22,163,74,0.10);
    border-color: #16a34a;
    color: #0d4f2c;
}
.vc-field-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.vc-field {
    flex: 1;
    min-width: 200px;
}
.vc-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
}
.vc-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.vc-input {
    flex: 1;
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    direction: ltr;
    text-align: center;
    color: #1b2631;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.vc-input:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
.vc-clear-btn {
    background: #fdecea;
    border: 1px solid #f5c6c4;
    border-radius: 10px;
    cursor: pointer;
    padding: 9px 11px;
    color: #b91c1c;
    transition: background .2s ease;
}
.vc-clear-btn:hover { background: #f8d7d6; }
.vc-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 8px 0 0;
}
.vc-select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: #fff;
    color: #1b2631;
    cursor: pointer;
}
.vc-select:focus { outline: none; border-color: #16a34a; }
.vc-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
}
.vc-check input {
    width: 18px; height: 18px;
    accent-color: #16a34a;
    cursor: pointer;
}
.vc-start {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #15803d, #16a34a);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(22,163,74,0.3);
    transition: transform .2s ease, box-shadow .2s ease;
}
.vc-start:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(22,163,74,0.4); }
@media (max-width: 480px) {
    .vc-box { padding: 18px; }
    .vc-mode-btn { min-width: 100%; }
}

/* =========================================================
   نافذة الدفع QR Pay (تجربة احترافية)
   ========================================================= */
.qrp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 20, 15, 0.55);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: 'Cairo', 'Tajawal', sans-serif;
}
.qrp-box {
    background: #ffffff;
    border-radius: 18px;
    max-width: 440px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    padding: 22px;
    box-shadow: 0 24px 70px rgba(8, 40, 25, 0.30);
    border: 1px solid rgba(15, 60, 35, 0.08);
    color: #1b2631;
    direction: rtl;
}
.qrp-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}
.qrp-brand {
    font-size: 22px;
    font-weight: 900;
    color: #0d4f2c;
    letter-spacing: -0.5px;
}
.qrp-secure {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}
.qrp-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(15,60,35,0.10);
    background: #f6fbf7;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
}
.qrp-summary-label { font-weight: 800; font-size: 15px; color: #0d4f2c; }
.qrp-summary-desc { font-size: 12px; color: #6b7280; margin-top: 2px; }
.qrp-price { font-size: 24px; font-weight: 900; color: #16a34a; white-space: nowrap; }
.qrp-price small { font-size: 13px; }
.qrp-discount {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
}
.qrp-label {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 12px 0 6px;
}
.qrp-qr-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 2px dashed #16a34a;
    border-radius: 14px;
    padding: 10px;
    width: fit-content;
    margin: 0 auto;
}
.qrp-qr { border-radius: 8px; overflow: hidden; }
.qrp-phone-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 4px;
}
.qrp-phone {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1px;
    direction: ltr;
    color: #0d4f2c;
    background: #f0f9f4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 7px 16px;
}
.qrp-steps {
    margin-top: 14px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}
.qrp-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 8px;
}
.qrp-step span {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.qrp-ref {
    margin-top: 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: #6b7280;
    background: #fafcfa;
    border-radius: 8px;
    padding: 8px;
    border: 1px dashed #d1d5db;
}
.qrp-paid {
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #15803d, #16a34a);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(22,163,74,0.3);
    transition: transform .2s ease, box-shadow .2s ease;
}
.qrp-paid:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(22,163,74,0.4); }
.qrp-cancel {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    color: #6b7280;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .2s ease;
}
.qrp-cancel:hover { background: #f9fafb; }
@media (max-width: 480px) {
    .qrp-box { padding: 18px; }
    .qrp-price { font-size: 20px; }
}


