/* المنصة التعليمية — الأنماط الأساسية (مشتركة). ثيم الواجهة الذكية والنجوم: smart-app.css */

* { box-sizing: border-box; }

:root {
    --font-sans: "Cairo", system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
    --page-bg: #e8ecf3;
    --page-bg-gradient: linear-gradient(165deg, #f3f0ff 0%, #e8f0ff 40%, #eef2f8 100%);
    --text: #1a1d26;
    --text-muted: #5c6370;
    --card-bg-solid: #ffffff;
    --card-border: rgba(99, 102, 241, 0.1);
    --card-inner: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --header-bg: rgba(255, 255, 255, 0.94);
    --header-border: rgba(99, 102, 241, 0.1);
    --link: #3949ab;
    --link-hover: #5c6bc0;
    --accent: #6c4ecf;
    --accent-2: #00897b;
    --accent-soft: rgba(108, 78, 207, 0.14);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --shadow-sm: 0 2px 10px rgba(55, 40, 100, 0.06);
    --shadow-md: 0 6px 22px rgba(55, 40, 100, 0.09);
    --shadow-card-hover: 0 16px 40px rgba(40, 30, 90, 0.14);
    --input-bg: #fff;
    --input-border: rgba(0, 0, 0, 0.12);
    --star-dots: rgba(108, 78, 207, 0.18);
    --divider: rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
    --page-bg: #0b0d12;
    --page-bg-gradient: linear-gradient(165deg, #14182a 0%, #0b0d12 55%, #101218 100%);
    --text: #e8eaef;
    --text-muted: #9aa3b8;
    --card-bg-solid: #16181f;
    --card-border: rgba(179, 136, 255, 0.12);
    --card-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --header-bg: rgba(18, 20, 28, 0.92);
    --header-border: rgba(179, 136, 255, 0.1);
    --link: #90caf9;
    --link-hover: #b3e5fc;
    --accent: #b388ff;
    --accent-2: #4db6ac;
    --accent-soft: rgba(179, 136, 255, 0.16);
    --shadow-sm: 0 2px 14px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 20px 48px rgba(0, 0, 0, 0.45);
    --input-bg: #1e2128;
    --input-border: rgba(255, 255, 255, 0.1);
    --star-dots: rgba(200, 210, 255, 0.12);
    --divider: rgba(255, 255, 255, 0.08);
}

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    font-size: 1.02rem;
    background: var(--page-bg);
    background-image: var(--page-bg-gradient);
    color: var(--text);
    margin: 0;
    line-height: 1.58;
    min-height: 100vh;
    position: relative;
}

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

h1 {
    margin-top: 0;
    font-weight: 800;
    font-size: clamp(1.45rem, 4vw, 1.85rem);
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: var(--text);
}

h2 {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}


.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 32px);
    position: relative;
    z-index: 1;
}
.container--wide {
    max-width: 1520px;
}

/* تنبيه المهام */
.reminder-banner {
    position: relative;
    z-index: 90;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.12));
    border-bottom: 1px solid rgba(255, 152, 0, 0.35);
    padding: 10px 0;
    font-size: 0.92rem;
    color: var(--text);
}
.reminder-banner a { color: #b45309; font-weight: 700; text-decoration: none; }
.reminder-banner a:hover { text-decoration: underline; }

html[data-theme="dark"] .reminder-banner {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.12), rgba(255, 152, 0, 0.06));
    border-bottom-color: rgba(255, 193, 7, 0.25);
}
html[data-theme="dark"] .reminder-banner a { color: #ffd54f; }

/* الهيدر: شريط واحد — بدون backdrop-filter (يقلّل جداً من تكلفة الرسم عند التمرير) */
.site-header {
    position: relative;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    padding: 0;
    box-shadow: var(--shadow-sm);
}
.site-header__bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px 12px;
    padding-top: 11px;
    padding-bottom: 11px;
}
.site-header__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: var(--radius-pill);
    border: 1px solid var(--card-border);
    background: var(--card-bg-solid);
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.site-header__icon-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(108, 78, 207, 0.28);
}
.site-header__icon-btn svg {
    display: block;
    flex-shrink: 0;
}
.site-header__nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px 4px;
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 0;
}
.site-header__nav--primary {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to left, transparent, #000 16px);
}
.site-header__nav--primary::-webkit-scrollbar {
    display: none;
    height: 0;
}
.site-header__icon-btn--search {
    flex-shrink: 0;
    margin-inline-start: auto;
}
.site-header__nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.8rem;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}
.site-header__nav a:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.logo {
    font-weight: 800;
    font-size: 1.22rem;
    letter-spacing: -0.03em;
    text-decoration: none;
    background: linear-gradient(120deg, var(--accent) 0%, #5c6bc0 45%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    margin-inline-end: 4px;
}
.logo:hover {
    opacity: 0.88;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card-bg-solid);
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    vertical-align: middle;
}
.theme-toggle:hover {
    transform: scale(1.06);
    box-shadow: var(--shadow-sm);
}
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
html[data-theme="light"] .theme-toggle::before { content: "🌙"; }
html[data-theme="dark"] .theme-toggle::before { content: "☀"; }

