:root {
    --primary-color: #6366f1;
    /* Modern Indigo */
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --secondary-color: #f43f5e;
    /* Rose 500 */
    --accent-color: #10b981;
    /* Emerald 500 */
    --bg-color: #020617;
    /* Deep Slate 950 */
    --surface-color: rgba(15, 23, 42, 0.6);
    /* Slate 900 with opacity */
    --surface-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --card-radius: 20px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 4px 10px -5px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 20px 40px -10px rgba(99, 102, 241, 0.3);
    --ad-bg: rgba(15, 23, 42, 0.5);
    --ad-text: #94a3b8;
}

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

body.dark-theme {
    background-color: var(--bg-color);
    color: var(--text-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Glassmorphism utility */
.glass {
    background: var(--surface-color);
    /* تم إيقاف تأثير blur لأنه يسبب تقطيع شديد في التمرير (Scroll Lag) */
    /* backdrop-filter: blur(16px); */
    /* -webkit-backdrop-filter: blur(16px); */
    border: 1px solid var(--surface-border);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-premium);
    transition: var(--transition);
}

.glass:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.btn-primary {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    margin-bottom: 30px;
    border-radius: var(--card-radius);
    background: var(--surface-color);
    /* backdrop-filter: blur(12px); */
    border: 1px solid var(--surface-border);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-placeholder {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.logo-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.platform-title {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0;
}

.platform-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn i {
    font-size: 14px;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: white;
    background: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.4);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* ------------------------------------- */
/* Notes Reader — Educational Pro Edition */
/* ------------------------------------- */

/* === الحاوية الرئيسية (الملزمة) === */
.notes-reader {
    background-color: #fdfbf7;
    background-image:
        linear-gradient(rgba(49, 130, 206, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(49, 130, 206, 0.05) 1px, transparent 1px);
    background-size: 25px 25px;
    padding: 50px 60px 60px 80px;
    /* المسافة اليسرى الأكبر للتجليد */
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow:
        8px 8px 30px rgba(0, 0, 0, 0.04),
        -4px -4px 15px rgba(255, 255, 255, 1);
    color: #2d3748;
    line-height: 2.2;
    font-size: 1.15rem;
    font-weight: 500;
    max-width: 950px;
    margin: 0 auto;
    position: relative;
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    counter-reset: h2-counter lvl1;
    z-index: 2;
}

/* خط التجليد الأحمر الجانبي للملزمة */
.notes-reader::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 40px;
    width: 2px;
    background: #fc8181;
    opacity: 0.8;
    z-index: 1;
}

.notes-reader::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 45px;
    width: 1px;
    background: #feb2b2;
    opacity: 0.5;
    z-index: 1;
}

/* === العنوان الرئيسي للمستند (H1) === */
.notes-reader h1 {
    font-size: 2.3rem;
    font-weight: 900;
    text-align: center;
    color: #1a365d;
    background: #ebf8ff;
    padding: 20px 40px;
    border-radius: 12px;
    margin: 10px auto 40px auto;
    border: 2px dashed #90cdf4;
    box-shadow: 4px 4px 0 #90cdf4;
    position: relative;
    line-height: 1.5;
    counter-reset: h2-counter lvl1 lvl2 lvl3;
    display: table;
}

.notes-reader h1::after {
    content: '📖';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 2.2rem;
    background: #fff;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #90cdf4;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* === العنوان الرئيسي للدرس/الفصل (H2) === */
.notes-reader h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2b6cb0;
    margin: 45px 0 25px 0;
    padding: 12px 25px 12px 10px;
    background: #edf2f7;
    border-right: 8px solid #3182ce;
    border-radius: 4px 0 0 4px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    counter-increment: h2-counter;
    counter-reset: h3-counter;
}

.notes-reader h2::after {
    content: counter(h2-counter);
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    background: #3182ce;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 900;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(49, 130, 206, 0.4);
}

/* === العنوان الفرعي (H3) === */
.notes-reader h3 {
    font-size: 1.35rem;
    font-weight: 800;
    color: #4a5568;
    margin: 35px 0 15px 0;
    padding: 8px 15px;
    border-right: 5px solid #805ad5;
    background: linear-gradient(to left, rgba(128, 90, 213, 0.08), transparent);
    border-radius: 0 6px 6px 0;
    counter-increment: h3-counter;
    position: relative;
}

.notes-reader h3::before {
    content: counter(h2-counter) "-" counter(h3-counter) " ";
    color: #805ad5;
    margin-left: 8px;
    font-weight: 900;
}

/* === العنوان الرابع (H4) === */
.notes-reader h4 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2f855a;
    margin: 25px 0 12px 0;
    padding: 5px 12px;
    border-right: 3px solid #38a169;
    background: rgba(56, 161, 105, 0.05);
}

/* === فقرات النص === */
.notes-reader p {
    margin-bottom: 1.4em;
    text-align: justify;
    color: #2d3748;
    line-height: 2.2;
}

/* === قلم التحديد (Highlighter) للنص الغليظ === */
.notes-reader strong,
.notes-reader b {
    color: #1a202c;
    font-weight: 800;
    background: linear-gradient(104deg, rgba(253, 230, 138, 0.8) 0%, rgba(252, 211, 77, 0.8) 100%);
    padding: 0 6px;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* === النص المائل === */
.notes-reader em,
.notes-reader i {
    color: #c53030;
    font-style: normal;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(197, 48, 48, 0.3);
    text-decoration-thickness: 3px;
    text-underline-offset: 4px;
}

/* ============================================ */
/* === القوائم النقطية — تصميم الملزمة === */
/* ============================================ */
.notes-reader ul {
    margin: 15px 0 20px 0;
    padding-right: 5px;
    list-style: none;
    color: #2d3748;
}

.notes-reader ul>li {
    position: relative;
    padding: 8px 35px 8px 10px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #edf2f7;
    line-height: 2.0;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.02);
}

.notes-reader ul>li::before {
    content: '🔸';
    position: absolute;
    right: 10px;
    top: 9px;
    font-size: 0.85rem;
}

.notes-reader ul>li>ul {
    margin: 10px 0 5px 0;
}

.notes-reader ul>li>ul>li {
    background: #f7fafc;
    border-right: 3px solid #3182ce;
}

.notes-reader ul>li>ul>li::before {
    content: '🔹';
}

/* ================================================ */
/* === القوائم المرقمة — أرقام واضحة بارزة === */
/* ================================================ */
.notes-reader ol {
    margin: 15px 0 20px 0;
    padding-right: 5px;
    list-style: none;
}

.notes-reader ol>li {
    position: relative;
    padding: 12px 55px 12px 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: #fff;
    line-height: 2.0;
    counter-increment: lvl1;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.notes-reader ol>li::before {
    content: counter(lvl1);
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: #3182ce;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 5px rgba(49, 130, 206, 0.3);
}

.notes-reader ol>li>ol>li {
    padding-right: 45px;
    background: #f7fafc;
}

.notes-reader ol>li>ol>li::before {
    content: counter(lvl2, arabic-indic);
    background: #805ad5;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    font-size: 0.85rem;
}

/* === الجداول — تصميم المقارنات المنظم === */
.notes-reader table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 1.05rem;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid #cbd5e0;
}

.notes-reader th {
    background: #2b6cb0;
    color: #ffffff;
    font-weight: 800;
    padding: 16px 20px;
    text-align: center;
    border: 1px solid #2c5282;
}

.notes-reader td {
    padding: 14px 20px;
    text-align: right;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

.notes-reader tr:nth-child(even) td {
    background: #f7fafc;
}

.notes-reader tr:hover td {
    background: #ebf8ff;
}

/* === الصور === */
.notes-reader img {
    max-width: 100%;
    height: auto !important;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin: 30px auto;
    display: block;
    border: 4px solid #fff;
}

/* === الاقتباس / Blockquote (صندوق التنبيهات والملاحظات الهامة) === */
.notes-reader blockquote {
    margin: 35px 0;
    padding: 25px 25px 25px 20px;
    border-right: 6px solid #dd6b20;
    background: #fffaf0;
    border-radius: 10px;
    border: 1px solid #feebc8;
    color: #9c4221;
    font-size: 1.15rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(221, 107, 32, 0.08);
    position: relative;
}

.notes-reader blockquote::before {
    content: '📌 هام جداً:';
    display: block;
    color: #dd6b20;
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 8px;
}

/* === الكود === */
.notes-reader code {
    background: #edf2f7;
    color: #2b6cb0;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

/* === خط فاصل === */
.notes-reader hr {
    border: none;
    height: 3px;
    background: repeating-linear-gradient(90deg, #cbd5e0, #cbd5e0 10px, transparent 10px, transparent 20px);
    margin: 40px 0;
}

/* ========================================
   Audio/Video Player Styles
   ======================================== */
.av-sentence {
    display: block;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    padding: 10px;
    border-radius: 8px;
}

.av-player-container {
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.15);
}

.av-btn-main:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

/* ========================================
   Responsive iframe (YouTube / links)
   ======================================== */
.responsive-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
}

.responsive-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

/* ========================================
   RESPONSIVE — Notes Reader on Mobile
   ======================================== */
@media (max-width: 768px) {
    .notes-reader {
        padding: 20px 15px 30px;
        font-size: 0.97rem;
        border-radius: 12px;
    }

    .notes-reader h1 {
        font-size: 1.3rem;
        padding: 14px 16px;
        margin: 15px 0 25px;
    }

    .notes-reader h1::after {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
        line-height: 40px;
        top: -14px;
    }

    .notes-reader h2 {
        font-size: 1.15rem;
        padding: 10px 14px 10px 0;
        margin: 25px 0 15px;
    }

    .notes-reader h2::after {
        right: -35px;
        font-size: 0.95rem;
    }

    .notes-reader h3 {
        font-size: 1.05rem;
        padding: 8px 12px;
        margin: 20px 0 10px;
    }

    .notes-reader h4 {
        font-size: 1rem;
        padding: 7px 10px;
        margin: 18px 0 10px;
    }

    .notes-reader p {
        font-size: 0.97rem;
        line-height: 1.9;
    }

    /* Lists */
    .notes-reader ul>li,
    .notes-reader ol>li {
        padding-right: 40px;
        font-size: 0.95rem;
    }

    /* Tables: horizontal scroll */
    .notes-reader table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        font-size: 0.9rem;
    }

    .notes-reader th,
    .notes-reader td {
        padding: 10px 12px;
    }

    /* Images */
    .notes-reader img {
        border-radius: 8px;
        margin: 15px auto;
    }
}

@media (max-width: 480px) {
    .notes-reader {
        padding: 15px 12px 25px;
        font-size: 0.93rem;
    }

    .notes-reader h1 {
        font-size: 1.15rem;
        padding: 12px 14px;
    }

    .notes-reader h2 {
        font-size: 1.05rem;
    }

    .notes-reader h3 {
        font-size: 0.98rem;
    }
}

/* ========================================
   RESPONSIVE — Header & Nav on Mobile
   ======================================== */
@media (max-width: 768px) {
    .platform-title {
        font-size: 0.95rem;
    }

    .platform-subtitle {
        font-size: 0.72rem;
    }

    .logo-placeholder {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* Hide admin button text on very small screens */
    .nav-btn span {
        display: none;
    }
}

@media (max-width: 380px) {
    .nav-btn i {
        font-size: 13px;
    }

    .nav-btn {
        padding: 5px 7px;
    }
}

/* ========================================
   RESPONSIVE — Buttons & Forms on Mobile
   ======================================== */
@media (max-width: 768px) {
    .btn {
        padding: 9px 14px;
        font-size: 0.9rem;
        gap: 6px;
    }

    .btn-primary,
    .btn-outline {
        min-height: 42px;
    }

    .form-control {
        font-size: 16px;
        /* Prevent iOS zoom */
        padding: 11px 13px;
    }

    select.form-control {
        appearance: none;
        -webkit-appearance: none;
    }

    .file-upload-box {
        padding: 15px;
    }

    .file-upload-icon {
        font-size: 1.6rem;
    }
}

/* ========================================
   RESPONSIVE — AV Player on Mobile
   ======================================== */
@media (max-width: 768px) {
    .av-player-container {
        border-radius: 16px !important;
        min-height: 320px !important;
    }

    /* Larger touch targets for AV controls */
    #avPlayBtn {
        width: 54px !important;
        height: 54px !important;
        font-size: 1.3rem !important;
    }
}

@media (max-width: 480px) {
    .av-player-container {
        border-radius: 12px !important;
        min-height: 280px !important;
    }

    #avPlayBtn {
        width: 50px !important;
        height: 50px !important;
    }
}

