/* -------------------------------------------------------------
       ISLAMIC ACADEMIC LUXURY DESIGN SYSTEM (ALIGNED WITH CHAT.HTML)
       ------------------------------------------------------------- */
        :root {
            /* Palette */
            --primary: #C99738;
            --primary-light: #E5BE5E;
            --primary-dark: #8E6E32;
            --emerald-dark: #07221C;
            --emerald-accent: #10B981;
            --bg-dark: #0B192C;
            --bg-deep: #050A12;
            --bg-card: rgba(14, 28, 48, 0.85);

            /* Typography */
            --font-serif: 'Playfair Display', Georgia, serif;
            --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
            --font-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
            --font-code: 'Fira Code', 'Courier New', monospace;

            --border-dark: rgba(201, 151, 56, 0.25);
            --border-light: rgba(201, 151, 56, 0.12);

            --text-dark-theme: #FAF9F6;
            --text-muted-dark: #8E9BAE;
            --text-gold: #F3CA68;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            scroll-behavior: smooth;
        }

        body {
            background-color: var(--bg-deep);
            color: var(--text-dark-theme);
            font-family: var(--font-sans);
            overflow: hidden;
            line-height: 1.6;
            height: 100vh;
            height: 100dvh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* Scrollbar */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: var(--bg-deep);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--primary);
            border-radius: 10px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--primary-light);
        }

        /* Main Container Shell */
        .chat-shell {
            display: flex;
            flex-direction: column;
            width: 100vw;
            height: 100vh;
            height: 100dvh;
            max-width: 100%;
            background-color: var(--bg-dark);
            position: relative;
            overflow: hidden;
            background-image:
                radial-gradient(circle at 10% 20%, rgba(201, 151, 56, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 40%);
        }

        /* ── Header ─────────────────────────────────────── */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 14px 24px;
            background-color: rgba(5, 10, 18, 0.88);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-bottom: 1.5px solid var(--border-dark);
            position: relative;
            z-index: 100;
            pointer-events: auto;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .sidebar-toggle-btn {
            background: rgba(201, 151, 56, 0.1);
            border: 1px solid var(--border-dark);
            color: var(--primary);
            width: 38px;
            height: 38px;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.25s ease;
            position: relative;
            z-index: 30;
            pointer-events: auto;
            touch-action: manipulation;
            user-select: none;
            -webkit-user-select: none;
        }

        .sidebar-toggle-btn * {
            pointer-events: none;
        }

        .sidebar-toggle-btn:hover,
        .sidebar-toggle-btn.active {
            background: var(--primary);
            color: #000;
            border-color: var(--primary-light);
            box-shadow: 0 0 12px rgba(201, 151, 56, 0.35);
        }

        .header-brand {
            display: flex;
            align-items: center;
            gap: 12px;
            text-decoration: none;
            cursor: pointer;
        }

        .header-logo-monogram {
            font-family: var(--font-arabic);
            font-weight: 700;
            font-size: 1.5rem;
            color: var(--primary-light);
            border: 1.5px solid var(--primary);
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 14px rgba(201, 151, 56, 0.25);
            background: radial-gradient(circle, #102923 0%, var(--bg-deep) 100%);
            transition: all 0.3s;
        }

        .header-brand:hover .header-logo-monogram {
            border-color: var(--primary-light);
            box-shadow: 0 0 18px rgba(229, 190, 94, 0.45);
            transform: scale(1.06) rotate(5deg);
        }

        .header-title-text {
            font-family: var(--font-serif);
            font-size: 1.3rem;
            font-weight: 700;
            color: #fff;
            letter-spacing: 0.02em;
            display: flex;
            align-items: baseline;
            gap: 6px;
        }

        .header-title-text i {
            font-style: italic;
            color: var(--primary-light);
            font-weight: 400;
        }

        .quran-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            border: 1px solid var(--primary);
            background: rgba(201, 151, 56, 0.12);
            color: var(--primary-light);
            padding: 3px 10px;
            border-radius: 100px;
            font-size: 0.65rem;
            font-weight: 800;
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .btn-header {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            padding: 7px 14px;
            border-radius: 8px;
            border: 1px solid var(--border-dark);
            background: rgba(201, 151, 56, 0.08);
            color: var(--primary-light);
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s;
            font-family: var(--font-sans);
        }

        .btn-header:hover {
            background: rgba(201, 151, 56, 0.2);
            border-color: var(--primary);
            transform: translateY(-1px);
        }

        .btn-header.primary {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            color: #fff;
            border: 1px solid var(--primary-light);
        }

        /* ── Main Layout: Sidebar & Chat ─────────────────── */
        .app-body {
            display: flex;
            flex: 1;
            height: calc(100vh - 67px);
            overflow: hidden;
            position: relative;
        }

        /* Sidebar Surah & History */
        .sidebar-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            z-index: 80;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .sidebar-backdrop.active {
            opacity: 1;
            pointer-events: auto;
        }

        .sidebar {
            width: 320px;
            background: rgba(5, 10, 18, 0.95);
            border-right: 1.5px solid var(--border-dark);
            display: flex;
            flex-direction: column;
            backdrop-filter: blur(25px);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
            z-index: 15;
        }

        .sidebar.closed {
            transform: translateX(-100%);
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
        }

        .sidebar-header-mobile {
            display: none;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            background: rgba(5, 10, 18, 0.98);
            border-bottom: 1px solid var(--border-dark);
        }

        .sidebar-close-btn {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid var(--border-light);
            color: #fff;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.2s;
            touch-action: manipulation;
        }

        .sidebar-close-btn:hover,
        .sidebar-close-btn:active {
            background: #E11D48;
            border-color: #E11D48;
            color: #fff;
        }

        .sidebar-tabs {
            display: flex;
            border-bottom: 1px solid var(--border-dark);
            background: rgba(0, 0, 0, 0.3);
        }

        .sidebar-tab {
            flex: 1;
            padding: 12px 4px;
            text-align: center;
            font-size: 0.74rem;
            font-weight: 700;
            color: var(--text-muted-dark);
            cursor: pointer;
            border-bottom: 2px solid transparent;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .sidebar-tab.active {
            color: var(--primary-light);
            border-bottom-color: var(--primary);
            background: rgba(201, 151, 56, 0.08);
        }

        .sidebar-search-box {
            padding: 12px 14px;
            border-bottom: 1px solid var(--border-light);
        }

        .sidebar-search-input {
            width: 100%;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-dark);
            border-radius: 8px;
            padding: 8px 12px;
            color: #fff;
            font-size: 0.82rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .sidebar-search-input:focus {
            border-color: var(--primary);
            background: rgba(255, 255, 255, 0.08);
        }

        .sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }

        .surah-list-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 12px;
            border-radius: 10px;
            margin-bottom: 6px;
            border: 1px solid transparent;
            background: rgba(255, 255, 255, 0.02);
            cursor: pointer;
            transition: all 0.2s;
        }

        .surah-list-item:hover {
            background: rgba(201, 151, 56, 0.1);
            border-color: var(--border-dark);
            transform: translateX(3px);
        }

        .surah-item-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .surah-number-badge {
            width: 28px;
            height: 28px;
            border-radius: 8px;
            background: rgba(201, 151, 56, 0.15);
            color: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            font-weight: 700;
            border: 1px solid var(--border-dark);
        }

        .surah-info-name {
            font-weight: 600;
            font-size: 0.85rem;
            color: #fff;
        }

        .surah-info-sub {
            font-size: 0.7rem;
            color: var(--text-muted-dark);
        }

        .surah-arabic-name {
            font-family: var(--font-arabic);
            font-size: 1.15rem;
            color: var(--primary-light);
        }

        .history-item {
            padding: 12px;
            border-radius: 8px;
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--border-light);
            margin-bottom: 8px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: all 0.2s;
        }

        .history-item:hover {
            background: rgba(201, 151, 56, 0.1);
            border-color: var(--border-dark);
        }

        /* ── Kajian DS Components ────────────────────────── */
        .kajian-filter-section {
            padding: 10px 12px;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .kajian-category-chips {
            display: flex;
            gap: 6px;
            overflow-x: auto;
            padding-bottom: 4px;
            scrollbar-width: none;
        }

        .kajian-category-chips::-webkit-scrollbar {
            display: none;
        }

        .kajian-cat-btn {
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--border-light);
            color: var(--text-muted-dark);
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.72rem;
            font-weight: 600;
            white-space: nowrap;
            cursor: pointer;
            transition: all 0.2s;
        }

        .kajian-cat-btn:hover {
            background: rgba(201, 151, 56, 0.1);
            color: #fff;
        }

        .kajian-cat-btn.active {
            background: var(--primary);
            border-color: var(--primary-light);
            color: #000;
            font-weight: 700;
        }

        .kajian-card {
            padding: 12px 14px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--border-light);
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            flex-direction: column;
            gap: 6px;
            direction: rtl;
            text-align: right;
        }

        .kajian-card:hover {
            background: rgba(201, 151, 56, 0.08);
            border-color: var(--primary);
            transform: translateX(-4px);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
        }

        .kajian-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.68rem;
            direction: rtl;
        }

        .kajian-cat-badge {
            background: rgba(16, 185, 129, 0.15);
            color: #34D399;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .kajian-date-badge {
            color: var(--text-muted-dark);
            font-size: 0.7rem;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .kajian-card-title {
            font-size: 0.86rem;
            font-weight: 700;
            color: #fff;
            line-height: 1.35;
            text-align: right;
            direction: rtl;
        }

        .kajian-card-preview {
            font-size: 0.75rem;
            color: var(--text-muted-dark);
            line-height: 1.45;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-align: right;
            direction: rtl;
        }

        .kajian-card-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 4px;
            padding-top: 6px;
            border-top: 1px dashed rgba(255, 255, 255, 0.06);
            direction: rtl;
        }

        .btn-kajian-ask {
            background: rgba(201, 151, 56, 0.12);
            border: 1px solid var(--border-dark);
            color: var(--primary-light);
            font-size: 0.7rem;
            font-weight: 700;
            padding: 3px 8px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }

        .btn-kajian-ask:hover {
            background: var(--primary);
            color: #000;
        }

        /* ── Chat Container ─────────────────────────────── */
        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            position: relative;
            overflow: hidden;
        }

        #messages {
            flex: 1;
            overflow-y: auto;
            padding: 28px 24px;
            display: flex;
            flex-direction: column;
            gap: 24px;
            scroll-behavior: smooth;
        }

        #messages.initial {
            justify-content: center;
        }

        /* ── Initial Greeting & Hero ─────────────────────── */
        .greeting {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            margin: auto;
            max-width: 720px;
            padding: 30px 20px;
            animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .bismillah-hero {
            font-family: var(--font-arabic);
            font-size: 2.2rem;
            color: var(--primary-light);
            margin-bottom: 14px;
            text-shadow: 0 0 20px rgba(201, 151, 56, 0.3);
            line-height: 1.4;
        }

        .greeting-text {
            font-family: var(--font-serif);
            font-weight: 700;
            font-size: 2.2rem;
            line-height: 1.25;
            color: #fff;
            margin-bottom: 12px;
        }

        .greeting-text i {
            font-style: italic;
            color: var(--primary-light);
            font-weight: 400;
        }

        .greeting-desc {
            font-size: 0.95rem;
            color: var(--text-muted-dark);
            margin-bottom: 28px;
            max-width: 580px;
            line-height: 1.6;
        }

        .suggestion-chips {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 14px;
            width: 100%;
            margin-top: 8px;
        }

        @media (max-width: 768px) {
            .suggestion-chips {
                grid-template-columns: 1fr;
            }

            .bismillah-hero {
                font-size: 1.8rem;
            }

            .greeting-text {
                font-size: 1.7rem;
            }

            .sidebar-header-mobile {
                display: flex;
            }

            .sidebar {
                position: fixed;
                height: 100vh;
                height: 100dvh;
                left: 0;
                top: 0;
                bottom: 0;
                z-index: 90;
                box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
            }
        }

        .suggestion-chip {
            background: rgba(5, 10, 18, 0.6);
            border: 1px solid var(--border-dark);
            color: var(--text-dark-theme);
            padding: 14px 18px;
            border-radius: 12px;
            font-size: 0.88rem;
            font-weight: 600;
            text-align: left;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .suggestion-chip .chip-tag {
            font-size: 0.7rem;
            color: var(--primary);
            text-transform: uppercase;
            display: block;
            margin-bottom: 2px;
            font-weight: 700;
            letter-spacing: 0.05em;
        }

        .suggestion-chip:hover {
            border-color: var(--primary-light);
            background: rgba(201, 151, 56, 0.1);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(201, 151, 56, 0.15);
        }

        /* ── Message Rows & Bubbles ─────────────────────── */
        .message-row {
            display: flex;
            width: 100%;
            max-width: 860px;
            margin: 0 auto;
            animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
        }

        .message-row.user {
            justify-content: flex-end;
        }

        .message-row.assistant {
            justify-content: flex-start;
        }

        .message-bubble {
            max-width: 85%;
            padding: 18px 22px;
            border-radius: 18px;
            font-size: 0.94rem;
            line-height: 1.65;
            position: relative;
        }

        .message-row.user .message-bubble {
            background-color: var(--bg-deep);
            border: 1.5px solid var(--border-dark);
            color: var(--text-dark-theme);
            border-bottom-right-radius: 4px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
        }

        .message-row.assistant .message-bubble {
            background-color: rgba(14, 28, 48, 0.7);
            border: 1.5px solid var(--border-light);
            color: var(--text-dark-theme);
            border-bottom-left-radius: 4px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        }

        .message-meta {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            margin-bottom: 8px;
            color: var(--primary-light);
        }

        .message-row.user .message-meta {
            justify-content: flex-end;
            color: var(--text-muted-dark);
        }

        /* ── Quran Ayat Card (Rich Component) ───────────── */
        .quran-verse-card {
            margin: 16px 0;
            background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.08), rgba(5, 10, 18, 0.95));
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            padding: 18px;
            position: relative;
            box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
        }

        .quran-verse-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid var(--border-light);
            padding-bottom: 10px;
            margin-bottom: 14px;
        }

        .quran-verse-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--primary-light);
            background: rgba(201, 151, 56, 0.12);
            padding: 4px 10px;
            border-radius: 6px;
            border: 1px solid var(--border-dark);
        }

        .quran-verse-actions {
            display: flex;
            gap: 6px;
        }

        .btn-verse-action {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--border-light);
            color: var(--text-dark-theme);
            width: 32px;
            height: 32px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.8rem;
        }

        .btn-verse-action:hover {
            background: var(--primary);
            color: #000;
            border-color: var(--primary);
        }

        .btn-verse-action.playing {
            background: #10B981;
            color: #fff;
            border-color: #10B981;
            animation: pulse 1.5s infinite;
        }

        .quran-verse-card.playing-verse {
            border-color: var(--primary) !important;
            background: rgba(201, 151, 56, 0.12) !important;
            box-shadow: 0 0 20px rgba(201, 151, 56, 0.25);
        }

        .btn-header.playing {
            background: linear-gradient(135deg, #10B981, #059669) !important;
            border-color: #34D399 !important;
            color: #fff !important;
        }

        .quran-arabic-text {
            font-family: var(--font-arabic);
            font-size: 1.7rem;
            line-height: 2.2;
            text-align: right;
            color: #FFFFFF;
            margin-bottom: 14px;
            direction: rtl;
            padding: 4px 6px;
            letter-spacing: 0.02em;
        }

        .quran-translation-text {
            font-size: 0.92rem;
            color: #E2E8F0;
            line-height: 1.6;
            margin-bottom: 12px;
            font-style: normal;
            border-left: 2.5px solid var(--primary);
            padding-left: 12px;
        }

        .quran-tafsir-accordion {
            margin-top: 10px;
            border-top: 1px dashed var(--border-light);
            padding-top: 10px;
        }

        .quran-tafsir-toggle {
            background: none;
            border: none;
            color: var(--primary-light);
            font-size: 0.78rem;
            font-weight: 700;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 0;
        }

        .quran-tafsir-content {
            display: none;
            margin-top: 10px;
            font-size: 0.84rem;
            color: var(--text-muted-dark);
            background: rgba(0, 0, 0, 0.4);
            padding: 12px 14px;
            border-radius: 8px;
            line-height: 1.65;
            max-height: 280px;
            overflow-y: auto;
            white-space: pre-line;
            border: 1px solid rgba(255, 255, 255, 0.05);
        }

        .quran-tafsir-content.expanded {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        /* Markdown inside bubble */
        .message-bubble-content h1,
        .message-bubble-content h2,
        .message-bubble-content h3 {
            font-family: var(--font-serif);
            color: #fff;
            margin: 14px 0 8px 0;
            font-weight: 700;
        }

        .message-bubble-content h3 {
            font-size: 1.1rem;
            color: var(--primary-light);
            border-left: 3px solid var(--primary);
            padding-left: 10px;
        }

        .message-bubble-content p {
            margin-bottom: 10px;
        }

        .message-bubble-content p:last-child {
            margin-bottom: 0;
        }

        .message-bubble-content ul,
        .message-bubble-content ol {
            margin-left: 20px;
            margin-bottom: 12px;
        }

        .message-bubble-content li {
            margin-bottom: 4px;
        }

        .message-bubble-content blockquote,
        #modal-surah-body blockquote {
            border-left: 3.5px solid var(--primary);
            background: rgba(201, 151, 56, 0.08);
            padding: 10px 16px;
            margin: 14px 0;
            border-radius: 0 10px 10px 0;
            font-style: italic;
            color: #E2E8F0;
            line-height: 1.6;
        }

        .message-bubble-content table,
        #modal-surah-body table {
            width: 100%;
            border-collapse: collapse;
            margin: 16px 0;
            font-size: 0.84rem;
            border-radius: 8px;
            overflow: hidden;
        }

        .message-bubble-content th,
        #modal-surah-body th {
            background: rgba(201, 151, 56, 0.18);
            color: var(--primary-light);
            padding: 9px 12px;
            border: 1px solid var(--border-dark);
            text-align: left;
            font-weight: 700;
        }

        .message-bubble-content td,
        #modal-surah-body td {
            padding: 8px 12px;
            border: 1px solid rgba(255, 255, 255, 0.06);
            background: rgba(5, 10, 18, 0.45);
        }

        /* ── Mermaid Diagram Rendering Box ─────────────── */
        .mermaid-diagram-box {
            background: radial-gradient(circle at center, rgba(14, 28, 48, 0.9), rgba(5, 10, 18, 0.98));
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            padding: 16px 18px;
            margin: 18px 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow-x: auto;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
            position: relative;
        }

        .mermaid-diagram-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            border-bottom: 1px dashed var(--border-light);
            padding-bottom: 10px;
            margin-bottom: 14px;
            flex-wrap: wrap;
            gap: 8px;
        }

        .mermaid-diagram-title {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--primary-light);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .mermaid-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .btn-diagram-tool {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-light);
            color: var(--primary-light);
            font-size: 0.7rem;
            font-weight: 600;
            padding: 3px 9px;
            border-radius: 6px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s;
        }

        .btn-diagram-tool:hover {
            background: var(--primary);
            color: #000;
            border-color: var(--primary-light);
        }

        .mermaid {
            width: 100%;
            display: flex;
            justify-content: center;
        }

        .mermaid svg {
            max-width: 100% !important;
            height: auto !important;
        }

        /* ── Knowledge Base Action Bar inside AI Bubble ──── */
        .bubble-action-bar {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 8px;
            margin-top: 14px;
            padding-top: 10px;
            border-top: 1px dashed rgba(201, 151, 56, 0.18);
        }

        .btn-bubble-action {
            background: rgba(201, 151, 56, 0.08);
            border: 1px solid var(--border-dark);
            color: var(--primary-light);
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.72rem;
            font-weight: 600;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 5px;
            transition: all 0.2s;
        }

        .btn-bubble-action:hover {
            background: var(--primary);
            color: #000;
        }

        /* ── Knowledge Item in Sidebar Tab ──────────────── */
        .knowledge-card {
            padding: 12px 14px;
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.02);
            border: 1px solid var(--border-light);
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .knowledge-card:hover {
            background: rgba(201, 151, 56, 0.08);
            border-color: var(--primary);
            transform: translateY(-2px);
        }

        .knowledge-card-title {
            font-weight: 700;
            font-size: 0.85rem;
            color: #fff;
        }

        .knowledge-card-date {
            font-size: 0.68rem;
            color: var(--text-muted-dark);
        }

        /* Typing Loader */
        .typing-loader {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 0;
        }

        .typing-dot {
            width: 8px;
            height: 8px;
            background-color: var(--primary);
            border-radius: 50%;
            animation: typingBounce 1.4s infinite ease-in-out both;
        }

        .typing-dot:nth-child(1) {
            animation-delay: -0.32s;
        }

        .typing-dot:nth-child(2) {
            animation-delay: -0.16s;
        }

        @keyframes typingBounce {

            0%,
            80%,
            100% {
                transform: scale(0);
            }

            40% {
                transform: scale(1.0);
            }
        }

        /* ── Input & Footer Area ────────────────────────── */
        #footer {
            padding: 16px 24px 22px;
            background-color: rgba(5, 10, 18, 0.92);
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            border-top: 1.5px solid var(--border-dark);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            z-index: 10;
        }

        .footer-container {
            width: 100%;
            max-width: 860px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .quick-chips-bar {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding-bottom: 4px;
            scrollbar-width: none;
        }

        .quick-chips-bar::-webkit-scrollbar {
            display: none;
        }

        .quick-chip-btn {
            background: rgba(201, 151, 56, 0.08);
            border: 1px solid var(--border-light);
            color: var(--primary-light);
            padding: 4px 12px;
            border-radius: 100px;
            font-size: 0.75rem;
            white-space: nowrap;
            cursor: pointer;
            transition: all 0.2s;
        }

        .quick-chip-btn:hover {
            background: var(--primary);
            color: #000;
        }

        .input-box {
            display: flex;
            align-items: flex-end;
            background: var(--bg-deep);
            border: 1.5px solid var(--border-dark);
            border-radius: 18px;
            padding: 10px 16px;
            gap: 12px;
            transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .input-box:focus-within {
            border-color: var(--primary);
            box-shadow: 0 0 22px rgba(201, 151, 56, 0.25);
        }

        textarea#chat-input {
            flex: 1;
            background: transparent;
            border: none;
            color: #fff;
            font-family: var(--font-sans);
            font-size: 0.95rem;
            line-height: 1.5;
            resize: none;
            outline: none;
            max-height: 140px;
            min-height: 24px;
        }

        .send-btn,
        .stop-btn {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            border: 1px solid var(--primary-light);
            color: #fff;
            width: 40px;
            height: 40px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .send-btn:hover {
            background: var(--primary-light);
            color: #000;
            transform: scale(1.05);
        }

        .stop-btn {
            background: #E11D48;
            border-color: #FB7185;
            display: none;
        }

        .footer-meta {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            width: 100%;
            font-size: 0.72rem;
            color: var(--text-muted-dark);
            gap: 4px;
        }

        /* ── Dedicated Surah Page View ─────────────────── */
        .surah-page-container {
            flex: 1;
            height: 100%;
            overflow-y: auto;
            padding: 24px 32px 60px;
            background: radial-gradient(circle at top right, rgba(201, 151, 56, 0.05), transparent 60%), var(--bg-dark);
            display: flex;
            flex-direction: column;
        }

        .surah-page-header {
            display: flex;
            flex-direction: column;
            align-items: center;
            background: rgba(5, 10, 18, 0.88);
            border: 1.5px solid var(--border-dark);
            border-radius: 16px;
            padding: 22px 24px;
            margin-bottom: 22px;
            gap: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
            width: 100%;
            box-sizing: border-box;
        }

        .surah-header-top-row {
            width: 100%;
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }

        .btn-back-home {
            background: rgba(255, 255, 255, 0.06);
            border: 1px solid var(--border-light);
            color: #fff;
            padding: 8px 16px;
            border-radius: 10px;
            font-size: 0.82rem;
            font-weight: 700;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
        }

        .btn-back-home:hover {
            background: var(--primary);
            color: #000;
            border-color: var(--primary-light);
            transform: translateX(-3px);
        }

        .surah-page-title-box {
            width: 100%;
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .surah-page-title {
            font-family: var(--font-serif);
            font-size: 1.65rem;
            font-weight: 700;
            color: var(--primary-light);
            margin-bottom: 6px;
            text-align: center;
        }

        .surah-page-meta {
            font-size: 0.86rem;
            color: var(--text-muted-dark);
            text-align: center;
        }

        .surah-page-body {
            max-width: 1100px;
            width: 100%;
            margin: 0 auto;
        }

        .surah-page-controls {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            width: 100%;
        }

        .surah-jump-box {
            display: inline-flex;
            align-items: center;
            background: rgba(201, 151, 56, 0.1);
            border: 1px solid var(--border-dark);
            border-radius: 8px;
            padding: 0 10px;
            height: 38px;
        }

        .surah-jump-label {
            font-size: 0.75rem;
            color: var(--primary-light);
            margin-right: 4px;
            font-weight: 700;
        }

        .surah-jump-select {
            background: transparent;
            border: none;
            color: #fff;
            padding: 6px 4px;
            font-size: 0.78rem;
            font-weight: 700;
            outline: none;
            cursor: pointer;
        }

        .surah-action-buttons {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        /* ── Modal Surah Reader ─────────────────────────── */
        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(8px);
            z-index: 100;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .modal-backdrop.open {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-card {
            width: 90%;
            max-width: 900px;
            height: 85vh;
            background: var(--bg-dark);
            border: 1.5px solid var(--border-dark);
            border-radius: 20px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
            transform: scale(0.95);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .modal-backdrop.open .modal-card {
            transform: scale(1);
        }

        .modal-header {
            padding: 18px 24px;
            background: rgba(5, 10, 18, 0.95);
            border-bottom: 1.5px solid var(--border-dark);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-title {
            font-family: var(--font-serif);
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--primary-light);
        }

        .modal-close-btn {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid var(--border-light);
            color: #fff;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .modal-close-btn:hover {
            background: #E11D48;
            border-color: #E11D48;
        }

        .modal-body {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
        }

        /* ── Surah Modal Sub-Tabs (Baca Ayat vs Summary & Relate Kehidupan) ── */
        .surah-modal-nav {
            display: flex;
            gap: 8px;
            margin-bottom: 20px;
            background: rgba(5, 10, 18, 0.8);
            padding: 6px;
            border-radius: 12px;
            border: 1px solid var(--border-dark);
        }

        .surah-modal-tab-btn {
            flex: 1;
            background: transparent;
            border: none;
            color: var(--text-muted-dark);
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.25s;
        }

        .surah-modal-tab-btn:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.04);
        }

        .surah-modal-tab-btn.active {
            background: var(--primary);
            color: #000;
            box-shadow: 0 4px 12px rgba(201, 151, 56, 0.35);
        }

        .summary-section-header {
            font-family: var(--font-serif);
            font-size: 1.15rem;
            font-weight: 700;
            color: var(--primary-light);
            margin: 24px 0 12px 0;
            display: flex;
            align-items: center;
            gap: 8px;
            border-bottom: 1px dashed var(--border-light);
            padding-bottom: 8px;
        }

        .summary-table-container {
            background: rgba(5, 10, 18, 0.75);
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            overflow-x: auto;
            margin-bottom: 24px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
        }

        .summary-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.88rem;
            line-height: 1.65;
            text-align: left;
        }

        .summary-table th {
            background: linear-gradient(90deg, rgba(201, 151, 56, 0.22), rgba(16, 41, 35, 0.5));
            color: var(--primary-light);
            padding: 12px 16px;
            font-weight: 700;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            border-bottom: 1.5px solid var(--border-dark);
        }

        .summary-table td {
            padding: 14px 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
            vertical-align: top;
            color: #F1F5F9;
        }

        .summary-table tbody tr:hover {
            background: rgba(201, 151, 56, 0.06);
        }

        .summary-table tbody tr:last-child td {
            border-bottom: none;
        }

        .relate-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
            gap: 14px;
            margin-bottom: 24px;
        }

        @media (max-width: 768px) {
            .relate-grid {
                grid-template-columns: 1fr;
            }
        }

        .relate-card {
            background: rgba(14, 28, 48, 0.65);
            border: 1.5px solid var(--border-light);
            border-radius: 14px;
            padding: 16px 18px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            transition: all 0.25s;
        }

        .relate-card:hover {
            background: rgba(201, 151, 56, 0.08);
            border-color: var(--primary);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
        }

        .relate-card-top {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 8px;
        }

        .relate-theme-title {
            font-size: 0.92rem;
            font-weight: 700;
            color: #fff;
            line-height: 1.35;
        }

        .relate-verse-badge {
            background: rgba(16, 185, 129, 0.18);
            color: #34D399;
            border: 1px solid rgba(16, 185, 129, 0.4);
            padding: 3px 9px;
            border-radius: 20px;
            font-size: 0.72rem;
            font-weight: 700;
            white-space: nowrap;
        }

        .relate-card-desc {
            font-size: 0.84rem;
            color: var(--text-dark-theme);
            line-height: 1.6;
        }

        .key-verse-box {
            background: linear-gradient(145deg, rgba(201, 151, 56, 0.08), rgba(5, 10, 18, 0.9));
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            padding: 16px 20px;
            margin-bottom: 14px;
        }

        .key-verse-title {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--primary-light);
            margin-bottom: 4px;
        }

        .key-verse-desc {
            font-size: 0.86rem;
            color: var(--text-muted-dark);
            line-height: 1.65;
        }

        /* Floating Toast */
        .toast-container {
            position: fixed;
            bottom: 100px;
            right: 24px;
            z-index: 999;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .toast {
            background: var(--bg-deep);
            border: 1.5px solid var(--primary);
            color: #fff;
            padding: 12px 18px;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            font-size: 0.85rem;
            animation: fadeIn 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(8px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes slideUp {
            from {
                opacity: 0;
                transform: translateY(14px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .quran-verse-card.verse-highlight-active {
            border-color: var(--primary-light) !important;
            box-shadow: 0 0 35px rgba(201, 151, 56, 0.65) !important;
            background: radial-gradient(circle at top right, rgba(201, 151, 56, 0.22), rgba(5, 10, 18, 0.98)) !important;
            transform: scale(1.015);
            transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        /* ── Sticky & Floating Verse Quick Navigator (Anti-Scroll Ke Atas) ── */
        .sticky-verse-navigator {
            position: sticky;
            top: 8px;
            z-index: 40;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(5, 10, 18, 0.9);
            backdrop-filter: blur(18px);
            -webkit-backdrop-filter: blur(18px);
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            padding: 10px 18px;
            margin-bottom: 22px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
            flex-wrap: wrap;
            gap: 10px;
            transition: all 0.25s ease;
        }

        .sticky-verse-navigator:hover {
            border-color: var(--primary);
            box-shadow: 0 12px 35px rgba(201, 151, 56, 0.25);
        }

        .ai-provider-select {
            background: rgba(201, 151, 56, 0.1);
            border: 1px solid var(--border-dark);
            color: var(--primary-light);
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 0.78rem;
            font-weight: 600;
            outline: none;
            cursor: pointer;
            transition: all 0.2s;
        }

        .ai-provider-select:hover {
            border-color: var(--primary);
        }

        /* ── Auth Gate Modal Overlay (Proteksi Password Sirojan) ── */
        .auth-gate-overlay {
            position: fixed;
            inset: 0;
            background: radial-gradient(circle at center, rgba(14, 28, 48, 0.96), rgba(3, 7, 13, 0.99));
            backdrop-filter: blur(28px);
            -webkit-backdrop-filter: blur(28px);
            z-index: 99999;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            animation: fadeIn 0.3s ease;
        }

        .auth-gate-card {
            width: 100%;
            max-width: 430px;
            background: linear-gradient(165deg, rgba(14, 28, 48, 0.95), rgba(5, 10, 18, 0.98));
            border: 1.5px solid var(--border-dark);
            border-radius: 24px;
            padding: 38px 32px;
            text-align: center;
            box-shadow: 0 30px 70px rgba(0, 0, 0, 0.85);
            position: relative;
            transform: scale(1);
            animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .auth-gate-card::before {
            content: '';
            position: absolute;
            inset: -1.5px;
            border-radius: 25px;
            padding: 1.5px;
            background: linear-gradient(135deg, rgba(201, 151, 56, 0.6), transparent, rgba(52, 211, 153, 0.4));
            -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            pointer-events: none;
        }

        /* ── Modal Pop-up Dialog Styling ── */
        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.78);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .modal-backdrop.open {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-card {
            width: 90%;
            max-width: 920px;
            height: 85vh;
            max-height: 88vh;
            background: var(--bg-dark);
            border: 1.5px solid var(--border-dark);
            border-radius: 20px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
            transform: scale(0.95);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .modal-backdrop.open .modal-card {
            transform: scale(1);
        }

        .modal-header {
            padding: 18px 24px;
            background: rgba(5, 10, 18, 0.95);
            border-bottom: 1.5px solid var(--border-dark);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
        }

        .modal-title {
            font-family: var(--font-serif);
            font-size: 1.25rem;
            font-weight: 700;
            color: var(--primary-light);
        }

        .modal-close-btn {
            background: rgba(255, 255, 255, 0.08);
            border: 1px solid var(--border-light);
            color: #fff;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 1rem;
            flex-shrink: 0;
        }

        .modal-close-btn:hover {
            background: #E11D48;
            border-color: #E11D48;
            transform: scale(1.05);
        }

        .modal-body {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
        }

        /* ── COMPREHENSIVE RESPONSIVE MOBILE OPTIMIZATIONS ── */
        .sidebar-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            z-index: 90;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .sidebar-backdrop.active {
            display: block;
            opacity: 1;
        }

        @media (max-width: 768px) {

            /* Header Mobile - Zero Overflow / Anti-Offside & Absolute Positioning */
            .header {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                width: 100%;
                z-index: 50;
                padding: 8px 10px;
                gap: 6px;
                flex-wrap: nowrap;
                max-width: 100%;
                box-sizing: border-box;
                background-color: rgba(5, 10, 18, 0.95);
                backdrop-filter: blur(20px);
                -webkit-backdrop-filter: blur(20px);
            }

            .app-body {
                height: 100%;
                height: 100dvh;
                padding-top: 50px;
                box-sizing: border-box;
            }

            .header-left {
                gap: 6px;
                min-width: 0;
                flex-shrink: 1;
            }

            .sidebar-toggle-btn {
                width: 32px;
                height: 32px;
                flex-shrink: 0;
            }

            .header-logo-monogram {
                width: 30px;
                height: 30px;
                font-size: 1.15rem;
                flex-shrink: 0;
            }

            .header-title-text {
                font-size: 1.05rem;
                white-space: nowrap;
            }

            .quran-badge {
                display: none !important;
            }

            .header-actions {
                gap: 4px;
                flex-shrink: 0;
                display: flex;
                align-items: center;
            }

            .ai-provider-select {
                max-width: 82px;
                font-size: 0.68rem;
                padding: 4px 4px;
                height: 32px;
                border-radius: 7px;
            }

            .header-actions .btn-header {
                width: 32px;
                height: 32px;
                padding: 0;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 7px;
                flex-shrink: 0;
            }

            .header-actions .btn-header span {
                display: none !important;
            }

            .header-actions .btn-header svg {
                margin: 0;
                width: 15px;
                height: 15px;
            }

            /* Sidebar Floating Drawer di HP */
            .sidebar {
                position: fixed;
                left: 0;
                top: 0;
                bottom: 0;
                width: 82vw;
                max-width: 320px;
                height: 100vh;
                z-index: 100;
                box-shadow: 10px 0 35px rgba(0, 0, 0, 0.75);
                transform: translateX(0);
                transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            }

            .sidebar.closed {
                transform: translateX(-100%);
            }

            /* Chat Container Mobile */
            #messages {
                padding: 16px 12px 20px;
                gap: 18px;
            }

            #messages.initial {
                justify-content: flex-start;
                padding-top: 24px;
            }

            .greeting {
                margin: 20px auto 0;
                padding: 12px 8px 30px;
                width: 100%;
            }

            .message-bubble {
                max-width: 95%;
                padding: 14px 16px;
                font-size: 0.9rem;
            }

            .quran-arabic-text {
                font-size: 1.45rem;
                line-height: 2.1;
            }

            .quran-translation-text {
                font-size: 0.86rem;
            }

            #footer {
                padding: 10px 12px 14px;
            }

            .footer-container {
                gap: 6px;
            }

            .input-box {
                padding: 8px 12px;
            }

            textarea#chat-input {
                font-size: 0.88rem;
            }

            .send-btn,
            .stop-btn {
                width: 36px;
                height: 36px;
            }

            .footer-meta {
                flex-direction: column;
                align-items: center;
                text-align: center;
                gap: 3px;
                font-size: 0.65rem;
            }

            /* Dedicated Surah Page View di Mobile */
            .surah-page-container {
                padding: 12px 10px 60px;
            }

            .surah-page-header {
                padding: 14px 14px;
                margin-bottom: 14px;
                border-radius: 12px;
                flex-direction: column;
                align-items: stretch;
                gap: 12px;
            }

            .btn-back-home {
                width: 100%;
                justify-content: center;
                padding: 9px 14px;
            }

            .surah-page-title-box {
                text-align: center;
            }

            .surah-page-title {
                font-size: 1.25rem;
            }

            .surah-page-meta {
                font-size: 0.75rem;
            }

            .surah-page-controls {
                display: flex;
                flex-direction: column;
                width: 100%;
                gap: 10px;
                align-items: stretch;
            }

            .surah-jump-box {
                width: 100%;
                justify-content: space-between;
                padding: 0 12px;
                height: 38px;
                box-sizing: border-box;
            }

            .surah-jump-select {
                flex: 1;
                font-size: 0.82rem;
            }

            .surah-action-buttons {
                display: grid;
                grid-template-columns: 1fr 1fr;
                gap: 8px;
                width: 100%;
            }

            .surah-action-buttons .btn-header {
                width: 100%;
                justify-content: center;
                height: 38px;
                font-size: 0.82rem;
                padding: 8px 10px;
                white-space: nowrap;
            }

            .surah-modal-nav {
                padding: 4px;
                gap: 4px;
                margin-bottom: 14px;
            }

            .surah-modal-tab-btn {
                padding: 8px 6px;
                font-size: 0.75rem;
            }

            .summary-table-container {
                border-radius: 10px;
                margin-bottom: 16px;
            }

            .summary-table {
                font-size: 0.8rem;
            }

            .summary-table th {
                padding: 9px 10px;
                font-size: 0.72rem;
            }

            .summary-table td {
                padding: 10px 10px;
            }

            .mermaid-diagram-box {
                padding: 12px 8px;
                margin: 14px 0;
                border-radius: 10px;
            }

            .mermaid-diagram-title {
                font-size: 0.72rem;
            }

            /* Modal Box di Mobile */
            .modal-card {
                width: 96%;
                height: 92vh;
                border-radius: 14px;
            }

            .modal-header {
                padding: 14px 16px;
            }

            .modal-title {
                font-size: 1.1rem;
            }

            .modal-body {
                padding: 14px 12px;
            }
        }

        @media (max-width: 480px) {
            .header-title-text {
                font-size: 1rem;
            }

            .bismillah-hero {
                font-size: 1.6rem;
            }

            .greeting-text {
                font-size: 1.45rem;
            }

            .greeting-desc {
                font-size: 0.85rem;
            }

            .quick-chip-btn {
                font-size: 0.7rem;
                padding: 3px 10px;
            }
        }

        /* ── Bookmark & Last Read Styling ── */
        .btn-verse-action.bookmarked-active {
            color: #F59E0B !important;
            border-color: rgba(245, 158, 11, 0.6) !important;
            background: rgba(245, 158, 11, 0.2) !important;
            box-shadow: 0 0 12px rgba(245, 158, 11, 0.4) !important;
            transform: scale(1.08);
        }

        .last-read-hero-card {
            background: linear-gradient(135deg, rgba(201, 151, 56, 0.22), rgba(7, 34, 28, 0.7));
            border: 1.5px solid var(--primary);
            border-radius: 14px;
            padding: 16px;
            margin-bottom: 14px;
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .last-read-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-size: 0.68rem;
            font-weight: 800;
            color: #000;
            background: linear-gradient(135deg, var(--primary), var(--primary-light));
            padding: 3px 8px;
            border-radius: 6px;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            width: fit-content;
        }

        .last-read-title {
            font-size: 0.96rem;
            font-weight: 700;
            color: #fff;
            line-height: 1.3;
        }

        .last-read-date {
            font-size: 0.72rem;
            color: var(--text-muted-dark);
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .bookmark-list-item {
            background: rgba(14, 28, 48, 0.75);
            border: 1px solid var(--border-light);
            border-radius: 12px;
            padding: 12px 14px;
            margin-bottom: 10px;
            transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            flex-direction: column;
            gap: 8px;
            cursor: pointer;
        }

        .bookmark-list-item:hover {
            border-color: var(--primary);
            background: rgba(201, 151, 56, 0.09);
            transform: translateX(3px);
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        }

        .bookmark-item-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }

        .bookmark-surah-tag {
            font-size: 0.82rem;
            font-weight: 700;
            color: var(--primary-light);
        }

        .bookmark-time-tag {
            font-size: 0.68rem;
            color: var(--text-muted-dark);
            background: rgba(255, 255, 255, 0.05);
            padding: 2px 7px;
            border-radius: 6px;
        }

        .bookmark-arabic-snippet {
            font-family: var(--font-arabic);
            font-size: 1.15rem;
            color: #FAF9F6;
            text-align: right;
            direction: rtl;
            line-height: 1.8;
            max-height: 52px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .bookmark-trans-snippet {
            font-size: 0.76rem;
            color: var(--text-muted-dark);
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .bookmark-actions-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-top: 6px;
            border-top: 1px solid rgba(255, 255, 255, 0.05);
            margin-top: 2px;
        }
    
        .wbw-verse-container {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin: 16px 0 20px 0;
            padding: 14px 16px;
            background: rgba(5, 10, 18, 0.6);
            border-radius: 12px;
            border: 1px solid rgba(201, 151, 56, 0.2);
            direction: rtl;
            justify-content: flex-start;
            text-align: right;
        }

        .wbw-word-card {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding: 8px 12px;
            background: rgba(14, 28, 48, 0.7);
            border: 1px solid rgba(201, 151, 56, 0.25);
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.22s ease;
            user-select: none;
            min-width: 65px;
            text-align: center;
        }

        .wbw-word-card:hover {
            border-color: var(--primary);
            background: rgba(201, 151, 56, 0.18);
            transform: translateY(-2px);
            box-shadow: 0 4px 14px rgba(201, 151, 56, 0.25);
        }

        .wbw-word-ar {
            font-family: var(--font-arabic);
            font-size: 1.6rem;
            color: var(--primary-light);
            line-height: 1.4;
            direction: rtl;
        }

        .wbw-word-tr {
            font-size: 0.72rem;
            color: #FAF9F6;
            margin-top: 4px;
            font-weight: 500;
            direction: ltr;
            max-width: 110px;
            white-space: normal;
        }

        .wbw-word-root {
            font-size: 0.64rem;
            color: #34D399;
            background: rgba(16, 185, 129, 0.12);
            padding: 1px 6px;
            border-radius: 6px;
            margin-top: 4px;
            font-family: var(--font-arabic);
            direction: rtl;
        }

        .morphology-badge-active {
            background: rgba(16, 185, 129, 0.2) !important;
            border-color: #10B981 !important;
            color: #34D399 !important;
        }

        /* Root Explorer Modal & Cards */
        .root-hero-card {
            background: linear-gradient(135deg, rgba(201,151,56,0.15), rgba(7,34,28,0.4));
            border: 1.5px solid var(--primary);
            border-radius: 14px;
            padding: 22px;
            margin-bottom: 20px;
            text-align: center;
        }

        .root-letters-big {
            font-family: var(--font-arabic);
            font-size: 2.8rem;
            color: var(--primary-light);
            letter-spacing: 6px;
            margin-bottom: 6px;
        }

        .root-info-pill {
            display: inline-block;
            background: rgba(201,151,56,0.2);
            border: 1px solid rgba(201,151,56,0.4);
            color: var(--text-gold);
            font-size: 0.76rem;
            padding: 3px 10px;
            border-radius: 20px;
            margin: 4px;
            font-weight: 600;
        }

        .derivative-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 12px;
            margin: 16px 0;
        }

        .derivative-card {
            background: rgba(14, 28, 48, 0.8);
            border: 1px solid var(--border-dark);
            border-radius: 10px;
            padding: 12px 14px;
            transition: all 0.2s;
        }

        .derivative-card:hover {
            border-color: var(--primary-light);
            background: rgba(201,151,56,0.1);
        }

        .derivative-form-ar {
            font-family: var(--font-arabic);
            font-size: 1.35rem;
            color: var(--primary-light);
            margin-bottom: 4px;
        }

        .derivative-wazan {
            font-size: 0.72rem;
            color: #38BDF8;
            background: rgba(56,189,248,0.1);
            padding: 2px 6px;
            border-radius: 6px;
            display: inline-block;
            margin-bottom: 4px;
        }

        .derivative-meaning {
            font-size: 0.8rem;
            color: #E2E8F0;
            line-height: 1.4;
        }

        /* =========================================================================
           ACADEMIC RESEARCH & PAPERS (OPENALEX INTEGRATION)
           ========================================================================= */
        .research-header-card {
            background: linear-gradient(135deg, rgba(14, 28, 48, 0.95), rgba(11, 25, 44, 0.95));
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            padding: 20px 24px;
            margin-bottom: 22px;
            position: relative;
            overflow: hidden;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
        }

        .research-header-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--primary), #38BDF8, var(--primary-light));
        }

        .research-header-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(201, 151, 56, 0.15);
            border: 1px solid rgba(201, 151, 56, 0.35);
            color: var(--primary-light);
            font-size: 0.74rem;
            font-weight: 700;
            padding: 4px 10px;
            border-radius: 20px;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            margin-bottom: 8px;
        }

        .research-search-container {
            display: flex;
            gap: 8px;
            margin-top: 14px;
            flex-wrap: wrap;
        }

        .research-search-input {
            flex: 1;
            min-width: 240px;
            background: rgba(5, 10, 18, 0.85);
            border: 1.5px solid var(--border-dark);
            border-radius: 10px;
            padding: 10px 14px;
            color: #fff;
            font-size: 0.88rem;
            outline: none;
            transition: all 0.2s;
        }

        .research-search-input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 12px rgba(201, 151, 56, 0.25);
        }

        .research-cards-grid {
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .research-paper-card {
            background: rgba(14, 28, 48, 0.85);
            border: 1px solid var(--border-dark);
            border-radius: 12px;
            padding: 18px 20px;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .research-paper-card:hover {
            border-color: rgba(201, 151, 56, 0.45);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
            background: rgba(18, 35, 60, 0.9);
        }

        .research-meta-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 10px;
        }

        .research-tags-group {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 6px;
        }

        .research-tag {
            font-size: 0.72rem;
            padding: 2px 8px;
            border-radius: 6px;
            font-weight: 600;
        }

        .research-tag.journal {
            background: rgba(56, 189, 248, 0.12);
            color: #38BDF8;
            border: 1px solid rgba(56, 189, 248, 0.3);
        }

        .research-tag.oa {
            background: rgba(16, 185, 129, 0.15);
            color: #34D399;
            border: 1px solid rgba(16, 185, 129, 0.35);
        }

        .research-tag.closed {
            background: rgba(148, 163, 184, 0.1);
            color: #94A3B8;
            border: 1px solid rgba(148, 163, 184, 0.25);
        }

        .research-tag.year {
            background: rgba(201, 151, 56, 0.12);
            color: var(--primary-light);
            border: 1px solid rgba(201, 151, 56, 0.25);
        }

        .research-citation-count {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.75rem;
            font-weight: 700;
            color: #FBBF24;
            background: rgba(251, 191, 36, 0.12);
            border: 1px solid rgba(251, 191, 36, 0.3);
            padding: 2px 8px;
            border-radius: 6px;
        }

        .research-paper-title {
            font-family: var(--font-sans);
            font-size: 1.05rem;
            font-weight: 700;
            color: #FAF9F6;
            line-height: 1.45;
            margin-bottom: 8px;
        }

        .research-paper-title a {
            color: #FAF9F6;
            text-decoration: none;
            transition: color 0.2s;
        }

        .research-paper-title a:hover {
            color: var(--primary-light);
            text-decoration: underline;
        }

        .research-authors-text {
            font-size: 0.8rem;
            color: #94A3B8;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .research-topic-pill {
            font-size: 0.73rem;
            color: #CBD5E1;
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid var(--border-light);
            padding: 3px 8px;
            border-radius: 6px;
            display: inline-block;
        }

        .research-card-actions {
            display: flex;
            justify-content: flex-end;
            align-items: center;
            gap: 8px;
            margin-top: 14px;
            padding-top: 12px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
            flex-wrap: wrap;
        }

        .research-tab-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: #38BDF8;
            color: #04101E;
            font-size: 0.65rem;
            font-weight: 800;
            padding: 1px 6px;
            border-radius: 10px;
            margin-left: 4px;
        }

        .research-skeleton-card {
            background: rgba(14, 28, 48, 0.6);
            border: 1px solid var(--border-dark);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 12px;
            animation: pulseSkeleton 1.5s infinite;
        }

        @keyframes pulseSkeleton {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 0.9; }
        }

        /* ── Target Membaca Al-Qur'an (Reading Goals & Khatam Planner) ── */
        .target-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 14px;
            margin-bottom: 20px;
            width: 100%;
        }

        .target-stat-card {
            background: rgba(14, 28, 48, 0.7);
            border: 1px solid var(--border-dark);
            border-radius: 14px;
            padding: 16px 18px;
            display: flex;
            align-items: center;
            gap: 14px;
            transition: all 0.25s ease;
        }

        .target-stat-card:hover {
            border-color: var(--primary-light);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
        }

        .target-stat-icon {
            width: 44px;
            height: 44px;
            border-radius: 12px;
            background: rgba(201, 151, 56, 0.12);
            color: var(--primary-light);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.35rem;
            flex-shrink: 0;
        }

        .target-stat-info {
            display: flex;
            flex-direction: column;
        }

        .target-stat-val {
            font-size: 1.45rem;
            font-weight: 800;
            color: #fff;
            line-height: 1.2;
        }

        .target-stat-label {
            font-size: 0.76rem;
            color: var(--text-muted-dark);
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-top: 2px;
        }

        .target-progress-container {
            background: rgba(5, 10, 18, 0.85);
            border: 1px solid var(--border-dark);
            border-radius: 14px;
            padding: 18px 20px;
            margin-bottom: 20px;
            width: 100%;
            box-sizing: border-box;
        }

        .target-progress-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            flex-wrap: wrap;
            gap: 8px;
        }

        .target-progress-bar-bg {
            width: 100%;
            height: 12px;
            background: rgba(255, 255, 255, 0.08);
            border-radius: 8px;
            overflow: hidden;
            position: relative;
        }

        .target-progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, #10B981, #34D399, #F59E0B);
            border-radius: 8px;
            transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
            box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
        }

        .target-filter-bar {
            background: rgba(14, 28, 48, 0.6);
            border: 1px solid var(--border-dark);
            border-radius: 14px;
            padding: 14px 18px;
            margin-bottom: 20px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            width: 100%;
            box-sizing: border-box;
        }

        .target-filter-pills-row {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
        }

        .target-pill-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border-light);
            color: var(--text-dark-theme);
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .target-pill-btn:hover {
            background: rgba(201, 151, 56, 0.15);
            border-color: var(--primary-light);
            color: #fff;
        }

        .target-pill-btn.active {
            background: var(--primary);
            color: #050A12;
            border-color: var(--primary-light);
            font-weight: 700;
            box-shadow: 0 2px 8px rgba(201, 151, 56, 0.35);
        }

        .target-table-wrapper {
            background: rgba(5, 10, 18, 0.75);
            border: 1.5px solid var(--border-dark);
            border-radius: 16px;
            overflow: hidden;
            width: 100%;
            box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
        }

        .target-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.88rem;
            text-align: left;
        }

        .target-table th {
            background: rgba(14, 28, 48, 0.95);
            color: var(--primary-light);
            font-weight: 700;
            padding: 14px 16px;
            border-bottom: 1.5px solid var(--border-dark);
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            white-space: nowrap;
        }

        .target-table td {
            padding: 12px 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
            color: #E2E8F0;
            vertical-align: middle;
        }

        .target-table tr:hover td {
            background: rgba(201, 151, 56, 0.04);
        }

        .target-table tr.completed-row td {
            background: rgba(16, 185, 129, 0.02);
        }

        .target-status-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.74rem;
            font-weight: 700;
            cursor: pointer;
            user-select: none;
            transition: all 0.2s ease;
        }

        .target-status-badge.sudah {
            background: rgba(16, 185, 129, 0.18);
            border: 1px solid rgba(16, 185, 129, 0.45);
            color: #34D399;
        }

        .target-status-badge.sudah:hover {
            background: rgba(16, 185, 129, 0.28);
            transform: scale(1.03);
        }

        .target-status-badge.belum {
            background: rgba(245, 158, 11, 0.12);
            border: 1px solid rgba(245, 158, 11, 0.35);
            color: #FBBF24;
        }

        .target-status-badge.belum:hover {
            background: rgba(245, 158, 11, 0.22);
            transform: scale(1.03);
        }

        .target-date-pill {
            font-family: monospace;
            font-size: 0.82rem;
            color: #94A3B8;
            background: rgba(255, 255, 255, 0.04);
            padding: 2px 8px;
            border-radius: 6px;
            border: 1px solid var(--border-light);
            display: inline-block;
            font-weight: 600;
        }

        .target-surah-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            font-weight: 700;
            color: #fff;
            cursor: pointer;
            transition: color 0.2s;
        }

        .target-surah-badge:hover {
            color: var(--primary-light);
            text-decoration: underline;
        }

        .target-verse-tag {
            background: rgba(201, 151, 56, 0.15);
            color: var(--primary-light);
            border: 1px solid rgba(201, 151, 56, 0.35);
            border-radius: 8px;
            padding: 2px 8px;
            font-size: 0.78rem;
            font-weight: 700;
            display: inline-block;
        }

        /* =========================================================================
           AUTH GATE & TARGET CRUD MODAL OVERLAY STYLES
           ========================================================================= */
        .auth-gate-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(3, 7, 18, 0.88);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            z-index: 99999;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            box-sizing: border-box;
        }

        .auth-gate-card {
            background: rgba(10, 20, 36, 0.95);
            border: 1.5px solid rgba(201, 151, 56, 0.35);
            border-radius: 20px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(201, 151, 56, 0.15);
            width: 100%;
            max-width: 440px;
            padding: 32px 28px;
            text-align: center;
            box-sizing: border-box;
            animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }

        @keyframes modalSlideUp {
            from {
                opacity: 0;
                transform: translateY(24px) scale(0.96);
            }
            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* =========================================================================
           ENSIKLOPEDIA HADITS & SUNNAH (14 KITAB) STYLES
           ========================================================================= */
        .hadits-book-chips-container {
            display: flex;
            gap: 10px;
            overflow-x: auto;
            padding: 4px 2px 14px;
            scrollbar-width: thin;
            scrollbar-color: var(--primary) transparent;
        }

        .hadits-book-chip {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            background: rgba(14, 28, 48, 0.7);
            border: 1.5px solid var(--border-dark);
            border-radius: 12px;
            color: #E2E8F0;
            font-size: 0.84rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.25s ease;
            user-select: none;
        }

        .hadits-book-chip:hover {
            border-color: var(--primary-light);
            background: rgba(201, 151, 56, 0.12);
            color: #fff;
            transform: translateY(-2px);
        }

        .hadits-book-chip.active {
            background: linear-gradient(135deg, rgba(201, 151, 56, 0.3), rgba(16, 185, 129, 0.25));
            border-color: var(--primary-light);
            color: #FAF9F6;
            box-shadow: 0 4px 16px rgba(201, 151, 56, 0.25);
        }

        .hadits-book-count-badge {
            background: rgba(5, 10, 18, 0.6);
            border: 1px solid rgba(201, 151, 56, 0.3);
            color: var(--primary-light);
            font-size: 0.7rem;
            padding: 2px 7px;
            border-radius: 20px;
            font-weight: 700;
        }

        .hadits-hero-book-card {
            background: linear-gradient(135deg, rgba(14, 28, 48, 0.9), rgba(7, 34, 28, 0.6));
            border: 1.5px solid var(--border-dark);
            border-radius: 16px;
            padding: 22px 26px;
            margin-bottom: 22px;
            position: relative;
            overflow: hidden;
        }

        .hadits-hero-book-card::after {
            content: "حديث";
            position: absolute;
            right: 20px;
            bottom: -15px;
            font-family: var(--font-arabic);
            font-size: 6.5rem;
            color: rgba(201, 151, 56, 0.05);
            pointer-events: none;
        }

        .hadits-search-bar {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .hadits-search-input-wrap {
            flex: 1;
            min-width: 260px;
            position: relative;
        }

        .hadits-search-input-wrap input {
            width: 100%;
            height: 44px;
            background: rgba(5, 10, 18, 0.75);
            border: 1.5px solid var(--border-dark);
            border-radius: 10px;
            padding: 0 16px 0 42px;
            color: #fff;
            font-size: 0.9rem;
            outline: none;
            transition: border-color 0.2s;
            box-sizing: border-box;
        }

        .hadits-search-input-wrap input:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(201, 151, 56, 0.15);
        }

        .hadits-search-input-wrap .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-muted-dark);
            font-size: 1.1rem;
            pointer-events: none;
        }

        .hadits-jump-box {
            display: flex;
            align-items: center;
            gap: 8px;
            background: rgba(14, 28, 48, 0.6);
            border: 1.5px solid var(--border-dark);
            border-radius: 10px;
            padding: 4px 8px;
        }

        .hadits-jump-input {
            width: 90px;
            height: 36px;
            background: rgba(5, 10, 18, 0.7);
            border: 1px solid var(--border-dark);
            border-radius: 8px;
            color: #fff;
            text-align: center;
            font-weight: 700;
            outline: none;
        }

        .hadits-card {
            background: rgba(10, 20, 36, 0.85);
            border: 1.5px solid var(--border-dark);
            border-radius: 16px;
            padding: 24px;
            margin-bottom: 20px;
            transition: all 0.25s ease;
            position: relative;
        }

        .hadits-card:hover {
            border-color: rgba(201, 151, 56, 0.45);
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        }

        .hadits-card-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 18px;
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            flex-wrap: wrap;
            gap: 10px;
        }

        .hadits-badge-title {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            font-weight: 700;
            color: var(--primary-light);
            font-size: 0.95rem;
        }

        .hadits-arabic-text {
            font-family: var(--font-arabic);
            font-size: 1.7rem;
            line-height: 2.2;
            color: #FAF9F6;
            direction: rtl;
            text-align: right;
            margin-bottom: 20px;
            word-spacing: 2px;
            text-rendering: optimizeLegibility;
        }

        .hadits-trans-text {
            font-size: 0.95rem;
            line-height: 1.85;
            color: #E2E8F0;
            background: rgba(5, 10, 18, 0.4);
            border-left: 3.5px solid var(--primary);
            padding: 14px 18px;
            border-radius: 0 10px 10px 0;
            font-weight: 400;
        }

        .hadits-pagination-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 30px;
            padding: 16px;
            background: rgba(14, 28, 48, 0.7);
            border: 1.5px solid var(--border-dark);
            border-radius: 14px;
            flex-wrap: wrap;
            gap: 12px;
        }

        .sidebar-hadits-card {
            background: rgba(14, 28, 48, 0.6);
            border: 1px solid var(--border-dark);
            border-radius: 10px;
            padding: 12px 14px;
            margin-bottom: 8px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sidebar-hadits-card:hover {
            border-color: var(--primary-light);
            background: rgba(201, 151, 56, 0.12);
        }