.btn-login {
    background: linear-gradient(135deg, #7c4dff 0%, #5c6bc0 50%, #3949ab 100%);
    color: #fff !important;
    padding: 8px 16px;
    text-decoration: none;
    margin: 0;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(92, 107, 192, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(92, 107, 192, 0.45);
}

/* نماذج شريط التنقل (بحث + خروج) — لوحة الإدارة وغيرها */
.main-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
}
.main-nav a:not(.btn-login) {
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s ease, background 0.2s ease;
}
.main-nav a:not(.btn-login):hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.site-header > .container:not(.site-header__bar) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 12px;
    padding-bottom: 10px;
}
.nav-search-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}
.nav-search-input {
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav-inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0 8px 0 0;
    vertical-align: middle;
}
.main-nav .btn-nav-logout {
    background: var(--input-bg);
    color: #c62828;
    border: 1px solid rgba(229, 115, 115, 0.55);
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    margin: 0;
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.main-nav .btn-nav-logout:hover {
    background: #ffebee;
    border-color: #c62828;
}
html[data-theme="dark"] .main-nav .btn-nav-logout:hover {
    background: rgba(198, 40, 40, 0.15);
}
.main-nav .btn-nav-logout:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

html[data-theme="dark"] .nav-search-input {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--input-border);
}
html[data-theme="dark"] .main-nav .btn-nav-logout {
    background: var(--input-bg);
    color: #ffcdd2;
    border-color: #c62828;
}
html[data-theme="dark"] .main-nav .btn-nav-logout:hover {
    background: #3e2723;
}

/* المحتوى الرئيسي */
.main-content {
    padding: 22px 0 32px;
    min-height: 52vh;
    position: relative;
    z-index: 1;
}

/* البطاقات والنصوص */
.card {
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    padding: 18px 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), var(--card-inner);
}
.card h2, .card h3 { margin-top: 0; }

/* شبكة الملازم والكتب */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}
.grid-item {
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    overflow: hidden;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm), var(--card-inner);
    transition: transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.28s ease;
    transform-origin: 50% 100%;
}
a.grid-item:hover {
    transform: translateY(-7px) scale(1.025);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(108, 78, 207, 0.25);
}
a.grid-item:active {
    transform: translateY(-4px) scale(1.015);
}
.grid-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}
.grid-item .info { padding: 12px 12px 14px; }
.grid-item .title { font-weight: 700; margin: 0 0 6px 0; font-size: 0.95rem; line-height: 1.35; }
.grid-item .meta { font-size: 0.85rem; color: var(--text-muted); }
.grid-item-cover--empty {
    height: 180px;
    background: linear-gradient(145deg, var(--accent-soft), rgba(0, 0, 0, 0.04)) !important;
    color: var(--text-muted) !important;
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 18px;
    text-decoration: none;
    margin-top: 8px;
    border-radius: 999px;
    font-weight: 600;
    background: linear-gradient(135deg, #7c4dff, #5c6bc0);
    color: #fff !important;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.35s ease;
    position: relative;
    overflow: hidden;
}
.download-link:hover {
    box-shadow: 0 6px 20px rgba(124, 77, 255, 0.35);
    transform: translateY(-1px);
}
.download-link.download-link--action.is-shake {
    animation: btn-shake 0.45s ease;
}
.download-link.download-link--action.is-loading {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
    pointer-events: none;
    color: #fff !important;
}
.download-link.download-link--action.is-loading::after {
    content: "";
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-inline-start: 6px;
}
.download-link.download-link--action.is-success {
    background: linear-gradient(135deg, #43a047, #2e7d32) !important;
    pointer-events: none;
}

@keyframes btn-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    a.grid-item:hover {
        transform: none;
    }
    .download-link.download-link--action.is-shake {
        animation: none;
    }
}

/* التقييم */
.rating { color: var(--text-muted); }
.rating-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--divider); }
.rating-form label { margin-left: 8px; cursor: pointer; }
.rating-form button { margin-right: 8px; }