/* ========================================
   RESPONSIVE — Admin Panel on Mobile
   ======================================== */
@media (max-width: 768px) {
    .admin-panel {
        padding: 0 5px;
    }

    /* Stack admin buttons vertically */
    .admin-panel .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }

    /* Quill editor height on mobile */
    .ql-editor {
        min-height: 180px !important;
    }

    .ql-toolbar {
        flex-wrap: wrap;
    }
}

/* ========================================
   RESPONSIVE — Quiz on Mobile
   ======================================== */
@media (max-width: 768px) {

    /* Quiz layout stacking */
    .premium-quiz-container {
        grid-template-columns: 1fr !important;
    }

    /* Make quiz sidebar horizontal on mobile */
    .premium-quiz-container>.glass:first-child {
        position: relative !important;
        top: 0 !important;
        max-height: 250px !important;
    }

    .quiz-progress-item {
        display: inline-block;
        width: 100px;
        margin-left: 5px;
    }

    /* Scrollable progress bar container */
    .premium-quiz-container>.glass:first-child>div:last-child {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
    }

    /* Quiz option buttons */
    .quiz-option {
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
        min-height: 50px;
    }

    .quiz-question {
        font-size: 1rem !important;
        line-height: 1.7 !important;
    }
}

/* ========================================
   RESPONSIVE — Chat on Mobile
   ======================================== */
