@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

* { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
    --gold: #d9a441;
    --danger: #c0392b;

    /* نظام التصميم: التباعد */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    /* نظام التصميم: الانحناءات والظلال */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.18);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.22);

    /* نظام التصميم: القائمة الجانبية */
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 76px;
    --sidebar-bg: rgba(15, 32, 39, 0.92);
    --sidebar-border: rgba(255, 255, 255, 0.10);
}

/* نقاط الفصل المعتمدة في كل الموقع: 480px (هاتف) / 768px (لوحي) / 1024px (سطح المكتب وعتبة القائمة الجانبية) */

html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'Cairo', Tahoma, Arial, sans-serif;
    color: #f5f5f5;
    overflow-x: hidden;
}

body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

img {
    -webkit-user-drag: none;
    pointer-events: none;
}

body {
    background:
        radial-gradient(circle at 15% 10%, rgba(217, 164, 65, 0.18), transparent 35%),
        radial-gradient(circle at 85% 90%, rgba(255, 255, 255, 0.12), transparent 40%),
        linear-gradient(135deg, #0f2027 0%, #203a43 45%, #2c5364 75%, #134e5e 100%);
    background-attachment: fixed;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
    background-size: 26px 26px;
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

/* ===================== القشرة العامة: القائمة الجانبية + الهيدر المنسدل ===================== */

.app-shell {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-main {
    flex: 1;
    min-width: 0;
}

.sidebar {
    flex-shrink: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-inline-start: 1px solid var(--sidebar-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: width 0.25s ease;
}

.sidebar-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: #fff;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}

.sidebar-brand-icon { font-size: 1.6rem; flex-shrink: 0; }

.sidebar-brand-text {
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.3;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, background 0.2s ease;
}

.sidebar-collapse-btn:hover { background: rgba(255, 255, 255, 0.18); }

.sidebar-close-btn {
    display: none;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--sidebar-border);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 11px var(--space-3);
    border-radius: var(--radius-sm);
    color: #f5f5f5;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.sidebar-link:hover { background: rgba(255, 255, 255, 0.10); }

.sidebar-link.active {
    background: rgba(217, 164, 65, 0.22);
    color: var(--gold);
}

.sidebar-link-icon { font-size: 1.15rem; flex-shrink: 0; width: 24px; text-align: center; }

.sidebar-foot {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: flex-start;
}

/* طي القائمة على سطح المكتب: أيقونات فقط */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-link-text {
    display: none;
}

.sidebar-collapsed .sidebar-collapse-btn {
    transform: rotate(180deg);
}

.sidebar-collapsed .sidebar-nav { align-items: center; }
.sidebar-collapsed .sidebar-link { justify-content: center; width: 48px; }
.sidebar-collapsed .sidebar-head { justify-content: center; flex-wrap: wrap; }

.sidebar-overlay {
    display: none;
}

.app-topbar-mobile {
    display: none;
}

.hamburger-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.10);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.app-topbar-mobile-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1rem;
}

/* ===== لوحي وهاتف: القائمة تتحول لقائمة منسدلة فوق المحتوى ===== */
@media (max-width: 1023px) {
    .sidebar-collapse-btn { display: none; }

    .app-topbar-mobile {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        position: sticky;
        top: 0;
        z-index: 60;
        padding: var(--space-3) var(--space-4);
        background: rgba(15, 32, 39, 0.92);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--sidebar-border);
    }

    .sidebar {
        position: fixed;
        inset-inline-start: 0;
        top: 0;
        height: 100vh;
        width: min(80vw, 300px);
        z-index: 90;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        box-shadow: var(--shadow-md);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close-btn { display: flex; align-items: center; justify-content: center; }

    .sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 85;
    }

    /* الطي (سطح المكتب) لا معنى له على الهاتف/اللوحي */
    .sidebar-collapsed .sidebar { width: min(80vw, 300px); }
    .sidebar-collapsed .sidebar-brand-text,
    .sidebar-collapsed .sidebar-link-text { display: block; }
    .sidebar-collapsed .sidebar-link { justify-content: flex-start; width: auto; }
    .sidebar-collapsed .sidebar-head { justify-content: space-between; flex-wrap: nowrap; }
}

@media (min-width: 1024px) {
    .sidebar-open .sidebar-overlay { display: none; }
}

/* ===================== تذييل الموقع (الفوتر) ===================== */

.app-footer {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.app-footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.app-footer-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.app-footer-col a {
    color: #cfe8ff;
    text-decoration: none;
    font-size: 0.92rem;
}

.app-footer-col a:hover { text-decoration: underline; }

.app-footer-brand {
    font-weight: 800;
    font-size: 1.05rem;
    margin: 0 0 4px;
}

.app-footer-tagline {
    opacity: 0.8;
    font-size: 0.88rem;
    line-height: 1.7;
    margin: 0;
}

.app-footer-heading {
    font-weight: 800;
    color: var(--gold);
    margin: 0 0 4px;
    font-size: 0.92rem;
}

.app-footer .social-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    justify-content: flex-start;
    gap: 10px;
}

.app-footer .social-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
}