/* ادرس معي */
.pomodoro-box {
    text-align: center;
    padding: 22px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 400px;
    margin: 0 auto 15px;
}
.pomodoro-box--featured {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: clamp(22px, 4vw, 36px) clamp(18px, 3vw, 28px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md), var(--card-inner);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
.pomodoro-timer {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 15px 0;
    color: var(--accent);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.pomodoro-box--featured .pomodoro-timer {
    font-size: clamp(3.25rem, 12vw, 5.5rem);
    line-height: 1.05;
    margin: 0 0 4px;
    background: linear-gradient(120deg, var(--accent) 0%, #5c6bc0 45%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.pomodoro-quote-inner {
    margin: 14px 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    border: 1px solid var(--card-border);
    text-align: center;
}
.pomodoro-quote-tag {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 8px;
    opacity: 0.88;
}
.pomodoro-box--featured .study-quote-text {
    margin: 0;
    font-size: clamp(0.95rem, 2.4vw, 1.12rem);
    font-weight: 600;
    font-style: normal;
    line-height: 1.65;
    color: var(--text);
}
.pomodoro-points-inner {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--divider);
}
html[data-theme="dark"] .pomodoro-points-inner {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}
.pomodoro-points-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.pomodoro-points-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
}
.pomodoro-points-value {
    font-size: clamp(1.35rem, 4vw, 1.75rem);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}
.pomodoro-points-value strong {
    font-weight: 800;
}
.pomodoro-points-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 12px;
}
.pomodoro-share-btn {
    padding: 7px 16px;
    font-size: 0.82rem;
}
.pomodoro-points-hint {
    font-size: 0.8rem;
    margin: 0;
}
.pomodoro-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.pomodoro-options { margin-bottom: 15px; }
.pomodoro-options button {
    padding: 8px 16px;
    margin: 0 5px;
    cursor: pointer;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.pomodoro-options button.active {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.35);
}
.quote-box { margin-top: 15px; padding: 14px; background: var(--accent-soft); color: var(--text-muted); font-style: italic; border-radius: var(--radius-sm); border: 1px solid var(--card-border); }
.presence-count { font-size: 0.9rem; color: var(--text-muted); }
.btn-share {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.3);
}
.btn-share:hover { filter: brightness(1.08); }

/* الأسئلة اليومية */
.question-card { margin-bottom: 15px; }
.question-card .answer {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(46, 125, 50, 0.12);
    border: 1px solid rgba(46, 125, 50, 0.2);
    border-radius: var(--radius-sm);
    display: none;
}
html[data-theme="dark"] .question-card .answer {
    background: rgba(129, 199, 132, 0.1);
    border-color: rgba(129, 199, 132, 0.2);
}
.question-card .answer.show { display: block; }
.btn-show-answer {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    border: none;
    padding: 8px 18px;
    cursor: pointer;
    margin-top: 8px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.3);
}
.btn-show-answer:hover { filter: brightness(1.06); }

/* المهام والمذكرات — تفاصيل القائمة في قسم «مهامي» أدناه */
.note-date { font-size: 0.85rem; color: var(--text-muted); }

/* التعليقات */
.comments-list { margin-top: 15px; }
.comment {
    padding: 12px 14px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}
.comment .author { font-weight: 700; margin-bottom: 4px; }
.comment-actions { font-size: 0.85rem; color: var(--text-muted); margin-top: 5px; }
.comment-actions a { color: var(--link); text-decoration: none; }

/* الفوتر */
.site-footer {
    position: relative;
    z-index: 1;
    margin-top: 48px;
    background: var(--header-bg);
    border-top: 1px solid var(--header-border);
    box-shadow: 0 -4px 24px rgba(55, 40, 100, 0.06);
}
html[data-theme="dark"] .site-footer {
    box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.35);
}
.site-footer__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr));
    gap: 28px 24px;
    padding: 28px 18px 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .site-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .site-footer__brand {
        grid-column: 1 / -1;
    }
}
@media (max-width: 520px) {
    .site-footer__grid {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 24px 16px 20px;
    }
}
.site-footer__brand {
    padding-inline-end: 12px;
}
.site-footer__logo {
    display: inline-block;
    font-weight: 800;
    font-size: 1.2rem;
    text-decoration: none;
    background: linear-gradient(120deg, var(--accent) 0%, #5c6bc0 50%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    margin: 0 0 10px;
}
.site-footer__tagline {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
    max-width: 28em;
}
.site-footer__heading {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
}
.site-footer__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.site-footer__list a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.94rem;
    font-weight: 600;
    padding: 4px 0;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, padding 0.2s ease;
}
.site-footer__list a:hover {
    color: var(--link);
    padding-inline-start: 4px;
}
.site-footer__bottom {
    border-top: 1px solid var(--divider);
    background: rgba(0, 0, 0, 0.02);
}
html[data-theme="dark"] .site-footer__bottom {
    background: rgba(0, 0, 0, 0.2);
}
.site-footer__bottom-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px 20px;
    padding: 16px 18px 20px;
    text-align: center;
}
.theme-toggle--footer {
    flex-shrink: 0;
}
.copyright {
    margin: 0;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1 1 200px;
    min-width: 0;
}

