/* ====================================================================
   خزانة التراث — التصميم الشامل (الحاسوب + متصفح الهاتف المستقل)
   ==================================================================== */

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

@font-face {
    font-family: 'NotoNaskhLocal';
    src: url('../خطوط_عربية/NotoNaskhArabic.ttf') format('truetype');
    font-weight: normal;
}
@font-face {
    font-family: 'NotoNaskhLocal';
    src: url('../خطوط_عربية/NotoNaskhArabic-Bold.ttf') format('truetype');
    font-weight: bold;
}
@font-face {
    font-family: 'NotoKufiLocal';
    src: url('../خطوط_عربية/NotoKufiArabic-Bold.ttf') format('truetype');
    font-weight: bold;
}

:root {
    --bg: #fcf8f2;
    --card-bg: #ffffff;
    --card-border: #e8decb;
    --text: #2b1f14;
    --text-muted: #735e47;
    --gold: #b38728;
    --gold-dark: #8c671a;
    --gold-light: #fbf5e6;
    --accent: #1e3a5f;
    --verse: #1a3038;
    --header-bg: #1c140d;
    --header-text: #f5eedf;
    --font-heading: 'Reem Kufi', 'NotoKufiLocal', 'Amiri', serif;
    --font-reading: 'Amiri', 'Traditional Arabic', 'NotoNaskhLocal', 'Scheherazade New', serif;
    --font-ui: 'Tajawal', system-ui, -apple-system, sans-serif;
    --font-size: 21px;
    --line-height: 2.2;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

body.theme-night {
    --bg: #0c101c;
    --card-bg: #141b2d;
    --card-border: #222d47;
    --text: #e2dcce;
    --text-muted: #9ba7bc;
    --gold: #d4af37;
    --gold-dark: #b89326;
    --gold-light: #1b243b;
    --accent: #7fa4d4;
    --verse: #cddbe0;
    --header-bg: #070a12;
    --header-text: #d4af37;
}

body.theme-white {
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --card-border: #e1e5eb;
    --text: #222222;
    --text-muted: #666666;
    --gold: #8c671a;
    --gold-dark: #6e4f0f;
    --gold-light: #f0f2f5;
    --accent: #2b5282;
    --verse: #1d333b;
    --header-bg: #1f2937;
    --header-text: #ffffff;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    direction: rtl;
    font-family: var(--font-ui);
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.25s, color 0.25s;
    -webkit-font-smoothing: antialiased;
}

/* ====================================================================
   بوابة المكتبة الرئيسية (Desktop Layout)
   ==================================================================== */

.main-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-box {
    display: flex;
    align-items: center;
    gap: 14px;
}
.brand-logo-img {
    height: 52px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(179,135,40,0.35));
    transition: transform 0.2s ease;
}
.brand-logo-img:hover {
    transform: scale(1.04);
}
.reader-logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}
.brand-icon {
    font-size: 32px;
    color: var(--gold);
}
.brand-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 26px;
    letter-spacing: 0.5px;
}
.brand-sub {
    font-size: 13px;
    color: var(--gold);
    margin-top: 2px;
    opacity: 0.9;
}

.hero-section {
    max-width: 1200px;
    margin: 30px auto 20px auto;
    padding: 0 20px;
    text-align: center;
}
.hero-title {
    font-family: var(--font-heading);
    font-size: 32px;
    color: var(--gold-dark);
    margin-bottom: 12px;
}
.hero-desc {
    font-size: 17px;
    color: var(--text-muted);
    max-width: 780px;
    margin: 0 auto 20px auto;
    line-height: 1.8;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}
.stat-pill {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 7px 18px;
    border-radius: 30px;
    font-size: 14px;
    color: var(--text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.stat-pill strong {
    color: var(--gold-dark);
    font-size: 15px;
}

/* Toolbar & Filters */
.toolbar-section {
    max-width: 1200px;
    margin: 25px auto 35px auto;
    padding: 0 20px;
}
.search-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.search-input-box {
    display: flex;
    gap: 10px;
    align-items: center;
}
.search-input {
    flex: 1;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 18px;
    font-family: var(--font-ui);
    font-size: 16px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus {
    border-color: var(--gold);
}

.filter-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.chip-btn {
    background: var(--bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-ui);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.chip-btn:hover, .chip-btn.active {
    background: var(--gold);
    color: #ffffff;
    border-color: var(--gold-dark);
}

/* Books Grid */
.library-main {
    max-width: 1200px;
    margin: 0 auto 60px auto;
    padding: 0 20px;
}
.section-heading {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--text);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 28px;
}

.book-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s, box-shadow 0.25s;
}
.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}

.card-cover-box {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
}
.card-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.book-card:hover .card-cover-img {
    transform: scale(1.04);
}
.card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(18, 24, 38, 0.88);
    backdrop-filter: blur(5px);
    color: var(--gold);
    border: 1px solid var(--gold);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
}

