/* ==========================================
   1. FONT & ROOT VARIABLES
   ========================================== */
@font-face {
    font-family: 'DroidArabicNaskh';
    src: url('/harakat/font/droid-arabic-naskh.ttf') format('truetype');
    font-display: swap;
}

:root {
    --emas: #ffcc33;
    --emas-glow: rgba(255, 204, 51, 0.4);
    --hijau-khidir: #00FF88;
    --hitam: #050505;
    --gelap: #0d0d0d;
    --abu: #141414;
    --biru: #2980b9;
    --merah: #e74c3c;
    --emerald: #2ecc71;
    --border-halus: rgba(255, 255, 255, 0.08);
}

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

/* ==========================================
   2. AUTOFIT LAYOUT UTAMA
   ========================================== */
html, body {
    background-color: var(--hitam);
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    width: 100%;
    height: 100%; /* Autofit tanpa scrollbar luar */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed; /* Mencegah layar goyang saat keyboard muncul */
}

/* ==========================================
   3. HEADER & NAVIGATION STYLING
   ========================================== */
header {
    padding: 10px 25px;
    border-bottom: 1px solid var(--border-halus);
    background: linear-gradient(180deg, var(--gelap) 0%, var(--hitam) 100%);
    flex-shrink: 0; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 1000;
    display: flex; justify-content: space-between; align-items: center;
    position: relative; width: 100%;
}
.header-left { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.header-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--emas); box-shadow: 0 0 10px var(--emas-glow); }
.header-title-text { display: flex; flex-direction: column; justify-content: center; }
.header-title-text h1 { color: var(--emas); font-weight: 900; text-transform: uppercase; letter-spacing: 2px; font-size: 1.2rem; text-shadow: 0 2px 4px rgba(0,0,0,0.8); margin: 0; line-height: 1; }
.header-title-text .subtitle { color: var(--hijau-khidir); font-size: 0.65rem; letter-spacing: 2px; text-transform: uppercase; margin-top: 3px; font-weight: 600; line-height: 1; }

/* Desktop Menu */
.header-nav { display: flex; gap: 20px; align-items: center; }
.nav-link { color: #ccc; text-decoration: none; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; transition: color 0.3s ease; }
.nav-link:hover { color: var(--emas); }

/* Dropdown Menu (Jembatan Anti-hilang) */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0;
    background: rgba(10, 10, 10, 0.98); border: 1px solid var(--emas);
    border-radius: 8px; flex-direction: column; min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8); overflow: hidden;
    backdrop-filter: blur(10px); z-index: 3000; animation: fadeIn 0.2s ease-out;
}
.dropdown-menu::before { content: ""; position: absolute; top: -20px; left: 0; right: 0; height: 20px; background: transparent; }
.dropdown:hover .dropdown-menu { display: flex; }
.dropdown-item { padding: 14px 18px; color: #ccc; text-decoration: none; font-size: 0.85rem; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; gap: 12px; transition: all 0.2s ease; }
.dropdown-item i { width: 16px; color: var(--emas); }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--emas); color: var(--hitam); }
.dropdown-item:hover i { color: var(--hitam); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.menu-toggle { display: none; background: transparent; border: none; color: var(--emas); font-size: 1.8rem; cursor: pointer; transition: transform 0.3s; }

/* ==========================================
   4. WORKSPACE STYLING (TEXT AREA)
   ========================================== */
.main-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #222; position: relative; }
.workspace { display: flex; flex-direction: row; flex: 1; min-height: 0; gap: 2px; }

.pane {
    background: var(--abu); display: flex; flex-direction: column;
    flex: 1; min-height: 0; padding: 15px; position: relative;
    transition: all 0.3s ease;
}
.pane:focus-within { background: #0f0f0f; }

.drag-over {
    background: rgba(46, 204, 113, 0.1) !important;
    border: 2px dashed var(--emerald) !important;
    border-radius: 12px;
}

.pane-label {
    color: var(--emas); font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; margin-bottom: 8px; display: flex;
    justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-halus); padding-bottom: 8px; flex-shrink: 0;
}

.tools-right-group { display: flex; align-items: center; gap: 6px; }

/* Tombol Kamera & Suara di Box Header */
.btn-upload-wrapper, .btn-speak-box {
    cursor: pointer; display: flex; align-items: center; gap: 5px;
    transition: all 0.3s ease; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 800; border: 1px solid;
}
.btn-upload-wrapper { color: var(--emerald); border-color: rgba(46, 204, 113, 0.3); background: rgba(46, 204, 113, 0.05); }
.btn-speak-box { color: var(--emas); border-color: rgba(255, 204, 51, 0.3); background: rgba(255, 204, 51, 0.05); text-transform: uppercase;}
.btn-upload-wrapper:hover { background: var(--emerald); color: var(--hitam); }
.btn-speak-box:hover { background: var(--emas); color: var(--hitam); }

.char-counter { font-size: 10px; color: #ffffff; background: rgba(255, 255, 255, 0.1); padding: 3px 8px; border-radius: 6px; margin-left: 10px; letter-spacing: 1px; transition: all 0.3s ease; }
.char-limit-reached { background: var(--merah); animation: shake 0.3s ease; box-shadow: 0 0 10px rgba(231, 76, 60, 0.5); }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.textarea-container { flex: 1; display: flex; position: relative; min-height: 0; }

textarea, div#output {
    flex: 1; width: 100%; background: transparent; color: #ffffff;
    border: none; font-size: 24px; line-height: 1.8; direction: rtl;
    font-family: 'DroidArabicNaskh', serif; resize: none; outline: none;
    overflow-y: auto; padding-right: 5px; transition: all 0.3s ease;
    white-space: pre-wrap; word-break: break-word;

    /* KUNCI: Menghilangkan menu bubble tapi tetap bisa disentuh */
    -webkit-touch-callout: none !important; /* Hilangkan menu Copy/Paste di HP */
    -webkit-user-select: none !important;    /* Hilangkan blok biru seleksi */
    user-select: none !important;

    /* Pastikan sentuhan tetap terdeteksi untuk Tooltip */
    pointer-events: auto;
}
textarea::placeholder, div#output:empty:before { color: rgba(255,255,255,0.15); pointer-events: none; }
div#output:empty:before { content: attr(placeholder); display: block; }
textarea::-webkit-scrollbar, div#output::-webkit-scrollbar { width: 4px; }
textarea::-webkit-scrollbar-thumb, div#output::-webkit-scrollbar-thumb { background: rgba(255, 204, 51, 0.4); border-radius: 10px; }

/* ==========================================
   STYLING TASHIL PRO (WARNA NAHWU)
   ========================================== */

/* 1. Warna ISIM (Biru Cerah) */
.tashil-on .arabic-word.isim {
    color: #3498db !important;
    text-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
    font-weight: 800;
}

/* 2. Warna FI'IL (Merah Intens) */
.tashil-on .arabic-word.fiil {
    color: #e74c3c !important;
    text-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
    font-weight: 800;
}

/* 3. Warna HURUF (Hijau Khidir) */
.tashil-on .arabic-word.huruf {
    color: #2ecc71 !important;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
    font-weight: 800;
}

/* 4. Pengaturan Dasar Kata Arab */
.arabic-word {
    display: inline-block;
    padding: 0 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: baseline;
    position: relative;
    /* Menghilangkan seleksi biru default browser saat diklik di HP */
    -webkit-tap-highlight-color: transparent;
}

/* 5. Efek Interaksi (Hover & Touch) */
.arabic-word:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.arabic-word:active {
    transform: scale(0.95); /* Efek membal saat ditekan di HP */
    background: rgba(255, 204, 51, 0.2); /* Highlight emas tipis */
}

/* 6. Tambahan: Efek Transisi saat Tashil Dinyalakan */
.tashil-on .arabic-word {
    transition: color 0.4s cubic-bezier(0.4, 0, 0.2, 1), text-shadow 0.4s ease;
}

/* ==========================================
   5. ACTION BAR & TOMBOL BAWAH
   ========================================== */
.action-bar {
    background: var(--gelap); padding: 12px 15px; display: flex;
    justify-content: center; align-items: center; flex-wrap: wrap; gap: 20px;
    border-top: 1px solid var(--border-halus); flex-shrink: 0; z-index: 10;
}
.control-group { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.05); padding: 6px 15px; border-radius: 8px; }
.control-group label { color: var(--emas); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }

#lang-input { background: transparent; color: #ffffff; border: none; font-family: 'Montserrat', sans-serif; font-size: 0.8rem; font-weight: 600; outline: none; cursor: pointer; }
select option { background-color: var(--gelap); color: #ffffff; }

.action-group { display: flex; gap: 10px; justify-content: center; }
button {
    padding: 10px 18px; font-family: 'Montserrat', sans-serif; font-weight: 700; text-transform: uppercase;
    border-radius: 8px; cursor: pointer; transition: all 0.2s ease; font-size: 0.75rem; border: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
#btn-proses { background: #2ecc71; color: var(--hitam); }
#btn-translate { background: var(--biru); color: #ffffff; }
#btn-copy { background: rgba(255, 204, 51, 0.05); color: var(--emas); border: 1px solid var(--emas); }
#btn-clear { background: transparent; color: #aaa; border: 1px solid #444; }
#btn-tashil { background: rgba(46, 204, 113, 0.05); color: var(--emerald); border: 1px solid var(--emerald); }

button:active { transform: scale(0.95); }

/* ==========================================
   6. TRANSLATE PANEL (MODAL FIX)
   ========================================== */
.translate-panel {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9);
    width: 95%; max-width: 800px; height: 80vh;
    background: #0a0a0a; backdrop-filter: blur(20px); border: 2px solid var(--emerald);
    border-radius: 20px; padding: 15px; z-index: 10000; box-shadow: 0 0 100px rgba(0,0,0,1);

    /* FIX: Panel dihilangkan agar tidak menghalangi tombol saat ditutup */
    display: none;
    opacity: 0; visibility: hidden; pointer-events: none;
    flex-direction: column; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.translate-panel.show-panel {
    display: flex; /* Munculkan ketika aktif */
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

/* Header & Tombol Close Translate */
.translate-header {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 15px; margin-bottom: 10px; flex-shrink: 0;
}
.translate-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.translate-header-left span { color: var(--emas); font-size: 0.9rem; font-weight: 800; text-transform: uppercase; }

.btn-copy-tr { padding: 8px 15px; background: rgba(46, 204, 113, 0.15); color: var(--emerald); border: 1px solid var(--emerald); border-radius: 8px; font-weight: 800; cursor: pointer; }

/* Tombol X merah jelas */
.btn-close-tr {
    width: 40px; height: 40px; border-radius: 50%; background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--merah); color: var(--merah); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0;
}
.btn-close-tr:hover { background: var(--merah); color: #fff; }

.translate-text {
    color: #f1f1f1; font-size: 17px; line-height: 1.6; background: rgba(255,255,255,0.03);
    padding: 15px; border-radius: 12px; border-left: 4px solid var(--emerald);
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; font-family: 'Montserrat', sans-serif;
}
.translate-text.arabic-lang { direction: rtl; font-family: 'DroidArabicNaskh', serif; font-size: 24px; border-left: none; border-right: 4px solid var(--emerald); }

/* ==========================================
   7. POPUPS (TOAST, AUTOCOMPLETE, TOOLTIP)
   ========================================== */
.toast {
    position: fixed;
    top: -60px; /* Sembunyi di luar layar atas */
    left: 50%;
    transform: translateX(-50%);
    background: var(--emas); /* Warna solid asli */
    color: var(--hitam);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 800;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* Efek pantulan (bounce) */
    pointer-events: none;
    z-index: 999999;
    box-shadow: 0 5px 20px rgba(255, 204, 51, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast.show { opacity: 1; top: 30px; transform: translateX(-50%); }

.autocomplete-dropdown {
    position: absolute; bottom: 0; left: 0; right: 0; background: rgba(10, 10, 10, 0.98);
    border-top: 2px solid var(--emas); max-height: 150px; overflow-y: auto; z-index: 2000;
    box-shadow: 0 -10px 20px rgba(0,0,0,0.8); display: none; border-radius: 0 0 8px 8px;
}
.autocomplete-item { padding: 10px 14px; font-family: 'DroidArabicNaskh', serif; font-size: 19px; direction: rtl; color: #fff; border-bottom: 1px solid rgba(255,255,255,0.06); cursor: pointer; transition: background 0.2s ease; }
.autocomplete-item:hover { background: var(--emas); color: var(--hitam); font-weight: bold; }

/* Tooltip Shorof */
#word-tooltip {
    position: absolute;
    background: transparent; /* Ubah jadi transparent */
    border: none;            /* HAPUS BORDER, biar HTML dalamnya yang atur border */
    border-radius: 0;
    padding: 0;              /* HAPUS PADDING, agar ukuran fix 100% akurat */
    color: #fff;
    display: none;

    /* PENTING: Agar bisa copy-paste dan diklik */
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;

    /* Z-Index cukup tinggi untuk di atas teks, tapi jangan tutupi modal */
    z-index: 10000;
}
#word-tooltip strong { color: var(--emas); font-size: 1.4rem; font-family: 'DroidArabicNaskh', serif; display: block; text-align: right; direction: rtl; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 6px; padding-bottom: 6px; }

textarea.queue-alert, div#output.queue-alert {
    text-align: center !important; direction: ltr !important;
    font-family: 'Montserrat', sans-serif !important; font-size: 15px !important;
    font-weight: 600; color: var(--emas) !important;
    background: rgba(255, 204, 51, 0.05) !important; border: 1px dashed var(--emas) !important;
    border-radius: 12px; padding-top: 60px !important; line-height: 2 !important;
    animation: pulse-border 2s infinite;
}
@keyframes pulse-border { 0% { box-shadow: 0 0 0 rgba(255,204,51,0); } 50% { box-shadow: 0 0 15px rgba(255,204,51,0.2); } 100% { box-shadow: 0 0 0 rgba(255,204,51,0); } }

/* ==========================================
   8. FOOTER
   ========================================== */
footer {
    background: var(--hitam); padding: 12px 10px; text-align: center;
    font-size: 0.65rem; color: #ffffff; flex-shrink: 0; border-top: 1px solid rgba(255,255,255,0.05);
}
.heart-icon { display: inline-block; animation: heartbeat 1.2s infinite; color: #ff3b3b; margin: 0 4px; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 20%, 60% { transform: scale(1.3); } }

/* ==========================================
   9. RESPONSIVE MOBILE (FULL FIX: MENU + BUTTONS)
   ========================================== */
@media (max-width: 768px) {
    /* --- RESTORASI HEADER & MENU HAMBURGER --- */
    header { padding: 8px 12px; }
    .header-logo { width: 30px; height: 30px; }
    .header-title-text h1 { font-size: 0.95rem; }

    .menu-toggle {
        display: block !important; /* Memunculkan Hamburger */
        margin-left: auto;
    }

    .header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(10, 10, 10, 0.98);
        padding: 0;
        border-bottom: 1.5px solid var(--emas);
        z-index: 9999;
    }
    .header-nav.active { display: flex; }
    .nav-link { width: 100%; padding: 15px 25px; border-bottom: 1px solid rgba(255,255,255,0.05); }

    /* --- LAYOUT AUTOFIT --- */
    .main-wrapper { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
    .workspace { flex-direction: column; flex: 1; min-height: 0; }
    .pane { flex: 1; padding: 10px; height: 30vh; min-height: 0; }
    textarea, div#output { font-size: 18px !important; line-height: 1.5; }

    /* --- ACTION BAR (AREA TOMBOL) --- */
    .action-bar {
        flex-direction: column !important;
        padding: 10px 10px !important;
        background: #080808 !important;
        border-top: 1.5px solid var(--emas);
        flex-shrink: 0;
    }

    .control-group {
        width: 100% !important;
        margin-bottom: 8px !important;
        background: rgba(255,255,255,0.03);
        border-radius: 8px;
        padding: 6px !important;
    }

    /* Area Scroll Tombol */
    .action-group {
        width: 100% !important;
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
        height: 125px; /* Tinggi dikunci agar box teks tetap luas */
        overflow-y: auto;
        padding-right: 2px;
    }

    /* 1. TOMBOL HARAKATI: ATAS & LEBAR PENUH */
    #btn-proses {
        grid-column: span 4 !important; /* Melebar 1 baris penuh */
        flex-direction: row !important; /* Ikon & Teks sejajar */
        height: 48px !important;
        background: #2ecc71 !important;
        color: #000 !important;
        font-size: 0.8rem !important;
        margin-bottom: 2px !important;
        order: -1; /* Memastikan dia selalu di urutan pertama */
    }

    /* 2. TOMBOL LAINNYA: KECIL (4 KOLOM) */
    .action-group button:not(#btn-proses) {
        flex-direction: column !important;
        gap: 4px !important;
        padding: 8px 2px !important;
        font-size: 0.52rem !important;
        font-weight: 900 !important;
        height: 52px !important;
        border-radius: 6px !important;
    }

    .action-group button i { font-size: 0.9rem !important; }

    /* Scrollbar Tipis */
    .action-group::-webkit-scrollbar { width: 3px; }
    .action-group::-webkit-scrollbar-thumb { background: var(--emas); border-radius: 10px; }

    footer { padding: 6px; font-size: 0.55rem; }
}

    /* ==========================================
       10. MODAL BANTUAN (PREMIUM LAYOUT)
       ========================================== */
    .help-overlay {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.85);
        display: none; /* Sembunyi default */
        justify-content: center;
        align-items: center;
        z-index: 99999999;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .help-content {
        background: #0f1525; /* Biru sangat gelap (Mewah) */
        border: 2px solid var(--emas, #ffcc33);
        border-radius: 15px;
        width: 90%;
        max-width: 600px;
        max-height: 85vh;
        display: flex;
        flex-direction: column;
        box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 20px rgba(255, 204, 51, 0.2);
        overflow: hidden;
        position: relative;
        /* Efek Pop-up animasi */
        animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    @keyframes modalPop {
        from { opacity: 0; transform: scale(0.9) translateY(20px); }
        to { opacity: 1; transform: scale(1) translateY(0); }
    }

    .help-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #1a2235;
        border-bottom: 2px solid var(--emas, #ffcc33);
        color: var(--emas, #ffcc33);
    }

    .help-header h2 {
        font-size: 1.1rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 1px;
        margin: 0;
    }

    .help-body {
        padding: 20px;
        overflow-y: auto;
        color: #e2e8f0;
    }

    /* Scrollbar khusus untuk modal */
    .help-body::-webkit-scrollbar { width: 6px; }
    .help-body::-webkit-scrollbar-thumb { background: var(--emas, #ffcc33); border-radius: 10px; }

    .help-body section {
        margin-bottom: 25px;
    }

    .help-body h3 {
        color: var(--hijau-khidir, #00ff88);
        font-size: 0.9rem;
        text-transform: uppercase;
        margin-bottom: 12px;
        letter-spacing: 0.5px;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
        padding-bottom: 6px;
    }

    .help-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .help-item {
        background: rgba(255, 255, 255, 0.05);
        padding: 12px 15px;
        border-radius: 8px;
        font-size: 0.8rem;
        line-height: 1.5;
        border-left: 4px solid var(--emas, #ffcc33);
        color: #cbd5e1;
    }

    .help-item b {
        color: var(--emas, #ffcc33);
        display: block;
        margin-bottom: 4px;
        font-size: 0.85rem;
    }

    .help-footer {
        text-align: center;
        padding: 12px;
        background: #080b14;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.7rem;
        color: #64748b;
        font-weight: 600;
    }

    /* Tampilan untuk PC / Desktop (Grid 2 Kolom) */
    @media (min-width: 768px) {
        .help-grid {
            grid-template-columns: 1fr 1fr;
        }
    }

    /* ==========================================
       FITUR MAKNA GANDUL (INTERLINEAR)
       ========================================== */
    .gandul-container {
        display: flex;
        flex-wrap: wrap;
        gap: 15px 10px;
        direction: rtl; /* Tetap kanan ke kiri */
        padding: 10px;
        line-height: 1;
    }

    .gandul-item {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        min-width: 40px;
    }

    .gandul-ar {
        font-family: 'DroidArabicNaskh', serif;
        font-size: 1.8rem;
        color: var(--emas);
        margin-bottom: 5px;
    }

    .gandul-id {
        font-size: 0.75rem;
        color: #aaa;
        font-family: 'Montserrat', sans-serif;
        white-space: nowrap;
        font-weight: 600;
    }

    /* Tombol Aktif */
    #btn-gandul.active {
        background: var(--emas) !important;
        color: var(--hitam) !important;
        box-shadow: 0 0 15px rgba(255, 204, 51, 0.4);
    }

    /* ==========================================
       FITUR TASHRIF SINGKAT (INTERAKTIF)
       ========================================== */
    .tashrif-wrapper {
        margin-top: 15px;
        padding-top: 12px;
        border-top: 1px dashed rgba(255, 204, 51, 0.3);
    }
    .tashrif-title {
        color: var(--hijau-khidir, #00FF88);
        font-size: 0.65rem;
        font-weight: 800;
        text-transform: uppercase;
        margin-bottom: 8px;
        letter-spacing: 1px;
    }
    .tashrif-scroll {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 8px;
        /* Styling Scrollbar khusus area ini */
        scrollbar-width: thin;
        scrollbar-color: var(--emas, #ffcc33) transparent;
    }
    .tashrif-scroll::-webkit-scrollbar {
        height: 4px;
    }
    .tashrif-scroll::-webkit-scrollbar-thumb {
        background: var(--emas, #ffcc33);
        border-radius: 10px;
    }
    .tashrif-card {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid #333;
        border-radius: 8px;
        padding: 8px 12px;
        min-width: 75px;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        transition: all 0.3s ease;
        cursor: pointer;
    }
    .tashrif-card:hover {
        border-color: var(--emas, #ffcc33);
        background: rgba(212, 175, 55, 0.1);
        transform: translateY(-2px);
    }
    .t-label {
        font-size: 0.55rem;
        color: #999;
        text-transform: uppercase;
        margin-bottom: 5px;
        font-weight: bold;
    }
    .t-word {
        font-family: 'DroidArabicNaskh', serif;
        font-size: 1.2rem;
        color: #fff;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    }

/* ==========================================
   TOMBOL EDIT (DI HEADER PANE)
   ========================================== */
.btn-edit-header {
    background: transparent;
    color: #888;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none; /* Muncul hanya jika ada teks output */
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
}

.btn-edit-header:hover {
    color: var(--emas);
    border-color: var(--emas);
    background: rgba(255, 204, 51, 0.1);
}

.btn-edit-header.active-edit {
    background: var(--emerald);
    color: var(--hitam);
    border-color: var(--emerald);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.4);
}

/* Garis putus-putus tanda mode edit aktif */
#output.editing-mode {
    border: 1px dashed var(--emerald);
    background: rgba(46, 204, 113, 0.02);
    border-radius: 8px;
    padding: 10px;

    /* 2. Mengaktifkan Kembali Fungsi Seleksi & Menu HP */
    -webkit-touch-callout: default !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* ============================================================
   KYAI AI CHAT INTERFACE - FULL COMPLETE VERSION (ANTI-ERROR)
   ============================================================ */

/* 1. Overlay Latar Belakang (Blur & Gelap) */
#kyai-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999998;
    display: none; /* Default Tersembunyi */
    transition: opacity 0.3s ease;
}

/* 2. Container Chat Utama (Lebar ala Gemini/ChatGPT) */
#kyai-chat-container {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 1100px; /* Lebar maksimal desktop */
    height: 90vh; /* Tinggi maksimal desktop */
    background: #0a0a0a;
    border: 1.5px solid #ffcc33; /* Border Kuning Emas */
    border-radius: 20px;
    display: none; /* Default Tersembunyi */
    flex-direction: column;
    z-index: 999999;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 1);
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* =========================================================
   3. CLASS PENGGERAK (WAJIB ADA AGAR TOMBOL BISA DIKLIK)
   ========================================================= */
.kyai-chat-active {
    display: flex !important;
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.kyai-overlay-active {
    display: block !important;
}

/* 4. Header Chat (Gold & Hijau Khidir) */
.kyai-header {
    background: #111;
    padding: 15px 20px;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.kyai-header-left { display: flex; align-items: center; gap: 15px; }

.kyai-avatar-img {
    width: 45px !important;
    height: 45px !important;
    border-radius: 50%;
    border: 2px solid #00FF88; /* Hijau Khidir */
    object-fit: cover !important;
}

.kyai-status-info { display: flex; flex-direction: column; }

.kyai-name {
    font-weight: 900;
    color: #ffcc33 !important; /* Kuning Emas */
    font-size: 1.15rem;
    font-family: 'Montserrat', sans-serif !important;
    letter-spacing: 0.5px;
}

.kyai-status-tag {
    font-size: 10px;
    color: #00FF88 !important; /* Hijau Khidir */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kyai-header-right { display: flex; gap: 15px; }
.kyai-header-right button {
    background: none; border: none; color: #666;
    cursor: pointer; font-size: 1.4rem; transition: 0.3s;
}
.kyai-header-right button:hover { color: #fff; }

/* 5. Area Isi Percakapan */
#kyai-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #050505;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* 6. Gelembung Pesan (Chat Bubbles) */
.msg-wrapper { display: flex; width: 100%; flex-direction: column; }
.kyai-wrapper { align-items: flex-start; }
.user-wrapper { align-items: flex-end; }

.msg {
    max-width: 95%;
    padding: 16px 22px; /* Ruang dalam diperbesar sedikit */
    border-radius: 18px;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.95rem;

    /* FIX: JARAK ANTAR BARIS DIBUAT LEBIH RENGGANG AGAR ENAK DIBACA */
    line-height: 1.7;
    color: #f1f1f1;
    position: relative;
    user-select: text;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.kyai-msg {
    background: #1a1a1a;
    border: 1px solid #222;
    border-bottom-left-radius: 2px;
    direction: ltr !important;
    text-align: left !important;
}

/* Memisahkan judul/sub-judul dari teks di bawahnya */
.kyai-msg b, .kyai-msg strong {
    color: #ffffff !important; /* Putih biasa agar tidak silau */
    font-weight: 800;
    display: inline-block;
    margin-top: 8px; /* Memberi jarak atas agar tidak nempel */
    margin-bottom: 2px; /* Memberi jarak bawah */
}

/* Jarak ekstra untuk judul yang sangat panjang */
.kyai-msg br + b {
    margin-top: 12px;
}

/* Teks Miring (Italic) untuk Referensi Kitab */
.kyai-msg i, .kyai-msg em {
    color: #00FF88; /* Hijau Khidir untuk kitab */
    font-style: italic;
}

/* Efek Hover Tombol KYAI AI di Workspace (Atas Box Input) */
.btn-upload-wrapper[onclick="toggleKyaiChat()"] {
    transition: all 0.3s ease !important;
}

.btn-upload-wrapper[onclick="toggleKyaiChat()"]:hover {
    background: #2ecc71 !important; /* Hijau Khidir */
    color: #050505 !important;      /* Teks Hitam */
    border-color: #2ecc71 !important;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
    transform: translateY(-2px);
}

/* ============================================================
   BIDI ISOLATION (MENCEGAH TEKS ARAB & LATIN TABRAKAN)
   ============================================================ */
.arab-text {
    direction: rtl !important;
    unicode-bidi: isolate !important; /* Memisahkan sistem kanan-ke-kiri dengan sangat aman */
    font-family: 'DroidArabicNaskh', serif !important;
    font-size: 1.4rem !important; /* Huruf Arab tetap besar */
    color: #ffcc33 !important; /* Warna emas */

    /* KUNCI PERBAIKAN: Inline membuat Arab dan Latin sejajar dengan rapi */
    display: inline !important;

    line-height: inherit !important;
    padding: 0 5px; /* Jarak nafas agar tidak terlalu dempet dengan Latin */
    background: transparent !important; /* Dihapus agar tidak menjadi kotak aneh */
    border: none !important;
}

.user-msg {
    background: #2ecc71;
    color: #000;
    font-weight: 700;
    border-bottom-right-radius: 2px;
    direction: ltr !important;
    text-align: left !important;
}

/* Tombol Salin Jawaban */
.copy-msg-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #888;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 10px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 800;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-msg-btn:hover {
    background: rgba(255, 204, 51, 0.1);
    border-color: var(--emas);
}

/* Memperbaiki alignment jika ada teks Arab di dalam bubble */
.msg-wrapper.kyai-wrapper {
    margin-bottom: 20px;
}

/* 7. Footer (Input Area) */
.kyai-footer {
    padding: 20px 25px;
    background: #0f0f0f;
    border-top: 1px solid #222;
    flex-shrink: 0;
}

.kyai-input-group {
    display: flex;
    align-items: flex-end;
    background: #1d1d1a;
    border-radius: 25px;
    padding: 10px 18px;
    gap: 12px;
    border: 1px solid #333;
}

#kyai-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    padding: 5px 0;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 1rem;
    resize: none;
    max-height: 150px;
    outline: none;
    direction: ltr !important;
    text-align: left !important;
}

#btn-send-kyai {
    background: #2ecc71;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: 0.2s ease;
}

#btn-send-kyai:active {
    transform: scale(0.9);
}

/* 8. Responsif Layar Kecil (Mobile Full Screen) */
@media (max-width: 768px) {
    #kyai-chat-container {
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        max-height: 100% !important;
        border: none;
    }

    /* Mengimbangi transform di layar HP */
    .kyai-chat-active {
        transform: none !important;
    }

    .msg {
        max-width: 95%;
    }
}

/* ============================================================
   KONSOLIDASI TAJWID: MENJAMIN SAMBUNGAN HURUF & WARNA TAJAM
   ============================================================ */

/* ============================================================
   LIGATURE GUARD: MEMAKSA HURUF ARAB TETAP MENYAMBUNG
   ============================================================ */
#output {
    font-variant-ligatures: common-ligatures;
    -webkit-font-smoothing: antialiased;
}

#output span {
    display: inline;      /* WAJIB inline, jangan yang lain */
    padding: 0 !important;
    margin: 0 !important;
    letter-spacing: 0 !important;
    word-spacing: 0 !important;
    white-space: normal;  /* Jangan pre-wrap di dalam span */
    border: none !important;
}

#output span[style*="color"] {
    /* Memberi sedikit ketebalan tanpa merusak lebar huruf */
    text-shadow: 0 0 0.1px currentColor;
}

/* ============================================================
/* Container Tarkib
============================================================*/
/* ============================================================
   INTERACTIVE ELEMENTS & LIGATURE GUARD
   ============================================================ */

/* Menjaga bentuk font Droid Arabic Naskh tidak patah/naik-turun */
#output span {
    display: inline;
    vertical-align: baseline !important; /* KUNCI PRESISI ARAB */
    line-height: inherit;
}

/* Interaksi untuk warna Tajwid */
.tajwid-word {
    cursor: help;
    border-bottom: 1px dotted transparent;
    transition: all 0.2s ease;
}

.tajwid-word:hover {
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px dotted currentColor;
}

/* ============================================================
   TOMBOL TARKIB (INDIGO THEME)
   ============================================================ */

/* Warna Default Tombol Tarkib (Saat MATI) - Berbeda dengan Gunduli */
#btn-tarkib {
    background: #3f51b5 !important; /* Royal Blue/Indigo */
    color: #ffffff !important;
    border: 1px solid #303f9f;
    transition: all 0.3s ease;
}

/* Warna Saat Tombol Tarkib AKTIF (Saat ON) */
#btn-tarkib.active-tarkib {
    background: #00d2ff !important; /* Biru Neon Cerah */
    color: #000000 !important;      /* Teks Hitam agar Kontras */
    border-color: #00b8d4;
    font-weight: 800;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.5);
}

/* ============================================================
   TARKIB VISUAL OUTPUT (LABEL JABATAN)
   ============================================================ */

/* Container Utama Hasil Tarkib */
.tarkib-container {
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
    gap: 20px 12px; /* Jarak vertikal lebih lebar untuk label */
    padding: 15px 10px;
    justify-content: flex-start;
}

/* Item per-kata (Kata Arab di atas, Label di bawah) */
.tarkib-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
}

/* Styling Kata Arab di dalam mode Tarkib */
.tarkib-word {
    font-family: 'DroidArabicNaskh', serif;
    font-size: 1.9rem;
    color: #fff;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Styling Label Jabatan (Mubtada, Khobar, dll) */
.tarkib-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.4); /* Latar gelap transparan */
    border: 1px solid currentColor;    /* Border mengikuti warna teks */
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Responsif Mobile untuk Tarkib */
@media (max-width: 768px) {
    .tarkib-word {
        font-size: 1.5rem;
    }
    .tarkib-label {
        font-size: 0.55rem;
        padding: 2px 6px;
    }
}

/* ==========================================
   CSS TARKIB VISUAL TREE (NODE DIAGRAM)
========================================== */
.tarkib-tree-container {
    position: relative;
    width: 100%;
    overflow-x: auto; /* Bisa digeser ke kanan/kiri di HP */
    padding: 20px 10px 80px 10px; /* Padding bawah extra untuk garis lengkung */
    scrollbar-width: thin;
    scrollbar-color: var(--emas) #111;
}
#tarkib-svg-lines {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* Agar tidak menghalangi klik user */
    z-index: 1;
}
.tarkib-nodes-wrapper {
    display: flex;
    flex-direction: row-reverse; /* Wajib Row-Reverse karena Arab dari Kanan ke Kiri */
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    position: relative;
    z-index: 2;
    min-width: max-content; /* Mencegah turun baris jika kepanjangan */
}
.tarkib-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.tarkib-node:hover {
    transform: translateY(-5px);
}
.tarkib-word-node {
    font-family: 'DroidArabicNaskh', serif;
    font-size: 1.6rem;
    color: var(--emas);
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.tarkib-line-vertical {
    width: 2px;
    height: 25px;
    background: #555;
}
.tarkib-label-node {
    font-size: 0.75rem;
    color: #000;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 2px solid rgba(255,255,255,0.2);
}
/* Animasi Garis Penghubung Ala Magic */
.tarkib-animated-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s forwards ease-in-out;
}
@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

.copy-msg-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #888;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 10px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 800;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-msg-btn:hover {
    background: rgba(255, 204, 51, 0.1);
    border-color: var(--emas);
}

/* Memperbaiki alignment jika ada teks Arab di dalam bubble */
.msg-wrapper.kyai-wrapper {
    margin-bottom: 20px;
}

/* Legend Tarkib (Keterangan Warna) */
.tarkib-legend {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid #333;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}
.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* =========================================================================
   PERBAIKAN TAMPILAN TARKIB, TOMBOL, & HASIL KOREKSI AI (HARAKATPRO)
   ========================================================================= */

/* 1. Hilangkan Padding Bawah Raksasa Pada Wadah Utama Tarkib */
.tarkib-v13-container {
    padding-bottom: 20px !important; /* Dipangkas dari 120px menjadi 20px */
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: center !important;
}

/* 2. Rapatkan Jarak Margin Atas & Bawah Tombol Legenda */
.tarkib-legend-v13 {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px !important;
    margin-top: 75px !important;  /* UBAH KE 75px (Jarak pas di bawah garis diagram) */
    margin-bottom: 0px !important;
    padding: 5px 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-wrap: wrap !important;
    position: relative !important;
    z-index: 10 !important;
    direction: ltr !important;
}

/* 3. Desain Tombol Uniform & Presisi (Seragam Dengan Action Bar) */
.tarkib-btn-uniform {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 10px 18px !important;
    height: 40px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    border: none !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.tarkib-btn-uniform.btn-ai-correct {
    background: var(--hijau-khidir, #2ecc71) !important;
    color: #000000 !important;
    border: 1px solid #27ae60 !important;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.25) !important;
}

.tarkib-btn-uniform.btn-ai-correct:hover {
    background: #27ae60 !important;
    color: #ffffff !important;
}

.tarkib-btn-uniform.btn-download-hd {
    background: var(--emas, #ffcc33) !important;
    color: #000000 !important;
    border: 1px solid #e6b800 !important;
    box-shadow: 0 4px 12px rgba(255,204,51,0.25) !important;
}

.tarkib-btn-uniform.btn-download-hd:hover {
    background: #ffe066 !important;
}

/* 4. Rapatkan Kotak Hasil AI Persis Di Bawah Tombol (Hanya Berjarak 10px) */
.tarkib-ai-result-box {
    margin-top: 15px !important;  /* Jarak rapat 15px di bawah tombol */
    width: 100% !important;
    background: #0d0d0d !important;
    border: 1px solid var(--emas, #ffcc33) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    color: #eeeeee !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.88rem !important;
    line-height: 1.6 !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.8) !important;
    position: relative !important;
    z-index: 10 !important;
    text-align: left !important;
    direction: ltr !important;
}

/* 5. Tampilan Teks AI & Proteksi Teks Arab Anti-Gepeng Vertikal */
.ai-tarkib-content {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.88rem !important;
    line-height: 1.7 !important;
    color: #eeeeee !important;
    text-align: left !important;
    direction: ltr !important;
}

.ai-tarkib-content .td-arabic,
.ai-tarkib-content td:first-child {
    font-family: 'DroidArabicNaskh', 'Amiri', serif !important;
    font-size: 1.4rem !important;
    line-height: 2.0 !important;
    color: var(--emas, #ffcc33) !important;
    white-space: nowrap !important; /* MENCEGAH TEKS ARAB TERLIPAT MENTOK KE BAWAH */
    direction: rtl !important;
    text-align: center !important;
    min-width: 110px !important;
    width: 1% !important;
    padding: 10px 14px !important;
}

/* Tabel Markdown AI Tarkib */
.ai-tarkib-content table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 16px 0 !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid #333 !important;
    border-radius: 8px !important;
}

.ai-tarkib-content th,
.ai-tarkib-content td {
    padding: 12px 14px !important;
    border: 1px solid #333 !important;
    vertical-align: middle !important;
    font-size: 0.85rem !important;
}

.ai-tarkib-content tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03) !important;
}

@media (max-width: 768px) {
    .tarkib-btn-uniform {
        font-size: 0.7rem !important;
        padding: 8px 12px !important;
        height: 38px !important;
        width: 100% !important;
        max-width: 280px !important;
    }
}

/* =========================================================================
   STYLE TAKHRIJ AMAN (BERSIH 100% - TIDAK MERUSAK TEKS HARAKATI ASLI)
   ========================================================================= */

/* 1. Kotak Takhrij Menempel Rapat Di Bawah Teks Arab Tanpa Mengganggu Harakati */
.takhrij-inline-box {
    display: block !important;
    clear: both !important;
    margin-top: 15px !important;      /* Jarak rapat 15px di bawah teks Harakat */
    padding-top: 12px !important;
    border-top: 1px dashed rgba(255, 204, 51, 0.35) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    direction: ltr !important;          /* Teks Latin Indonesia dari Kiri ke Kanan */
    text-align: left !important;
}

.takhrij-inline-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: rgba(255, 204, 51, 0.05) !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    border-left: 3px solid var(--emas, #ffcc33) !important;
    margin-bottom: 10px !important;
    direction: ltr !important;
}

/* 2. TOMBOL SALIN GOLD DENGAN ALIGNMENT CENTER SEJATI */
.takhrij-inline-copy-btn {
    background: var(--emas, #ffcc33) !important;
    color: #000000 !important;
    border: 1px solid #e6b800 !important;
    padding: 0 12px !important;
    height: 28px !important;            /* Tinggi kompak pas */
    border-radius: 6px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    font-size: 0.70rem !important;
    font-family: 'Montserrat', sans-serif !important;
    
    /* ALIGNMENT CENTER HORTIZONTAL & VERTIKAL */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    gap: 5px !important;
    text-transform: uppercase !important;
    margin: 0 !important;
    
    box-shadow: 0 2px 6px rgba(255, 204, 51, 0.2) !important;
    transition: all 0.2s ease !important;
}

.takhrij-inline-copy-btn i {
    font-size: 0.75rem !important;
    line-height: 1 !important;
    margin: 0 !important;
}

.takhrij-inline-copy-btn:hover {
    background: #ffe066 !important;
    color: #000000 !important;
}

/* 3. Konten Takhrij Compact Seragam Kyai AI Pro */
.kyai-ai-style-content,
.ai-takhrij-content {
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.82rem !important;
    line-height: 1.6 !important;
    color: #dddddd !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 204, 51, 0.2) !important;
    border-radius: 10px !important;
    padding: 12px 14px !important;
    margin: 0 !important;
    direction: ltr !important;
    text-align: left !important;
}

.kyai-ai-style-content b,
.kyai-ai-style-content strong,
.kyai-ai-style-content h1,
.kyai-ai-style-content h2,
.kyai-ai-style-content h3 {
    color: var(--emas, #ffcc33) !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    direction: ltr !important;
}

.kyai-ai-style-content .arab-text,
.ai-takhrij-content .arab-text {
    font-family: 'DroidArabicNaskh', 'Amiri', serif !important;
    font-size: 1.35rem !important;
    line-height: 2.1 !important;
    color: var(--emas, #ffcc33) !important;
    direction: rtl !important;
    display: block !important;
    margin: 8px 0 !important;
    text-align: right !important;
}
