/* ═══════════════════════════════════════════
   القرآن الكريم - خط إندوباك
   Premium Mushaf Reader
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Tajawal:wght@300;400;500;700;800&display=swap');

@font-face {
    font-family: 'IndopakNastaleeq';
    src: url('https://static-cdn.tarteel.ai/qul/fonts/nastaleeq/Hanafi/normal-v4.2.2/with-waqf-lazmi/font.woff2') format('woff2'),
         url('https://static-cdn.tarteel.ai/qul/fonts/nastaleeq/Hanafi/normal-v4.2.2/with-waqf-lazmi/font.woff') format('woff'),
         url('https://static-cdn.tarteel.ai/qul/fonts/nastaleeq/Hanafi/normal-v4.2.2/with-waqf-lazmi/font.ttf') format('truetype'),
         url('./fonts/indopak-nastaleeq.woff2') format('woff2'),
         url('./fonts/indopak-nastaleeq.woff') format('woff'),
         url('./fonts/indopak-nastaleeq.ttf') format('truetype');
    font-display: swap;
}

/* Fallback High-Quality Font from QuranWBW */
@font-face {
    font-family: 'AlQuranNeo';
    src: url('https://quranwbw.com/fonts/AlQuranNeo5x2.woff2') format('woff2');
    font-display: swap;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }
body {
    font-family: 'Tajawal', 'Amiri', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
::selection { background: var(--gold); color: var(--bg-primary); }

/* ─── Theme Variables ─── */
:root {
    --bg-primary: #070b14;
    --bg-secondary: #0f1523;
    --bg-tertiary: #161d2e;
    --bg-card: #1a2235;
    --bg-page: #fdf8ef;
    --bg-page-edge: #f0e8d8;
    --gold: #c9a84c;
    --gold-light: #e2cc7e;
    --gold-dark: #8b6e2f;
    --gold-glow: rgba(201, 168, 76, 0.25);
    --green: #2d7a4f;
    --green-light: #3da066;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #4a5568;
    --text-page: #1e0f02;
    --text-verse-num: #7c5e2f;
    --border: rgba(201, 168, 76, 0.15);
    --border-gold: var(--gold);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-page: 0 4px 40px rgba(0,0,0,0.6), 0 0 80px rgba(201,168,76,0.08);
    --header-h: auto;
    --sidebar-w: 300px;
    --quran-font-size: 28px;
    --page-w: 520px;
    --z-sidebar: 100;
    --z-header: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;
}

/* ─── App Layout ─── */
#app {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-areas: "header header" "sidebar main";
    min-height: 100vh;
    min-height: 100dvh;
}
#app.sidebar-closed { grid-template-columns: 0 1fr; }
#app.sidebar-closed .sidebar { transform: translateX(100%); }

/* ─── Header ─── */
.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: var(--z-header);
    gap: 16px;
    position: sticky;
    top: 0;
    box-shadow: var(--shadow-sm);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}
.header-center span {
    text-overflow: ellipsis;
    overflow: hidden;
}
.logo-icon { font-size: 1.5rem; }

/* ─── Hero Section ─── */
.hero-section {
    width: 100%;
    max-width: 800px;
    margin: 40px auto 20px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 32px;
}
.hero-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.hero-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--gold);
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.2);
}
.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--gold);
    margin: 0;
    font-family: 'Tajawal', sans-serif;
}
.hero-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 650px;
}
.hero-search-wrapper {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Search Bar */
.search-wrapper {
    width: 100%;
    position: relative;
    z-index: 10;
}
.search-input {
    width: 100%;
    padding: 16px 48px 16px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}
.search-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px var(--gold-glow), var(--shadow-lg);
    background: var(--bg-card);
}
.search-input::placeholder { color: var(--text-muted); }
.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 1.3rem;
    pointer-events: none;
}
.search-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: var(--z-modal);
    display: none;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.2s ease;
}
.search-results.active { display: block; }
.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-tertiary); }
.search-result-item .result-name { font-weight: 500; }
.search-result-item .result-meta { font-size: 0.8rem; color: var(--text-muted); }