.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card-title {
    font-family: var(--font-heading);
    font-size: 21px;
    color: var(--text);
    margin: 0 0 6px 0;
    line-height: 1.4;
}
.card-author {
    font-size: 14px;
    color: var(--gold-dark);
    font-weight: bold;
    margin-bottom: 12px;
}
.card-desc {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0 0 18px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    margin-bottom: 18px;
}

.card-actions {
    display: flex;
    gap: 10px;
}
.btn-primary-read {
    flex: 2;
    background: var(--gold);
    color: #ffffff;
    border: none;
    padding: 11px 18px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-primary-read:hover {
    background: var(--gold-dark);
}
.btn-toc-modal {
    flex: 1;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--card-border);
    padding: 11px 14px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-toc-modal:hover {
    background: var(--card-border);
}

/* ====================================================================
   القارئ التفاعلي الموحد (Desktop Reader)
   ==================================================================== */

.reader-container {
    max-width: 900px;
    margin: 25px auto 90px auto;
    padding: 0 25px;
}

.chapter-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 45px 50px;
    box-shadow: 0 6px 25px rgba(0,0,0,0.06);
    line-height: var(--line-height);
}

.chapter-hero {
    text-align: center;
    padding-bottom: 30px;
    margin-bottom: 35px;
    border-bottom: 1px solid var(--card-border);
}
.chapter-badge {
    display: inline-block;
    background: var(--gold-light);
    color: var(--gold-dark);
    border: 1px solid var(--gold);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 12px;
}
.chapter-title {
    font-family: var(--font-heading);
    font-size: 32px;
    color: var(--text);
    margin: 0 0 10px 0;
    line-height: 1.4;
}
.chapter-meta {
    font-size: 15px;
    color: var(--text-muted);
}

.chapter-body {
    font-family: var(--font-reading);
    font-size: var(--font-size);
    color: var(--text);
    text-align: justify;
    line-height: var(--line-height);
}

.sub-story-title {
    font-family: var(--font-heading);
    font-size: 24px;
    color: var(--gold-dark);
    margin: 35px 0 18px 0;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--card-border);
}

.arabic-para {
    margin-bottom: 24px;
    text-indent: 1.5em;
}

/* تنسيق الشعر العربي الأصيل */
.poetry-box {
    margin: 28px auto;
    max-width: 680px;
    background: var(--gold-light);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 16px 22px;
    box-shadow: inset 0 0 12px rgba(179,135,40,0.08);
}
.bayt {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 6px 0;
    font-size: calc(var(--font-size) * 0.96);
    color: var(--verse);
}
.sadr {
    text-align: right;
    padding-left: 10px;
    font-weight: 500;
}
.divider {
    color: var(--gold);
    font-size: 14px;
    padding: 0 10px;
    opacity: 0.8;
}
.ajuz {
    text-align: left;
    padding-right: 10px;
    font-weight: 500;
}

/* Chapter Bottom Navigation */
.chapter-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 35px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}
.btn-nav {
    background: var(--gold);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-nav:hover:not(:disabled) {
    background: var(--gold-dark);
}
.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-box {
    background: var(--card-bg);
    width: 90%;
    max-width: 650px;
    max-height: 80vh;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
}
.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gold-light);
}
.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    color: var(--gold-dark);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text);
}
.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}
.modal-ch-item {
    display: block;
    padding: 11px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    border-radius: 8px;
    transition: background 0.15s;
}
.modal-ch-item:hover {
    background: var(--gold-light);
    color: var(--gold-dark);
}

/* ====================================================================
   📱 التصميم الفريد المستقل لمتصفح الهاتف (Mobile-First Interface)
   ==================================================================== */