/* الرئيسية - روابط سريعة */
.home-quick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 14px;
}
.home-quick-item {
    display: block;
    padding: 18px 14px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius-md);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.2s ease;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm), var(--card-inner);
    position: relative;
    overflow: hidden;
}
.home-quick-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: linear-gradient(90deg, var(--accent), #5c6bc0);
    opacity: 0.9;
}
.home-quick-item:nth-child(4n+2)::before {
    background: linear-gradient(90deg, #5c6bc0, var(--accent-2));
}
.home-quick-item:nth-child(4n+3)::before {
    background: linear-gradient(90deg, var(--accent-2), #7c4dff);
}
.home-quick-item:nth-child(4n+4)::before {
    background: linear-gradient(90deg, #ff9800, #7c4dff);
}
.home-quick-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(108, 78, 207, 0.24);
}
.home-quick-title { display: block; font-weight: 700; margin-bottom: 6px; font-size: 1rem; }
.home-quick-desc { display: block; font-size: 0.85rem; color: var(--text-muted); }

/* صفحات اختيار المنهج */
.choose-card { text-align: center; max-width: 480px; margin: 20px auto; }
.choose-card h1 { margin-bottom: 10px; }
.choose-card p { color: var(--text-muted); margin-bottom: 20px; }
.choose-buttons { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.choose-btn {
    display: inline-block;
    background: linear-gradient(135deg, #6c4ecf 0%, #5c6bc0 100%);
    color: #fff !important;
    padding: 14px 32px;
    text-decoration: none;
    border-radius: var(--radius-pill);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(92, 107, 192, 0.28);
    transition: transform 0.15s ease, filter 0.15s ease;
}
.choose-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* صفحات ثابتة */
p a { color: var(--link); text-decoration: none; }
p a:hover { text-decoration: underline; }
ul { padding-right: 20px; }
input[type="text"], input[type="date"], textarea, select {
    padding: 8px 12px;
    margin: 4px 0;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
button {
    padding: 8px 16px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}
button:not(.theme-toggle):hover { background: var(--accent-soft); border-color: rgba(124, 77, 255, 0.25); }

/* رسائل الإدارة */
.flash-message {
    border: 1px solid var(--card-border);
    background: var(--card-bg-solid);
    padding: 12px 16px;
    margin: 0 0 12px 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.flash-success { border-color: #c8e6c9; background: #edf7ee; color: #1b5e20; }
.flash-error { border-color: #ffcdd2; background: #ffebee; color: #b71c1c; }
.flash-info { border-color: #bbdefb; background: #e3f2fd; color: #0d47a1; }

html[data-theme="dark"] .flash-success {
    border-color: #2e7d32;
    background: #1b2e1f;
    color: #c8e6c9;
}
html[data-theme="dark"] .flash-error {
    border-color: #c62828;
    background: #2e1a1a;
    color: #ffcdd2;
}
html[data-theme="dark"] .flash-info {
    border-color: #1565c0;
    background: #0d1f2e;
    color: #bbdefb;
}

.settings-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 8px;
}

/* صفحة البحث */
.search-page-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.search-page-input {
    flex: 1;
    min-width: 200px;
    max-width: 500px;
    padding: 10px 14px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius-pill);
    background: var(--input-bg);
    color: var(--text);
}
.search-page-form button[type="submit"],
.search-page-submit {
    padding: 12px 26px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-family: inherit;
    background: linear-gradient(135deg, #ec4899 0%, #a855f7 50%, #6366f1 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 18px rgba(168, 85, 247, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.search-page-form button[type="submit"]:hover,
.search-page-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.search-result-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.search-result-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--divider);
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-type {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: bold;
    background: #e3f2fd;
    color: #0d47a1;
    padding: 2px 8px;
    border-radius: 3px;
    margin-inline-start: 8px;
    vertical-align: middle;
}
.search-result-item > a {
    font-weight: 600;
    vertical-align: middle;
}
.search-result-meta {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
}
html[data-theme="dark"] .search-result-meta {
    color: var(--text-muted);
}
html[data-theme="dark"] .search-result-type {
    background: #1a237e;
    color: #e8eaf6;
}
html[data-theme="dark"] .search-page-input {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--input-border);
}

/* ——— الرئيسية ——— */
.home-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-bottom: 8px;
}
.home-quick-section {
    margin-top: 4px;
}
.home-quick-heading {
    font-size: 1.08rem;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--text);
}
.home-badge-demo {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    vertical-align: middle;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent);
    margin-inline-start: 8px;
}

.home-hero {
    text-align: center;
    padding: 28px 22px 34px;
    margin-bottom: 20px;
    border-radius: var(--radius-lg);
    background: linear-gradient(165deg, var(--card-bg-solid) 0%, rgba(245, 242, 255, 0.97) 100%);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-md), var(--card-inner);
    position: relative;
    overflow: hidden;
}
html[data-theme="dark"] .home-hero {
    background: linear-gradient(165deg, var(--card-bg-solid) 0%, rgba(28, 26, 42, 0.88) 100%);
}
.home-hero::after {
    content: "";
    position: absolute;
    top: -35%;
    left: 50%;
    transform: translateX(-50%);
    width: 110%;
    height: 70%;
    background: radial-gradient(ellipse at center, var(--accent-soft), transparent 68%);
    pointer-events: none;
    z-index: 0;
}
.home-hero-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.88;
    z-index: 0;
}
.home-float-icon {
    position: absolute;
    font-size: 1.65rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.08));
}
.home-float-icon--atom { top: 12%; left: 8%; animation: icon-spin 22s linear infinite; }
.home-float-icon--flask { top: 18%; right: 10%; animation: icon-pulse 3s ease-in-out infinite; }
.home-float-icon--book { bottom: 14%; left: 14%; animation: icon-float 3.5s ease-in-out infinite; }
.home-float-icon--calc { bottom: 20%; right: 12%; animation: icon-spin 28s linear infinite reverse; }
@keyframes icon-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes icon-pulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}
@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .home-float-icon--atom,
    .home-float-icon--flask,
    .home-float-icon--book,
    .home-float-icon--calc {
        animation: none;
    }
}