/* Header Buttons */
.header-left { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.hdr-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s;
}
.hdr-btn:hover { background: var(--gold); color: var(--bg-primary); transform: scale(1.05); }
.hdr-btn.active { background: var(--gold); color: var(--bg-primary); }

/* ─── Sidebar ─── */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
}
.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 4px;
}
.sidebar-tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}
.sidebar-tab.active { background: var(--gold); color: var(--bg-primary); font-weight: 700; }
.sidebar-tab:hover:not(.active) { color: var(--text-primary); }

.sidebar-content { flex: 1; overflow-y: auto; }
.surah-list { list-style: none; }
.surah-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.surah-item:hover { background: var(--bg-tertiary); }
.surah-item.active { background: var(--gold-glow); border-right: 3px solid var(--gold); }
.surah-num {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--bg-tertiary);
    border-radius: 8px;
    flex-shrink: 0;
}
.surah-info { flex: 1; min-width: 0; }
.surah-name-ar { font-weight: 600; font-size: 1rem; line-height: 1.3; }
.surah-name-en { font-size: 0.75rem; color: var(--text-muted); line-height: 1.2; }
.surah-meta { font-size: 0.7rem; color: var(--text-muted); text-align: left; white-space: nowrap; }

/* Juz List */
.juz-list { list-style: none; }
.juz-item {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.15s;
}
.juz-item:hover { background: var(--bg-tertiary); }
.juz-name { font-weight: 500; }
.juz-page { font-size: 0.8rem; color: var(--text-muted); }

/* Bookmark List */
.bookmark-list { list-style: none; padding: 8px; }
.bookmark-item {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s;
}
.bookmark-item:hover { background: var(--bg-card); }
.bookmark-remove {
    background: none;
    border: none;
    color: #e55;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

/* ─── Main Area ─── */
.main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.06) 0%, transparent 60%),
        var(--bg-primary);
}

/* Page Info Bar */
.page-info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 8px 20px;
    width: 100%;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.page-info-bar .info-item { display: flex; align-items: center; gap: 6px; }
.page-info-bar .info-label { color: var(--text-muted); }
.page-info-bar .info-value { color: var(--gold-light); font-weight: 600; }

/* ─── Mushaf Container ─── */
.mushaf-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 0;
    width: 100%;
    max-width: 1200px;
    perspective: 1200px;
}

/* ─── Mushaf Page ─── */
.mushaf-page {
    width: var(--page-w);
    max-width: 90vw;
    min-height: 60vh;
    height: auto;
    background: var(--bg-page);
    border-radius: 4px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-page);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pageEnter 0.5s ease;
}
.mushaf-page::-webkit-scrollbar { width: 4px; }
.mushaf-page::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 2px; }

/* Ornamental Frame */
.mushaf-page::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid var(--gold);
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
}
.mushaf-page::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid var(--gold-light);
    border-radius: 1px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
}

/* Page Edge Effect */
.mushaf-page.page-right {
    border-radius: 2px 8px 8px 2px;
    box-shadow: var(--shadow-page), -4px 0 12px rgba(0,0,0,0.15) inset;
}
.mushaf-page.page-left {
    border-radius: 8px 2px 2px 8px;
    box-shadow: var(--shadow-page), 4px 0 12px rgba(0,0,0,0.15) inset;
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 28px 24px 16px;
    direction: rtl;
    text-align: justify;
    position: relative;
    z-index: 1;
}

/* ─── Surah Header ─── */
.surah-title-block {
    text-align: center;
    margin: 8px 0 16px;
    position: relative;
}
.surah-title-frame {
    display: inline-block;
    padding: 8px 40px;
    position: relative;
    background: linear-gradient(135deg, #f5e6c4, #ecd9a8, #f5e6c4);
    border: 2px solid var(--gold);
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(139, 110, 47, 0.2);
}
.surah-title-name {
    font-family: 'Amiri', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold-dark);
    line-height: 1.4;
}
.surah-title-frame::before,
.surah-title-frame::after {
    content: '❊';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 1rem;
}
.surah-title-frame::before { right: 12px; }
.surah-title-frame::after { left: 12px; }