/* Hide mobile-specific elements on desktop */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    /* Reveal mobile-only elements */
    .mobile-only {
        display: flex !important;
    }
    .desktop-only {
        display: none !important;
    }

    body {
        padding-bottom: calc(75px + var(--safe-bottom));
    }

    /* 1. Mobile Header */
    .main-header {
        padding: 12px 16px;
    }
    .brand-logo-img {
        height: 40px;
    }
    .brand-icon {
        font-size: 26px;
    }
    .brand-title {
        font-size: 20px;
    }
    .brand-sub {
        display: none;
    }

    /* 2. Mobile Hero */
    .hero-section {
        margin: 18px auto 14px auto;
        padding: 0 16px;
    }
    .hero-title {
        font-size: 23px;
        line-height: 1.35;
    }
    .hero-desc {
        font-size: 14px;
        margin-bottom: 14px;
    }
    .stats-bar {
        gap: 8px;
    }
    .stat-pill {
        padding: 5px 12px;
        font-size: 12px;
    }
    .stat-pill strong {
        font-size: 13px;
    }

    /* 3. Mobile Search & Filter Pills */
    .toolbar-section {
        margin: 15px auto 20px auto;
        padding: 0 14px;
    }
    .search-card {
        padding: 12px 14px;
        border-radius: 12px;
        gap: 12px;
    }
    .search-input {
        padding: 10px 14px;
        font-size: 15px;
    }
    .filter-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
    }
    .filter-chips::-webkit-scrollbar {
        display: none;
    }
    .chip-btn {
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 13px;
    }

    /* 4. Mobile Book Cards (Compact Native App Layout) */
    .library-main {
        padding: 0 14px;
        margin-bottom: 40px;
    }
    .section-heading {
        font-size: 20px;
        margin-bottom: 16px;
    }
    .books-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .book-card {
        flex-direction: row;
        border-radius: 14px;
        padding: 12px;
        gap: 12px;
        align-items: stretch;
    }
    .card-cover-box {
        width: 110px;
        min-width: 110px;
        height: auto;
        border-radius: 10px;
    }
    .card-badge {
        font-size: 10px;
        padding: 2px 7px;
        top: 6px;
        right: 6px;
    }
    .card-body {
        padding: 0;
        flex: 1;
        justify-content: space-between;
    }
    .card-title {
        font-size: 17px;
        margin-bottom: 3px;
    }
    .card-author {
        font-size: 12px;
        margin-bottom: 6px;
    }
    .card-desc {
        display: none; /* Hide long description on mobile cards for a crisp app look */
    }
    .card-meta-row {
        padding-top: 6px;
        margin-bottom: 10px;
        font-size: 11px;
    }
    .card-actions {
        gap: 8px;
    }
    .btn-primary-read {
        padding: 9px 12px;
        font-size: 13px;
    }
    .btn-toc-modal {
        padding: 9px 10px;
        font-size: 13px;
    }

    /* 5. Mobile Native Bottom Dock (Bar) */
    .mobile-bottom-dock {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--header-bg);
        border-top: 1px solid var(--gold-dark);
        padding: 8px 12px calc(8px + var(--safe-bottom)) 12px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
        backdrop-filter: blur(12px);
    }
    .dock-item {
        background: none;
        border: none;
        color: var(--header-text);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-family: var(--font-ui);
        font-size: 11px;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 8px;
        text-decoration: none;
        transition: color 0.15s;
    }
    .dock-item.active, .dock-item:hover {
        color: var(--gold);
    }
    .dock-icon {
        font-size: 18px;
    }

    /* 6. Mobile Bottom Sheet Modal */
    .modal-overlay {
        align-items: flex-end; /* Mobile Bottom Sheet */
    }
    .modal-box {
        width: 100%;
        max-width: 100%;
        max-height: 82vh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        padding-bottom: var(--safe-bottom);
        animation: slideUp 0.25s ease-out;
    }
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .sheet-handle {
        width: 44px;
        height: 5px;
        background: var(--card-border);
        border-radius: 3px;
        margin: 8px auto 2px auto;
    }

    /* 7. Mobile Reader Layout */
    .reader-container {
        margin: 10px auto 30px auto;
        padding: 0 12px;
    }
    .chapter-card {
        padding: 24px 18px;
        border-radius: 14px;
    }
    .chapter-hero {
        padding-bottom: 20px;
        margin-bottom: 22px;
    }
    .chapter-title {
        font-size: 24px;
    }
    .chapter-badge {
        font-size: 12px;
        padding: 3px 12px;
    }
    .chapter-body {
        font-size: 19px;
        line-height: 2.0;
        text-align: right;
    }
    .arabic-para {
        margin-bottom: 18px;
        text-indent: 1em;
    }
    .sub-story-title {
        font-size: 20px;
        margin: 24px 0 12px 0;
    }

    /* Mobile Poetry (Adaptive Stacking to avoid wrapping) */
    .poetry-box {
        padding: 12px 14px;
        margin: 20px 0;
    }
    .bayt {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 8px 0;
        border-bottom: 1px dashed rgba(179,135,40,0.18);
    }
    .bayt:last-child {
        border-bottom: none;
    }
    .sadr, .ajuz {
        text-align: center;
        padding: 2px 0;
        width: 100%;
        font-size: 17px;
    }
    .divider {
        padding: 2px 0;
        font-size: 12px;
    }

    .chapter-nav-bar {
        display: none; /* Replaced by the native Mobile Bottom Dock in reader */
    }

    /* Reader Top Bar on Mobile */
    .reader-topbar {
        padding: 8px 12px;
    }
    .reader-book-title {
        font-size: 15px;
        max-width: 180px;
    }
    .btn-home {
        padding: 5px 9px;
        font-size: 12px;
    }
    .btn-drawer-toggle {
        padding: 5px 10px;
        font-size: 13px;
    }

    /* Full-screen Immersive Reading Mode */
    .immersive-active .reader-topbar {
        transform: translateY(-100%);
        transition: transform 0.25s ease-in-out;
    }
    .immersive-active .mobile-bottom-dock {
        transform: translateY(100%);
        transition: transform 0.25s ease-in-out;
    }
    .reader-topbar, .mobile-bottom-dock {
        transition: transform 0.25s ease-in-out;
    }
}