.home-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(1.5rem, 4vw, 1.95rem);
    font-weight: 800;
    position: relative;
    z-index: 1;
    background: linear-gradient(115deg, var(--accent) 0%, #5c6bc0 42%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.home-hero .home-lead {
    color: var(--text-muted);
    margin: 0 0 22px;
    position: relative;
    z-index: 1;
    font-size: 1.05rem;
    max-width: 32em;
    margin-left: auto;
    margin-right: auto;
}
.home-hero-cta-wrap {
    margin: 0;
    position: relative;
    z-index: 1;
}
.home-hero .download-link {
    position: relative;
    z-index: 1;
    margin-top: 0;
    padding: 10px 24px;
    font-size: 1rem;
    box-shadow: 0 6px 20px rgba(92, 107, 192, 0.28);
}

.home-progress-card {
    margin-bottom: 22px;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm), var(--card-inner);
}
.home-progress-card h2 {
    margin: 0 0 12px;
    font-size: 1.02rem;
    color: var(--text);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.home-progress-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
}
html[data-theme="dark"] .home-progress-track {
    background: rgba(255, 255, 255, 0.08);
}
.home-progress-fill {
    height: 100%;
    width: 0;
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff9800, #6c4ecf, #00897b);
    box-shadow: 0 0 10px rgba(108, 78, 207, 0.35);
    transition: width 0.88s cubic-bezier(0.33, 1, 0.68, 1);
}
.home-progress-fill.is-animated {
    width: var(--progress-pct, 72%);
}
.home-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.home-progress-value {
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-size: 1.15rem;
}