/* Bismillah */
.bismillah {
    text-align: center;
    font-family: 'IndopakNastaleeq', 'AlQuranNeo', 'Amiri', serif;
    font-size: calc(var(--quran-font-size) * 0.9);
    color: var(--text-page);
    padding: 4px 0 12px;
    line-height: 2;
    /* Critical for IndoPak Nastaleeq Stacking */
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* ─── Verse Text ─── */
.verse-text {
    font-family: 'IndopakNastaleeq', 'AlQuranNeo', 'Amiri', serif;
    font-size: var(--quran-font-size);
    line-height: 2.4;
    color: var(--text-page);
    text-align: justify;
    word-spacing: 4px;
    display: inline;
    /* Critical for IndoPak Nastaleeq Stacking & Diacritics */
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    font-variant-ligatures: common-ligatures contextual;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
.verse-inline { display: inline; }
.verse-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0 2px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gold-dark);
    position: relative;
    vertical-align: middle;
    cursor: pointer;
    transition: transform 0.15s;
}
.verse-number-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--gold);
    border-radius: 50%;
}
.verse-number-badge:hover { transform: scale(1.3); }

/* Verse Tooltip (copy) */
.verse-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 4px 8px;
    color: var(--gold-light);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.75rem;
    z-index: 10;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    pointer-events: none;
    animation: fadeIn 0.2s;
}

/* ─── Page Footer ─── */
.page-footer {
    text-align: center;
    padding: 8px 16px 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.8rem;
    color: var(--text-verse-num);
    border-top: 1px solid rgba(201, 168, 76, 0.2);
    margin: 0 20px;
    position: relative;
    z-index: 1;
}
.page-number {
    display: inline-block;
    padding: 2px 16px;
    border: 1px solid var(--gold-dark);
    border-radius: 12px;
    background: linear-gradient(135deg, #f5e6c4, #ecd9a8);
    font-weight: 600;
}

/* ─── Footer ─── */
.site-footer {
    width: 100%;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 32px 20px 24px;
    margin-top: auto;
    z-index: 5;
    position: relative;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    justify-content: space-around;
}
.footer-col {
    flex: 1;
    min-width: 240px;
    text-align: center;
}
.footer-col h4 {
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 16px;
    font-weight: 700;
    position: relative;
    padding-bottom: 8px;
}
.footer-col h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.footer-col a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: inline-block;
}
.footer-col a:hover {
    color: var(--gold-light);
    transform: translateX(-4px);
}
.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ─── Navigation Controls ─── */
.nav-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 20px;
    width: 100%;
}
.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.nav-btn:hover:not(:disabled) { background: var(--gold); color: var(--bg-primary); border-color: var(--gold); transform: translateY(-1px); }
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-btn .arrow { font-size: 1.2rem; }
.page-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.page-input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    color: var(--gold-light);
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
}
.page-input-wrapper span { color: var(--text-muted); font-size: 0.85rem; }

/* ─── Settings Panel ─── */
.settings-panel {
    position: fixed;
    top: var(--header-h);
    left: 20px;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    z-index: var(--z-modal);
    box-shadow: var(--shadow-lg);
    display: none;
    animation: slideDown 0.25s ease;
}
.settings-panel.active { display: block; }
.settings-title { font-size: 1rem; font-weight: 700; color: var(--gold); margin-bottom: 16px; }
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 0.9rem; color: var(--text-secondary); }
.setting-control { display: flex; align-items: center; gap: 8px; }
.size-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.size-btn:hover { background: var(--gold); color: var(--bg-primary); }
.size-value { width: 30px; text-align: center; color: var(--gold-light); font-weight: 600; }