.app-footer-copy {
    text-align: center;
    font-size: 0.82rem;
    opacity: 0.7;
    margin: 0;
}

@media (max-width: 767px) {
    .app-footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .app-footer-col { align-items: center; }
    .app-footer .social-footer { justify-content: center; }
}

.topbar {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 4px 0;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #f5f5f5;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background 0.2s ease, transform 0.15s ease;
}

.btn-logout:hover {
    background: rgba(192, 57, 43, 0.35);
    transform: translateY(-1px);
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.hero {
    text-align: center;
    padding: 30px 10px 40px;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 6px 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.hero p {
    opacity: 0.9;
    font-size: 1.05rem;
}

.hero-sub {
    text-align: center;
    padding-bottom: 24px;
}

.hero-sub h1 {
    font-size: 1.8rem;
}

.breadcrumb {
    font-size: 0.92rem;
    opacity: 0.85;
    margin-bottom: 14px;
}

.breadcrumb a {
    color: var(--gold);
    text-decoration: none;
}

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

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.grid-main {
    max-width: 640px;
    margin: 0 auto;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 26px 16px;
    min-height: 130px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.card-gold {
    background: linear-gradient(135deg, rgba(217, 164, 65, 0.28), rgba(217, 164, 65, 0.12));
    border: 1px solid rgba(217, 164, 65, 0.7);
    animation: cardGoldGlow 2.2s ease-in-out infinite;
}

.card-gold .card-title {
    color: #d9a441;
    font-weight: 800;
}

.card-gold:hover {
    background: linear-gradient(135deg, rgba(217, 164, 65, 0.38), rgba(217, 164, 65, 0.18));
    transform: translateY(-6px);
}

@keyframes cardGoldGlow {
    0%, 100% { box-shadow: 0 0 10px 1px rgba(217, 164, 65, 0.35), 0 8px 20px rgba(0, 0, 0, 0.18); }
    50% { box-shadow: 0 0 26px 6px rgba(217, 164, 65, 0.75), 0 8px 20px rgba(0, 0, 0, 0.18); }
}

.card-main {
    min-height: 170px;
    font-size: 1.15rem;
}

.card-icon {
    font-size: 2.4rem;
}

.card-main .card-icon {
    font-size: 3rem;
}

.card-title {
    font-weight: 700;
}

.empty {
    text-align: center;
    opacity: 0.8;
    padding: 30px 0;
}

.notes-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-family: inherit;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-add {
    background: linear-gradient(135deg, #2e8b57, #3cb371);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #e74c3c);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.link-btn {
    background: none;
    border: none;
    color: #f1a3a3;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.note-card {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 18px 20px;
    backdrop-filter: blur(6px);
}

.note-card h3 { margin: 0 0 6px; }

.note-card h3 a {
    color: #fff;
    text-decoration: none;
}

.note-card h3 a:hover { color: var(--gold); }

.note-snippet {
    opacity: 0.85;
    margin: 0 0 10px;
    line-height: 1.7;
}

.note-actions {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
}

.note-actions a {
    color: #cfe8ff;
    text-decoration: none;
}

.note-actions a:hover { text-decoration: underline; }

.note-actions-page {
    margin-top: 24px;
    gap: 12px;
}

.note-content {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 24px;
    line-height: 1.9;
    font-size: 1.05rem;
    white-space: pre-wrap;
}

.note-content-map {
    white-space: normal;
    background: #f4efe6;
    color: #1a1a1a;
    padding: 18px;
}

.note-content-map svg {
    width: 100%;
    height: auto;
    display: block;
}

.map-title {
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    background: #d9a441;
    color: #1a1a1a;
    padding: 10px 16px;
    border-radius: 10px;
    margin: 0 0 16px;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin-top: 14px;
    font-size: 0.9rem;
    color: #1a1a1a;
}

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

.map-legend-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 24px;
}

.payment-info {
    margin-bottom: 18px;
}

.payment-info summary {
    display: inline-flex;
    cursor: pointer;
    width: fit-content;
    list-style: none;
}

.payment-info summary::-webkit-details-marker {
    display: none;
}

.payment-info-body {
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 20px;
    line-height: 1.9;
}

.payment-info-body img {
    display: block;
    width: 100%;
    max-width: 460px;
    margin: 14px auto;
    border-radius: 10px;
}

.rip-number {
    font-family: ui-monospace, 'Courier New', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    direction: ltr;
    text-align: center;
    background: rgba(217, 164, 65, 0.16);
    border: 1px solid rgba(217, 164, 65, 0.4);
    border-radius: 10px;
    padding: 10px;
    color: var(--gold);
}

.note-form label {
    font-weight: 700;
    margin-top: 8px;
}

.note-form input,
.note-form select,
.note-form textarea {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.quiz-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 22px;
}

.quiz-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(217, 164, 65, 0.14);
    border: 1px solid rgba(217, 164, 65, 0.45);
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.15s ease, background 0.2s ease;
}

.quiz-card:hover {
    background: rgba(217, 164, 65, 0.24);
    transform: translateY(-2px);
}

.quiz-card-locked {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.6);
    cursor: not-allowed;
}

.quiz-card-locked .quiz-cta {
    color: rgba(255, 255, 255, 0.5);
}

html[data-theme="light"] .quiz-card-locked {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: rgba(26, 39, 51, 0.55);
}

html[data-theme="light"] .quiz-card-locked .quiz-cta {
    color: rgba(26, 39, 51, 0.45);
}

.quiz-cta {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.9rem;
}

.quiz-question {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.quiz-question p {
    font-weight: 700;
    margin: 0 0 12px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    display: block;
    width: 100%;
    text-align: right;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.06);
    color: #f5f5f5;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-question.correct {
    border-color: rgba(46, 139, 87, 0.6);
    background: rgba(46, 139, 87, 0.12);
}

.quiz-question.incorrect {
    border-color: rgba(192, 57, 43, 0.6);
    background: rgba(192, 57, 43, 0.12);
}

.quiz-option.is-correct-answer {
    background: rgba(46, 139, 87, 0.3);
    font-weight: 700;
}

.quiz-option.is-wrong-answer {
    background: rgba(192, 57, 43, 0.3);
    font-weight: 700;
}

.quiz-score {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 22px;
    position: sticky;
    top: 8px;
    z-index: 2;
}

.quiz-final {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    background: rgba(46, 139, 87, 0.3);
    border: 1px solid rgba(46, 139, 87, 0.6);
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 22px;
}

.grade-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.grade-box {
    position: relative;
    max-width: 440px;
    width: 100%;
    text-align: center;
    border-radius: 18px;
    padding: 34px 26px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: #16232c;
    color: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.grade-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
    font-family: inherit;
}

.grade-close:hover {
    opacity: 1;
}

.grade-total {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.grade-label {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.grade-msg {
    line-height: 1.7;
    opacity: 0.95;
}

.grade-fail {
    background: rgba(192, 57, 43, 0.18);
    border-color: rgba(192, 57, 43, 0.5);
}

.grade-average {
    background: rgba(217, 164, 65, 0.18);
    border-color: rgba(217, 164, 65, 0.5);
}

.grade-good {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.45);
}

.grade-vgood {
    background: rgba(46, 139, 87, 0.18);
    border-color: rgba(46, 139, 87, 0.5);
}

.grade-excellent {
    background: rgba(217, 164, 65, 0.28);
    border-color: rgba(217, 164, 65, 0.7);
}

.grade-perfect {
    background: linear-gradient(135deg, rgba(217, 164, 65, 0.35), rgba(46, 139, 87, 0.25));
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(217, 164, 65, 0.5);
    animation: gradePulse 1.6s ease-in-out infinite;
}

@keyframes gradePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.admin-page, .admin-page * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

.admin-page h2 {
    margin: 30px 0 14px;
    font-size: 1.2rem;
    color: var(--gold);
}

.table-wrap {
    overflow-x: auto;
    margin-bottom: 10px;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.stat-tile {
    flex: 1;
    min-width: 130px;
    background: rgba(217, 164, 65, 0.12);
    border: 1px solid rgba(217, 164, 65, 0.35);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.85rem;
    color: #d8d8d8;
}

.mini-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 130px;
    padding: 14px 10px 0;
    margin-bottom: 26px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
}

.mini-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}

.mini-chart-bar {
    width: 100%;
    max-width: 34px;
    min-height: 4px;
    background: linear-gradient(180deg, var(--gold-soft, #e8c27a), var(--gold));
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.mini-chart-count {
    position: absolute;
    top: -20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.mini-chart-label {
    font-size: 0.72rem;
    color: #b8b8b8;
    direction: ltr;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    font-size: 0.92rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    white-space: nowrap;
}

.admin-table th {
    background: rgba(217, 164, 65, 0.25);
    font-weight: 700;
}

.admin-table code {
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: monospace;
}

.social-footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    font-size: 1.3rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.social-icon:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.social-facebook { background: #1877f2; }
.social-instagram { background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.social-telegram { background: #26a5e4; }
.social-whatsapp { background: #25d366; }
.social-youtube { background: #ff0000; }

.locked-box {
    max-width: 460px;
    margin: 20px auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(217, 164, 65, 0.45);
    border-radius: 18px;
    padding: 32px 26px;
    backdrop-filter: blur(8px);
}

.locked-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--gold);
}

.locked-text {
    opacity: 0.9;
    margin: 0 0 18px;
    line-height: 1.7;
}

.unlock-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.unlock-form label {
    font-weight: 700;
}

.unlock-form input {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.92);
    color: #1a1a1a;
    font-family: inherit;
    font-size: 1rem;
    text-align: center;
}

.error {
    background: rgba(192, 57, 43, 0.25);
    border: 1px solid rgba(192, 57, 43, 0.5);
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.7rem; }
    .card { min-height: 110px; padding: 20px 12px; }
}

/* ===== Light mode ===== */
html[data-theme="light"] body {
    background:
        radial-gradient(circle at 15% 10%, rgba(217, 164, 65, 0.16), transparent 35%),
        radial-gradient(circle at 85% 90%, rgba(45, 90, 120, 0.10), transparent 40%),
        linear-gradient(135deg, #f7f4ee 0%, #eef2f5 45%, #e3e9ed 75%, #eef6f5 100%);
}

html[data-theme="light"] body::before {
    background-image: radial-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px);
}

html[data-theme="light"] html,
html[data-theme="light"] body {
    color: #1a2733;
}

html[data-theme="light"] .hero h1 {
    text-shadow: none;
}

html[data-theme="light"] .btn-back,
html[data-theme="light"] .btn-logout,
html[data-theme="light"] .theme-toggle,
html[data-theme="light"] .btn-cancel {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: #1a2733;
}

html[data-theme="light"] .btn-back:hover,
html[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .btn-logout:hover {
    background: rgba(192, 57, 43, 0.18);
}

html[data-theme="light"] .card,
html[data-theme="light"] .note-card,
html[data-theme="light"] .note-content,
html[data-theme="light"] .note-form,
html[data-theme="light"] .quiz-question,
html[data-theme="light"] .locked-box,
html[data-theme="light"] .admin-table {
    background: rgba(0, 0, 0, 0.035);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a2733;
}

html[data-theme="light"] .card:hover {
    background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .card,
html[data-theme="light"] .note-card h3 a,
html[data-theme="light"] .quiz-card {
    color: #1a2733;
}

html[data-theme="light"] .note-actions a {
    color: #1565c0;
}

html[data-theme="light"] .link-btn {
    color: #c0392b;
}

html[data-theme="light"] .quiz-option {
    background: rgba(0, 0, 0, 0.035);
    color: #1a2733;
}

html[data-theme="light"] .quiz-option:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .quiz-card {
    background: rgba(217, 164, 65, 0.16);
}

html[data-theme="light"] .quiz-final {
    color: #1a2733;
}

html[data-theme="light"] .admin-table th,
html[data-theme="light"] .admin-table td {
    border-bottom-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .admin-table code {
    background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .social-footer {
    border-top-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .quiz-option.is-correct-answer {
    background: #2e8b57;
    color: #ffffff;
}

html[data-theme="light"] .quiz-option.is-wrong-answer {
    background: #c0392b;
    color: #ffffff;
}

html[data-theme="light"] .quiz-question.correct {
    background: rgba(46, 139, 87, 0.14);
    border-color: rgba(46, 139, 87, 0.6);
}

html[data-theme="light"] .quiz-question.incorrect {
    background: rgba(192, 57, 43, 0.14);
    border-color: rgba(192, 57, 43, 0.6);
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .app-topbar-mobile {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .sidebar-brand,
html[data-theme="light"] .sidebar-link,
html[data-theme="light"] .app-topbar-mobile-brand {
    color: #1a2733;
}

html[data-theme="light"] .sidebar-link:hover {
    background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .sidebar-link.active {
    background: rgba(217, 164, 65, 0.22);
    color: #8a6111;
}

html[data-theme="light"] .sidebar-collapse-btn,
html[data-theme="light"] .sidebar-close-btn,
html[data-theme="light"] .hamburger-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .hamburger-btn span {
    background: #1a2733;
}

html[data-theme="light"] .app-footer {
    border-top-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .app-footer-col a {
    color: #1565c0;
}