/* ——— تصفح: رأس الصفحة، مسار، طبقات الصفوف، خطوات الوزاري ——— */
.browse-page {
    max-width: 1520px;
}
.page-head {
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}
.page-head__title {
    margin: 0 0 6px;
    font-size: clamp(1.35rem, 3.5vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.page-head__subtitle {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 1rem;
}
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-size: 0.92rem;
    line-height: 1.45;
}
.breadcrumb a {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 2px 4px;
    margin: -2px -4px;
}
.breadcrumb a:hover {
    color: var(--link-hover);
    background: var(--accent-soft);
}
.breadcrumb__sep {
    color: var(--text-muted);
    user-select: none;
    font-weight: 400;
}
.breadcrumb--toolbar {
    padding: 10px 14px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.grade-tier {
    margin-bottom: 28px;
}
.grade-tier__head {
    margin-bottom: 14px;
}
.grade-tier__title {
    margin: 0 0 4px;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text);
}
.grade-tier__subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.grade-tier--compact .grade-tier__title {
    font-size: 1.02rem;
}
.grade-tier--compact {
    margin-bottom: 18px;
}
.grade-tier--compact:last-child {
    margin-bottom: 0;
}

.grid--grades {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}
.grid--subjects {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.grid--years {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.grid--files {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.grid-item--grade {
    display: flex;
    align-items: stretch;
    gap: 0;
    text-decoration: none;
    color: inherit;
    min-height: 72px;
}
.grid-item--subject {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    text-align: start;
    min-height: 76px;
}
.grid-item--subject .grid-item__badge {
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    background: linear-gradient(160deg, var(--accent-soft), rgba(92, 107, 192, 0.1));
    color: var(--accent);
    border-inline-end: 1px solid var(--card-border);
}
.grid-item--subject .info {
    flex: 1;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.grid-item--grade .grid-item__badge {
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.15rem;
    background: linear-gradient(160deg, var(--accent-soft), rgba(92, 107, 192, 0.12));
    color: var(--accent);
    border-inline-end: 1px solid var(--card-border);
}
.grid-item--ministerial .grid-item__badge {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}
.grid-item--grade .info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 14px;
}
.grid-item--year {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    min-height: 76px;
    justify-content: center;
    padding: 12px 14px;
}
.grid-item--file {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    min-height: 76px;
}
.grid-item--file .info {
    padding: 0;
    flex: 1;
    min-width: 0;
}
.grid-item__file-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.grid-item.is-current {
    border-color: rgba(108, 78, 207, 0.45);
    box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-sm);
}

.flow-steps {
    list-style: none;
    margin: 0 0 22px;
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    counter-reset: none;
}
.flow-steps__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: var(--radius-pill);
    background: transparent;
}
.flow-steps__item.is-done {
    color: var(--accent-2);
}
.flow-steps__item.is-active {
    color: var(--text);
    background: var(--accent-soft);
}
.flow-steps__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
    background: var(--divider);
    color: var(--text-muted);
}
.flow-steps__item.is-active .flow-steps__num {
    background: linear-gradient(135deg, var(--accent), #5c6bc0);
    color: #fff;
}
.flow-steps__item.is-done .flow-steps__num {
    background: rgba(0, 137, 123, 0.2);
    color: var(--accent-2);
}

.flow-panel {
    margin-bottom: 18px;
}
.flow-panel__title {
    margin: 0 0 14px;
    font-size: 1.05rem;
    font-weight: 800;
}
.flow-panel__empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}
.ministerial-flow .flow-panel:first-of-type .flow-panel__title {
    margin-top: 0;
}

/* تفاصيل الملزمة / الكتاب */
.detail-page {
    max-width: 920px;
}
.card--detail {
    overflow: hidden;
}
.detail-card__grid {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 22px 28px;
    align-items: start;
}
@media (max-width: 640px) {
    .detail-card__grid {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
    .detail-meta-list {
        text-align: start;
    }
}
.detail-card__media {
    position: relative;
}
.detail-cover-img {
    width: 100%;
    max-width: 240px;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: block;
}
.detail-cover-placeholder {
    width: 100%;
    max-width: 240px;
    aspect-ratio: 10 / 13;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(145deg, var(--accent-soft), rgba(0, 0, 0, 0.04));
    border-radius: var(--radius-md);
    border: 1px dashed var(--card-border);
}
.detail-card__title {
    margin: 0 0 12px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    line-height: 1.3;
}
.detail-meta-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    font-size: 0.95rem;
}
.detail-meta-list li {
    margin-bottom: 6px;
}
.detail-meta-label {
    color: var(--text-muted);
    font-weight: 600;
    margin-inline-end: 6px;
}
.detail-rating-block {
    margin-bottom: 14px;
}
.detail-description {
    font-size: 0.98rem;
    color: var(--text);
    line-height: 1.65;
    margin-bottom: 16px;
}

/* نجوم التقييم */
.rating-stars-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}
.rating-stars-wrap--compact {
    gap: 6px 8px;
}
.rating-stars-row {
    display: inline-flex;
    gap: 3px;
    line-height: 1;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
}
.rating-stars-wrap--compact .rating-stars-row {
    font-size: 1.05rem;
    gap: 2px;
}
.rating-star {
    display: inline-block;
    transition: transform 0.15s ease;
}
.rating-star--on {
    color: #ffb300;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.rating-star--off {
    color: var(--divider);
    opacity: 0.65;
}
html[data-theme="dark"] .rating-star--off {
    opacity: 0.5;
}
.rating-stars-label {
    font-size: 0.92rem;
    color: var(--text-muted);
}
.rating-stars-wrap--compact .rating-stars-label {
    font-size: 0.82rem;
}
.rating-stars-label strong {
    color: var(--text);
    font-weight: 800;
}
.rating-stars-count {
    font-weight: 600;
}

.rating-fieldset {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 14px 16px 16px;
    margin: 0;
    background: rgba(108, 78, 207, 0.04);
}
html[data-theme="dark"] .rating-fieldset {
    background: rgba(179, 136, 255, 0.06);
}
.rating-fieldset__legend {
    font-weight: 800;
    padding: 0 8px;
    font-size: 0.95rem;
}
.rating-stars-input {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 4px;
    margin: 10px 0 12px;
}
.rating-star-label {
    cursor: pointer;
    position: relative;
    padding: 4px;
    line-height: 1;
}
.rating-star-label input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.rating-star-skin {
    font-size: 1.75rem;
    color: var(--divider);
    transition: color 0.15s ease, transform 0.15s ease;
    display: block;
}
.rating-star-label:hover .rating-star-skin,
.rating-star-label input:focus + .rating-star-skin {
    color: #ffb74d;
    transform: scale(1.08);
}
/* ترتيب DOM: 5→1 مع row-reverse فيظهر 1→5؛ عند اختيار نجمة تُلوَّن هي والنجوم «أعلى» منها بصرياً */
.rating-stars-input .rating-star-label input:checked + .rating-star-skin,
.rating-stars-input .rating-star-label:has(~ .rating-star-label input:checked) .rating-star-skin {
    color: #ffb300;
}
.btn-rating-save {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: none;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    box-shadow: 0 4px 14px rgba(57, 73, 171, 0.3);
}
.btn-rating-save:hover {
    filter: brightness(1.06);
}