/* ====================================================================
   النمط الأندلسي الهادئ (Andalusian Emerald Theme)
   ==================================================================== */
body.theme-andalusia {
    --bg: #f2f7f4;
    --card-bg: #ffffff;
    --card-border: #d2e4db;
    --text: #1a2e26;
    --text-muted: #4e6b5f;
    --gold: #2d7a58;
    --gold-dark: #1b533b;
    --gold-light: #e4f2eb;
    --accent: #a37d22;
    --verse: #143d2c;
    --header-bg: #0d261d;
    --header-text: #e1efe6;
}

/* ====================================================================
   AdSense Responsive Container & Safe Ad Slots
   ==================================================================== */
.adsense-container {
    margin: 25px auto;
    padding: 10px 0;
    max-width: 900px;
    width: 100%;
    text-align: center;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    clear: both;
}
.ad-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    opacity: 0.7;
}
.ad-placeholder-box {
    width: 100%;
    background: rgba(179, 135, 40, 0.04);
    border: 1px dashed var(--card-border);
    border-radius: 12px;
    padding: 18px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ad-placeholder-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gold-dark);
    font-size: 13.5px;
    font-weight: 500;
}
.ad-sparkle {
    font-size: 16px;
}

/* ====================================================================
   In-Reader Live Search & Search Highlighting
   ==================================================================== */
.reader-search-bar {
    position: sticky;
    top: 55px;
    z-index: 998;
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 10px 20px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    animation: slideDown 0.2s ease-out;
}
.reader-search-bar.open {
    display: flex;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.search-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.search-count-badge {
    font-size: 13px;
    color: var(--gold-dark);
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}
mark.search-match {
    background-color: #ffeaa7;
    color: #2d3436;
    border-radius: 3px;
    padding: 1px 3px;
}
mark.search-match.current {
    background-color: #ff9f43;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 0 0 2px #e67e22;
}

/* ====================================================================
   Audio Listen Bar (TTS Controls)
   ==================================================================== */
.audio-bar {
    background: var(--gold-light);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 16px;
    margin: 15px 0 25px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.audio-btn {
    background: var(--gold);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.audio-btn:hover {
    background: var(--gold-dark);
}
.audio-status {
    font-size: 13.5px;
    color: var(--gold-dark);
    font-weight: 500;
}

/* ====================================================================
   Bookmarks & Notes System
   ==================================================================== */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-bg);
}
.drawer-tab {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    font-size: 14px;
    font-weight: bold;
    color: var(--text-muted);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.drawer-tab.active {
    color: var(--gold-dark);
    border-bottom-color: var(--gold);
    background: var(--gold-light);
}
.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text);
    font-size: 14px;
    transition: background 0.15s;
    cursor: pointer;
}
.bookmark-item:hover {
    background: var(--gold-light);
}

/* ====================================================================
   Smart Citation Toast Notification
   ==================================================================== */
.toast-notice {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: #1c140d;
    color: #f5eedf;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--gold);
}
.toast-notice.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