@media (max-width: 768px) {
    #chatInput {
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    #messagesContainer {
        padding: 12px !important;
        gap: 10px !important;
    }
}

/* ========================================
   RESPONSIVE — Glass Cards on Mobile
   ======================================== */
@media (max-width: 768px) {
    .glass {
        border-radius: 14px;
    }

    /* Subscription / unlock page */
    .glass[style*="padding: 40px"] {
        padding: 20px 15px !important;
    }
}

/* ========================================
   حماية النصوص ضد التحديد والنسخ في المنصة
   ======================================== */
body,
body * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-modify: read-only !important;
}

/* استثناء حقول الإدخال لضمان عمل الاختبارات والكتابة */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="radio"],
input[type="checkbox"],
textarea,
select {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* منع التحديد داخل مشاهد الملفات والنصوص المكتوبة */
.notes-reader,
.viewer-content,
.viewer-container,
#notesReaderDiv,
#viewerContent,
.avFrameContent,
#avFrameContent,
.gform-question,
.gform-option-text,
.gform-card,
.gform-container {
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
    touch-action: pan-y !important;
}

/* ========================================
   iOS Safari specific fixes
   ======================================== */
@supports (-webkit-touch-callout: none) {

    /* Fix Safari 100vh bug */
    body {
        min-height: -webkit-fill-available;
    }

    /* Fix iOS backdrop-filter performance */
    .glass {
        /* -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px); */
    }

    /* Fix iOS button appearance */
    .btn,
    .nav-btn,
    .btn-icon {
        -webkit-appearance: none;
        appearance: none;
    }

    /* Fix iOS input zoom */
    input[type="text"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ========================================
   Touch device hover suppression
   (prevents stuck hover states on touch)
   ======================================== */
@media (hover: none) {
    .stage-card:hover {
        transform: none;
        box-shadow: var(--shadow-premium);
        border-color: var(--surface-border);
        background: linear-gradient(145deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.6));
    }

    .btn-primary:hover {
        transform: none;
    }

    .btn-outline:hover {
        color: var(--text-primary);
        border-color: var(--surface-border);
    }

    .list-item:hover {
        background: rgba(30, 41, 59, 0.6);
        border-color: var(--surface-border);
    }
}

/* ========================================
   الشريط الجانبي التفاعلي للاختبارات الإلكترونية
   ======================================== */
.gform-qbtn {
    background: linear-gradient(145deg, #1e293b, #0f172a) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 8px !important;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gform-qbtn:hover {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    color: #a5b4fc !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

.gform-qbtn.current-question {
    background: linear-gradient(135deg, #6366f1, #7c3aed) !important;
    border: none !important;
    color: white !important;
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
    z-index: 2;
}

.gform-qbtn.answered-question {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: #34d399 !important;
}

.gform-qbtn.unanswered-question {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #64748b !important;
}

/* ===== تحسين تخطيط الاختبار مع الشريط الجانبي ===== */
.quiz-layout-grid .gform-sidebar {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    /* backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 15px;
    min-width: 150px;
}

/* شريط تمرير مخصص للقائمة الجانبية */
.gform-sidebar::-webkit-scrollbar {
    width: 6px;
}

.gform-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.gform-sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 10px;
}

.gform-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* ===== استجابة الشريط الجانبي للجوال ===== */
@media (max-width: 768px) {
    .quiz-layout-grid {
        flex-direction: column-reverse !important;
    }

    .quiz-layout-grid .gform-sidebar {
        flex: 1 1 100% !important;
        order: 3 !important;
        max-height: 130px;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        position: sticky;
        bottom: 0;
        top: auto;
        z-index: 50;
        padding: 10px;
    }

    .quiz-layout-grid .gform-sidebar h3 {
        width: 100%;
        font-size: 0.85rem;
        margin-bottom: 5px;
        text-align: center;
        padding-bottom: 5px;
    }

    .gform-qbtn {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px;
        aspect-ratio: 1;
        font-size: 0.75rem;
        border-radius: 6px !important;
    }

    .gform-qbtn.current-question {
        transform: scale(1.1);
    }

    .gform-card {
        padding: 18px 16px;
    }

    .gform-question {
        font-size: 0.95rem;
    }

    .gform-option {
        padding: 11px 14px;
        font-size: 0.85rem;
    }
}

/* ====== دعم الشاشات الصغيرة جداً ====== */
@media (max-width: 480px) {
    .gform-qbtn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px;
        font-size: 0.7rem;
    }
}
body:not(.owner-mode) .owner-only-btn { display: none !important; }

/* 🛡️ حماية منع التحديد والنسخ عبر CSS المستقر عالي السرعة */
.notes-reader, .notes-reader *, .viewer-content, .viewer-content *, .viewer-container, .viewer-container * {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