/* شريط ترتيب وترقيم */
.sort-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 16px;
}
.sort-toolbar__label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
}
.sort-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sort-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sort-pill:hover {
    color: var(--accent);
    border-color: rgba(108, 78, 207, 0.35);
    background: var(--accent-soft);
}
.sort-pill.is-active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #5c6bc0);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(108, 78, 207, 0.25);
}
.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
}
.pagination-bar__links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.pagination-bar__links a {
    font-weight: 700;
    color: var(--link);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--card-border);
    background: var(--input-bg);
}
.pagination-bar__links a:hover {
    background: var(--accent-soft);
    border-color: rgba(108, 78, 207, 0.3);
}

.card--notice {
    border-color: rgba(255, 152, 0, 0.35);
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08), transparent);
}

/* إعدادات */
.settings-page {
    max-width: 720px;
}
.settings-intro {
    color: var(--text-muted);
    margin: 0 0 20px;
    line-height: 1.6;
}
.settings-grid {
    display: grid;
    gap: 16px;
}
@media (min-width: 600px) {
    .settings-grid--two {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}
.settings-field {
    margin: 0;
}
.settings-field label {
    display: block;
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 8px;
    color: var(--text);
}
.settings-field select {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
}
.settings-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.5;
}
.settings-checkbox input {
    margin-top: 4px;
    flex-shrink: 0;
}
.settings-actions {
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--divider);
}
.settings-actions button[type="submit"] {
    padding: 12px 28px;
    border-radius: var(--radius-pill);
    border: none;
    font-family: inherit;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #5c6bc0);
    color: #fff;
    box-shadow: 0 6px 18px rgba(108, 78, 207, 0.28);
}
.settings-actions button[type="submit"]:hover {
    filter: brightness(1.05);
}
.settings-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 12px 0 0;
    line-height: 1.5;
}
.settings-account-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin: 12px 0 0;
}
.settings-account-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    font-size: 0.92rem;
    text-decoration: none;
    border: 1px solid var(--card-border);
    background: var(--accent-soft);
    color: var(--accent);
    transition: filter 0.2s ease, transform 0.15s ease;
}
.settings-account-link:hover {
    filter: brightness(0.97);
    transform: translateY(-1px);
}
.settings-account-link--admin {
    border-color: rgba(255, 152, 0, 0.4);
    color: #e65100;
    background: rgba(255, 152, 0, 0.1);
}
html[data-theme="dark"] .settings-account-link--admin {
    color: #ffb74d;
}
.settings-logout-form {
    display: inline;
    margin: 0;
}
.btn-settings-logout {
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(229, 115, 115, 0.55);
    background: var(--input-bg);
    color: #c62828;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
}
.btn-settings-logout:hover {
    background: #ffebee;
}
html[data-theme="dark"] .btn-settings-logout:hover {
    background: rgba(198, 40, 40, 0.15);
}
.settings-google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-weight: 800;
    text-decoration: none;
    background: linear-gradient(135deg, #7c4dff 0%, #5c6bc0 50%, #3949ab 100%);
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(92, 107, 192, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.settings-google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(92, 107, 192, 0.45);
}
.stats-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}
.stats-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}
.stats-list strong {
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

/* ادرس معي — عمود رئيسي + دردشة بث جانبية */
.study-page {
    max-width: none;
}
.study-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px 22px;
    align-items: start;
}
@media (max-width: 960px) {
    .study-layout {
        grid-template-columns: 1fr;
    }
    .study-layout__main {
        order: 1;
    }
    .study-layout__chat {
        order: 2;
    }
}
@media (min-width: 961px) {
    .study-layout__chat {
        position: sticky;
        top: 12px;
        max-height: calc(100vh - 24px);
    }
}
.study-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 16px 18px;
    margin-bottom: 16px;
    align-items: stretch;
}
.study-hero--focus {
    display: block;
    max-width: 580px;
    margin: 0 auto 20px;
    width: 100%;
}
@media (max-width: 720px) {
    .study-hero:not(.study-hero--focus) {
        grid-template-columns: 1fr;
    }
}
.study-timer-card {
    text-align: center;
}
.study-timer-card .pomodoro-box--featured {
    min-height: 0;
}
.study-timer-hint {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.study-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}
.study-quote-text {
    transition: opacity 0.28s ease;
}
.study-quote-text.is-fading {
    opacity: 0;
}
.study-section-title {
    margin: 0 0 10px;
    font-size: 0.98rem;
    font-weight: 800;
}
/* شريط صوت مدمّج */
.study-audio-bar {
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.study-audio-bar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}
.study-audio-bar__row--volume {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
}
.study-audio-bar__select {
    flex: 1 1 140px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
}
.study-audio-bar__btn {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.study-audio-bar__btn:hover {
    background: var(--accent-soft);
    border-color: rgba(108, 78, 207, 0.28);
}
.study-audio-bar__btn--primary {
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    border-color: transparent;
}
.study-audio-bar__vol {
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 220px;
}
.study-audio-bar__status {
    font-size: 0.82rem;
    color: var(--text-muted);
    flex: 1 1 auto;
    min-width: 0;
}
/* دردشة بث (Twitch / YouTube style) */
.live-chat {
    display: flex;
    flex-direction: column;
    height: min(520px, calc(100vh - 120px));
    min-height: 320px;
    background: var(--card-bg-solid);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
@media (max-width: 960px) {
    .live-chat {
        height: 420px;
        min-height: 280px;
    }
}
.live-chat__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(108, 78, 207, 0.12), transparent);
    border-bottom: 1px solid var(--divider);
    font-weight: 800;
    font-size: 0.88rem;
}
.live-chat__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #c62828;
}
.live-chat__badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e53935;
    animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.92); }
}
@media (prefers-reduced-motion: reduce) {
    .live-chat__badge::before { animation: none; }
}
.live-chat__hint {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.live-chat__messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 10px;
    scroll-behavior: smooth;
    font-size: 0.86rem;
    line-height: 1.45;
}
.live-chat__empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.live-chat__msg {
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    border-inline-start: 3px solid transparent;
    background: rgba(108, 78, 207, 0.04);
}
html[data-theme="dark"] .live-chat__msg {
    background: rgba(179, 136, 255, 0.06);
}
.live-chat__msg--me {
    border-inline-start-color: var(--accent);
    background: rgba(108, 78, 207, 0.1);
}
.live-chat__msg-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin-bottom: 2px;
}
.live-chat__name {
    font-weight: 800;
    color: var(--accent);
    font-size: 0.82rem;
}
.live-chat__time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.live-chat__text {
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}
.live-chat__report {
    margin-top: 4px;
    font-size: 0.72rem;
}
.live-chat__report button {
    background: none;
    border: none;
    padding: 0;
    color: var(--link);
    cursor: pointer;
    font-family: inherit;
    text-decoration: underline;
    font-size: inherit;
}
.live-chat__composer {
    flex-shrink: 0;
    padding: 10px 10px 12px;
    border-top: 1px solid var(--divider);
    background: var(--card-bg-solid);
}
.live-chat__composer textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    margin-bottom: 8px;
}
.live-chat__composer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.live-chat__composer-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.live-chat__composer button[type="submit"] {
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    border: none;
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    font-weight: 800;
    font-family: inherit;
    font-size: 0.86rem;
    cursor: pointer;
}
.live-chat__login {
    padding: 12px;
    font-size: 0.88rem;
    color: var(--text-muted);
    text-align: center;
}
.live-chat__login a {
    color: var(--link);
    font-weight: 700;
}
.study-btn-start,
.study-btn-stop {
    padding: 10px 22px;
    margin: 6px 4px 0;
    border-radius: var(--radius-pill);
    border: none;
    font-family: inherit;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(135deg, #5c6bc0, #3949ab);
    color: #fff;
    box-shadow: 0 4px 14px rgba(57, 73, 171, 0.3);
}
.study-btn-stop {
    background: linear-gradient(135deg, #78909c, #546e7a);
    box-shadow: 0 4px 12px rgba(84, 110, 122, 0.25);
}
/* تنسيق عام للصفحات */
.browse-page .page-head {
    margin-bottom: 20px;
}
.page-head__subtitle {
    max-width: min(56em, 100%);
}
.teacher-profile__grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px 24px;
    align-items: start;
}
@media (max-width: 520px) {
    .teacher-profile__grid {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}
.teacher-profile__photo {
    width: 128px;
    height: 128px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--card-border);
}
.teacher-profile__photo--empty {
    width: 128px;
    height: 128px;
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, var(--accent-soft), var(--divider));
    border: 1px dashed var(--card-border);
}
.grid-item .rating-stars-wrap {
    margin-top: 4px;
}

/* ——— إخفاء بصري للقارئات ——— */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