/* ─── Go-to-Page Modal ─── */
.goto-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    backdrop-filter: blur(4px);
}
.goto-modal.active { display: flex; }
.goto-content {
    background: var(--bg-card);
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 32px;
    min-width: 320px;
    text-align: center;
    animation: scaleIn 0.3s ease;
}
.goto-title { font-size: 1.2rem; font-weight: 700; color: var(--gold); margin-bottom: 20px; }
.goto-input {
    width: 100%;
    padding: 14px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--gold-light);
    outline: none;
    font-family: 'Tajawal', sans-serif;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}
.goto-input:focus { border-color: var(--gold); }
.goto-btn {
    padding: 12px 40px;
    border: none;
    border-radius: 12px;
    background: var(--gold);
    color: var(--bg-primary);
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    transition: all 0.2s;
}
.goto-btn:hover { background: var(--gold-light); transform: scale(1.02); }

/* ─── Toast Notification ─── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--gold);
    border-radius: 12px;
    color: var(--gold-light);
    font-family: 'Tajawal', sans-serif;
    font-size: 0.9rem;
    z-index: var(--z-toast);
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ─── Loading ─── */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(7, 11, 20, 0.85);
    z-index: 10;
    gap: 16px;
    backdrop-filter: blur(4px);
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-text { color: var(--text-secondary); font-size: 0.9rem; }

/* ─── Empty States ─── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 0.9rem; }

/* ─── Animations ─── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes pageEnter {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Dual Page Spread (desktop) */
.mushaf-container.dual-page { gap: 4px; }
.mushaf-container.dual-page .mushaf-page {
    max-width: 48%;
    min-height: 72vh;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
    .mushaf-container.dual-page { flex-direction: column; gap: 16px; }
    .mushaf-container.dual-page .mushaf-page { max-width: 90vw; min-height: auto; }
}
@media (max-width: 768px) {
    #app { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
    .sidebar {
        position: fixed;
        top: 65px;
        right: 0;
        bottom: 0;
        width: 85vw;
        max-width: 340px;
        z-index: var(--z-sidebar);
        box-shadow: var(--shadow-lg);
    }
    #app:not(.sidebar-closed) .sidebar-overlay { display: block; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 65px;
        background: rgba(0,0,0,0.5);
        z-index: calc(var(--z-sidebar) - 1);
    }
    .mushaf-page { max-width: 95vw; height: auto; }
    .page-content { padding: 20px 16px 12px; }
    .hero-title { font-size: 1.6rem; }
    .hero-desc { font-size: 0.95rem; line-height: 1.6; }
    .search-input { padding: 12px 40px 12px 16px; font-size: 0.95rem; }
    .nav-btn span:not(.arrow) { display: none; }
    :root { --quran-font-size: 22px; }
    .settings-panel { left: 10px; right: 10px; width: auto; }
}
@media (max-width: 480px) {
    .nav-controls { gap: 6px; }
    .nav-btn { padding: 8px 12px; font-size: 0.85rem; }
    :root { --quran-font-size: 20px; }
    .page-info-bar { flex-wrap: wrap; gap: 8px; font-size: 0.78rem; }
    .header { padding: 10px 8px; }
    .hero-title { font-size: 1.4rem; }
    .hero-desc { font-size: 0.9rem; }
}

/* ─── Print Styles ─── */
@media print {
    .header, .sidebar, .nav-controls, .page-info-bar { display: none !important; }
    #app { display: block !important; }
    .main { background: white !important; }
    .mushaf-page { box-shadow: none !important; max-height: none !important; border: 1px solid #ccc !important; }
    .mushaf-page::before, .mushaf-page::after { border-color: #999 !important; }
}

/* ─── Highlight verse ─── */
.verse-highlight {
    background: rgba(201, 168, 76, 0.15);
    border-radius: 4px;
    padding: 2px 4px;
    transition: background 0.3s;
}

/* ─── Download progress ─── */
.download-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}
.download-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}
