.share-btn { padding: 8px 16px; border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: bold; color: white !important; transition: transform 0.2s; }
.wa { background-color: #25d366; } .fb { background-color: #1877f2; } .tw { background-color: #000; } .tg { background-color: #0088cc; }

/* VARIABEL TEMA */
:root {
  --font: 1.05rem; --line: 1.85; --bg: #ffffff; --text: #111111;
  --muted: #666666; --accent: #1a73e8; --surface: #f2f2f2;
  --border-color: #dddddd; --nav-bg: rgba(255,255,255,0.85);
}
[data-color="emerald"] { --accent: #10b981; --bg: #f0fdf4; --surface: #dcfce7; }
[data-color="amber"]   { --accent: #f59e0b; --bg: #fffbeb; --surface: #fef3c7; }
[data-color="rose"]     { --accent: #f43f5e; --bg: #fff1f2; --surface: #ffe4e6; }
[data-color="violet"]   { --accent: #8b5cf6; --bg: #f5f3ff; --surface: #ede9fe; }
[data-color="slate"]    { --accent: #475569; --bg: #f8fafc; --surface: #f1f5f9; }
[data-color="coffee"]   { --accent: #92400e; --bg: #fffaf0; --surface: #fdf5e6; }
[data-color="midnight"] { --accent: #3b82f6; --bg: #f0f9ff; --surface: #e0f2fe; }

[data-theme="dark"] {
  --bg: #0f1115; --text: #e6e6e6; --muted: #aaaaaa;
  --surface: #1b1d23; --border-color: #333333; --nav-bg: rgba(20, 22, 26, 0.9);
}
[data-theme="dark"][data-color="blue"]     { --accent: #60a5fa; }
[data-theme="dark"][data-color="emerald"] { --accent: #34d399; --bg: #06201b; }
[data-theme="dark"][data-color="amber"]   { --accent: #fbbf24; --bg: #1f1a0d; }
[data-theme="dark"][data-color="rose"]     { --accent: #fb7185; --bg: #200a0e; }
[data-theme="dark"][data-color="violet"]   { --accent: #a78bfa; --bg: #161025; }
[data-theme="dark"][data-color="gemini"]  { --accent: #a8c7fa; --bg: #0b0b0b; --surface: #181818; }
[data-theme="dark"][data-color="slate"]   { --accent: #94a3b8; --bg: #1e293b; --surface: #334155; }
[data-theme="dark"][data-color="coffee"]  { --accent: #d97706; --bg: #2d241e; --surface: #3e322b; }
[data-theme="dark"][data-color="midnight"] { --accent: #60a5fa; --bg: #081229; --surface: #122244; }

body { background: var(--bg); color: var(--text); transition: background 0.5s ease, color 0.3s ease; font-family: 'Fira Sans', sans-serif; margin: 0; line-height: 1.8; }

/* HEADER */
header.main-header {
  width: 100%;
  aspect-ratio: 1600 / 600; /* sesuai desain */
  background-size: cover;
  background-position: center;
  margin-bottom: 0px;
}

.header-container-inner { max-width: 820px; margin: 0 auto; height: 80%; position: relative; }
.icon-rubrik { height: 45px; width: auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.icontext { padding: 5px 22px; background: #092c4b; border-radius: 6px; border-left: #06d014 4px solid; color: white; z-index:3000;}
.header-icon-pos { display: flex; gap: 8px; align-items: center; position: fixed; top: 15px; left: 15px; z-index:3001;}

/* --- AUTOFLOW WRAPPER (DEFAULT DESKTOP 2 KOLOM) --- */
.autoflow-wrapper {
    display: block !important;
    width: 100% !important;
    column-count: 2 !important; 
    column-gap: 40px !important;
    column-rule: 1px solid var(--border-color) !important;
    column-fill: balance !important;
    height: auto !important;
    overflow: visible !important;
    margin-bottom: 25px;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}

.autoflow-wrapper p { 
    break-inside: auto !important; 
    margin-bottom: 15px; 
    text-align: justify;
    line-height: var(--line); 
}

.autoflow-wrapper img {
    max-width: 100%; height: auto; display: block; break-inside: avoid;
}

.rm-article { display: flex; justify-content: center; padding: 0 5vw 5px; }
.rm-reading { max-width: 820px; width: 100%; transition: max-width 0.3s; position: relative; }

.article-content { 
    font-size: var(--font); 
    line-height: var(--line);
    overflow-wrap: break-word; 
}
.article-content h1, .article-content h2, .article-content h3, .article-content h4 { 
    line-height: 1.3 !important; 
    margin-top: 1.5em; 
    margin-bottom: 0.5em; 
    color: var(--accent);
}
.article-content p { margin: 0 0 1.4em; text-align: justify; }

/* CUSTOM ELEMENTS */
.st-judul-bab { font-size: 28px; font-weight: 800; border-bottom: 3px solid var(--accent); color: var(--accent); display: block; margin: 30px 0 20px; }
.st-arab-mushaf { 
    font-family: 'KFGQPC Uthman Taha Naskh', serif !important; 
    /* Gunakan em, artinya: 1.6 kali dari ukuran --font saat ini */
    font-size: 1.6em !important; 
    /* Gunakan variabel --line langsung */
    line-height: var(--line) !important; 
    direction: rtl !important; 
    text-align: justify !important; 
    display: block; 
    margin: 1.5em 0; 
}
.st-num1 { margin-left: -24px; padding-left: 14px; text-align: justify;} .st-num2 { margin-left: 17px; padding-left: 14px; text-align: justify;}
.st-box { margin: 30px 0; padding: 25px; background: var(--surface); border-radius: 12px; }
blockquote {
    display: block; margin: 1.5em 40px; padding: 10px 20px;
    border-left: 2px solid var(--accent); background: var(--surface);
    border-radius: 4px; font-style: italic; text-align: justify;
}

/* --- UI BUTTONS (FAB, CONTROLS, MODAL) --- */
.fab-main { 
    display: flex; position: fixed; bottom: 20px; right: 20px; 
    width: 50px; height: 50px; border-radius: 50%; 
    background: var(--accent); color: #fff; 
    justify-content: center; align-items: center; 
    z-index: 1001; border: none; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* =========================================
   1. DEFAULT / DESKTOP (Panel Kotak Samping)
   ========================================= */
.rm-controls-v {
    position: fixed; bottom: 80px; right: 20px; display: none;
    flex-direction: column; gap: 8px; z-index: 1000; width: 120px;
    background: var(--nav-bg); padding: 12px; border-radius: 18px;
    backdrop-filter: blur(10px); border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.rm-controls-v.active { display: flex; }

/* Desktop Style: Gabungkan grup agar terlihat menyatu dalam satu panel */
.group-up, .group-left { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.control-line { display: none; } /* Sembunyikan garis di desktop */

.rm-controls-v button, .rm-controls-v select {
    background: var(--bg); color: var(--text); border: 1px solid var(--border-color);
    padding: 9px; border-radius: 10px; cursor: pointer; width: 100%;
}

/* =========================================
   2. MOBILE ONLY (Modern L-Shape Design)
   ========================================= */
@media (max-width: 768px) {
    .rm-controls-v {
        position: fixed; bottom: 20px; right: 20px;
        width: auto; height: auto; background: none;
        border: none; box-shadow: none; padding: 0; z-index: 10000;
    }

    /* Kontrol lari ke ATAS */
    .group-up {
        position: absolute; bottom: 65px; right: 0;
        flex-direction: column-reverse; gap: 12px; align-items: flex-end;
    }

    /* Tema lari ke KIRI */
    .group-left {
        position: absolute; right: 65px; bottom: 30px;
        flex-direction: row-reverse; gap: 10px; align-items: center;
        background: var(--nav-bg); padding: 8px 15px; border-radius: 50px;
        border: 1px solid var(--border-color); width: max-content;
    }

    /* Ikon Garis & Bulatan (Hanya Mobile) */
    .control-item { display: flex; align-items: center; gap: 10px; }
    .control-line { 
        display: block; width: 20px; height: 2px; 
        background: var(--accent); opacity: 0.6; 
    }

    .group-up button {
        width: 45px; height: 45px; border-radius: 50%;
        border: 2px solid var(--accent); background: var(--nav-bg);
        color: var(--accent); font-weight: bold;
    }

    .group-left select, .group-left button {
        width: auto; background: transparent; border: none;
    }

    /* Animasi Mobile */
    .rm-controls-v.active .group-up { animation: slideUpFade 0.3s ease; }
    .rm-controls-v.active .group-left { animation: slideLeftFade 0.3s ease; }
}

@keyframes slideUpFade { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
@keyframes slideLeftFade { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

.exit-focus-mobile {
    display: none; position: fixed; top: 15px; right: 15px; z-index: 10002;
    background: var(--accent); color: white; border: none; padding: 8px 18px;
    border-radius: 20px; font-size: 0.8rem; font-weight: bold; cursor: pointer;
}

/* MODAL RESUME (LANJUT BACA) */
.modal-resume {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: transparent; display: none; z-index: 20000;
}
.modal-resume-minimal {
    position: fixed;
    right: 22px;
    bottom: 90px;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    /* 🔑 Tema-aware */
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    color: var(--text);

    padding: 8px 14px;
    border-radius: 9px;

    font-size: 12px;
    font-weight: 500;

    border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border-color));

    box-shadow:
        0 2px 6px rgba(0,0,0,0.08),
        0 8px 20px rgba(0,0,0,0.06);

    cursor: pointer;
    z-index: 9999;

    backdrop-filter: blur(6px);
    animation: fadeInUp 0.25s ease;
}

/* Ikon ikut accent */
.resume-icon {
    font-size: 14px;
    color: var(--accent);
    opacity: 0.85;
}

/* Hover lembut */
.modal-resume-minimal:hover {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    box-shadow:
        0 4px 10px rgba(0,0,0,0.12),
        0 12px 28px rgba(0,0,0,0.1);
}


@keyframes slideUp { from { bottom: -60px; opacity: 0; } to { bottom: 90px; opacity: 1; } }

/* NAV BUTTONS */
.nav-btn { 
    position: fixed; top: 0; height: 100vh; width: 10%; 
    border: none; background: transparent; color: var(--accent); 
    font-size: 3rem; opacity: 0; z-index: 99; cursor: pointer; 
    transition: all 0.3s ease; display: flex; align-items: center; justify-content: center;
}
.nav-btn:hover { opacity: 0.6; background: rgba(128,128,128,0.05); }
.nav-prev { left: 0; } .nav-next { right: 0; }

/* FOOTER */
.auto-footer-edition { margin-top: 30px; margin-bottom: 20px; }
.footer-top-row { display: flex; align-items: center; gap: 6px; }
.footer-logo { width: 133px; height: auto; }
.footer-line { flex-grow: 1; height: 2px; background-color: var(--border-color); }
.footer-text { margin-top: 15px; font-size: 0.8rem; color: var(--text); font-weight: 500; }

/* Row navigasi (Beranda & Daftar Isi) */






/* PROGRESS BAR */
#progressBar { position: fixed; top: 0; left: 0; height: 4px; background: var(--accent); width: 0%; z-index: 10001; }

/* --- MEDIA QUERY: MOBILE --- */
@media (max-width: 768px) {
    .autoflow-wrapper { column-count: 1 !important; }
    .rm-article { padding: 0 3vw 5px; }
    
    .nav-btn { 
        width: 50px; 
        height: 120px; 
        opacity: 0.4; 
        top: 50%; 
        transform: translateY(-50%); 
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed; /* Gunakan fixed agar tetap di tepi layar */
        border: none;
        padding:0;
    }

    /* Tempelkan ke tepi kiri */
    .nav-prev { 
        left: 0 !important; 
        border-radius: 0 15px 15px 0; /* Lengkungan hanya di sisi dalam */
    }

    /* Tempelkan ke tepi kanan */
    .nav-next { 
        right: 0 !important; 
        border-radius: 15px 0 0 15px; /* Lengkungan hanya di sisi dalam */
    }

    .nav-btn svg {
        height: 60px;
        width: 15px;
    }

    .modal-resume-minimal { bottom: 100px; }
    body.focus-active .exit-focus-mobile { display: block !important; }
    body.focus-active .nav-btn,
    body.focus-active .floating-menu, 
    body.focus-active .menu-overlay,
    body.focus-active .menu-toggle { 
    display: none !important; 
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
}

/* --- MEDIA QUERY: DESKTOP (FOKUS MODE) --- */
@media (min-width: 769px) {
    body.focus-active .rm-reading { max-width: 60% !important; margin: 0 auto; padding-top: 60px; }
    body.focus-active .autoflow-wrapper { column-count: 1 !important; }
    body.focus-active .exit-focus-mobile { display: block !important; }
    body.focus-active header.main-header, 
    body.focus-active .nav-btn, 
    body.focus-active .article-footer-actions,
    body.focus-active .auto-footer-edition { display: none !important; }
}


/* --- ARTICLE FOOTER ACTIONS --- */

/* Tombol Kembali Kapsul */
.btn-back-edisi {
    display: inline-block;
    padding: 10px 24px;
    background-color: var(--surface);
    color: var(--accent);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

/* Tombol Share Kotak Asli */
.share-btn { 
    padding: 8px 16px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-size: 13px; 
    font-weight: bold; 
    color: white !important; 
    display: flex;
    align-items: center;
}
.wa { background-color: #25d366; } .fb { background-color: #1877f2; } 
.tw { background-color: #000; } .tg { background-color: #0088cc; }

/* --- PENGATURAN RESPONSIF (DESKTOP-MOBILE) --- */


@media (max-width: 768px) {
header.main-header {
    width: 100%; max-width: 100%; height: 280px; 
}
}

.surat-wrapper {
    width: 100%;
    max-width: 820px; /* Samakan dengan lebar artikel Anda */
    margin: 0 auto;
    /* Hapus height statis, hapus border, hapus shadow */
    height: auto; 
    background: transparent;
    overflow: hidden; 
}

.surat-wrapper iframe {
    width: 100%;
    /* Tinggi awal, akan diupdate otomatis oleh script */
    height: 1000px; 
    border: none;
    display: block;
    /* Hilangkan scroll internal iframe */
    overflow: hidden; 
}

.header-write-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
}

/* =========================================
   FIXED FOOTER ACTIONS (DESKTOP & MOBILE)
   ========================================= */

.article-footer-actions {
    display: flex !important;
    flex-wrap: wrap !important; /* Izinkan membungkus di mobile */
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-top: 40px !important;
    padding: 20px 0 !important;
    gap: 20px !important;
}

/* Navigasi: Beranda + Daftar Isi */
.footer-nav-row {
    display: flex !important;
    flex-direction: row !important; /* Selalu sebaris horizontal */
    gap: 12px !important;
    flex: 0 1 auto !important;
}

/* Tombol Kapsul */
.footer-nav-row .btn-back-edisi {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 20px !important;
    background-color: var(--surface) !important;
    color: var(--accent) !important;
    text-decoration: none !important;
    border-radius: 50px !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    border: 1px solid var(--border-color) !important;
    white-space: nowrap !important;
    margin: 0 !important;
}

/* Grup Tombol Share */
.share-container {
    flex: 0 0 auto !important;
}

.share-buttons {
    display: flex !important;
    flex-direction: row !important; /* Share selalu sebaris horizontal */
    gap: 10px !important;
}

.share-btn {
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    color: white !important;
    text-decoration: none !important;
    font-size: 16px !important;
    transition: transform 0.2s !important;
}

/* --- RESPONSIVE LOGIC --- */

@media (max-width: 820px) {
    /* Di layar tablet/mobile, paksa pecah jadi 2 baris */
    .article-footer-actions {
        flex-direction: column !important;
        justify-content: center !important;
        text-align: center !important;
    }

    /* Baris 1: Navigasi penuhi lebar */
    .footer-nav-row {
        width: 100% !important;
        justify-content: center !important;
    }

    .footer-nav-row .btn-back-edisi {
        flex: 1 !important; /* Tombol bagi dua rata di mobile */
        font-size: 0.8rem !important;
        padding: 10px 5px !important;
    }

    /* Baris 2: Share penuhi lebar */
    .share-container {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
}

@media (min-width: 821px) {
    /* Desktop: Pastikan tidak ada pembungkusan */
    .article-footer-actions {
        flex-wrap: nowrap !important;
    }
}

/* --- MINIMALIST AUDIO PLAYER STYLE --- */

.audio-premium-player {
    background: var(--surface);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin: 20px 0 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.audio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.audio-icon {
    font-size: 1.1rem;
}

/* Style khusus untuk tag audio */
.custom-audio-element {
    width: 100% !important;
    height: 40px;
    outline: none;
}

/* Styling Chrome, Edge, & Safari (Webkit) */
.custom-audio-element::-webkit-media-controls-panel {
    background-color: var(--surface);
}

.custom-audio-element::-webkit-media-controls-current-time-display,
.custom-audio-element::-webkit-media-controls-time-remaining-display {
    color: var(--text);
    font-family: 'Fira Sans', sans-serif;
}

.custom-audio-element::-webkit-media-controls-play-button {
    background-color: var(--accent);
    border-radius: 50%;
}

/* Responsif Mobile */
@media (max-width: 768px) {
    .audio-premium-player {
        padding: 8px;
    }
    .audio-info {
        font-size: 0.75rem;
    }
}

.footnote { color: #1a73e8 !important; text-decoration: underline !important; cursor: pointer !important; font-weight: bold; }

/* Styling Tooltip agar jadi Bottom Sheet di Mobile */
.mobile-tooltip-box {
    position: fixed;
    bottom: -100%; /* Sembunyi di bawah */
    left: 0;
    width: 95%;
    background: var(--surface);
    color: var(--text);
    padding: 20px 25px 40px; /* Padding bawah lebih besar agar tidak kena navigasi HP */
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    z-index: 20001;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 4px solid var(--accent);
    max-height: 50vh;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.6;
    display: block !important; /* Pastikan selalu block, kita mainkan di posisi bottom */
}

.mobile-tooltip-box.active {
    bottom: 0;
}

/* Tambahkan overlay gelap di belakang footnote */
.footnote-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 20000;
    display: none;
}
.footnote-overlay.active { display: block; }

.interaction-bar {
    position: fixed;
    right: 0px;
    bottom: 87px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 9999;
    background: var(--bg);
    padding: 10px 15px 4px 5px;
    border-radius: 10px 0 0 10px;
}

.interaction-bar .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: var(--text);
}

/* ICON */
.interaction-bar .item i {
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--text);
}

/* ANGKA */
.interaction-bar .item span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* LIKE ACTIVE */
.interaction-bar .item.liked i {
  color: #e0245e;
}
