:root {
    --primary: #00c896;
    --primary-dark: #00a87d;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-input: #f8fafc;
    --bg-active-ayat: #f0fdf4;
    --player-bg: rgba(255, 255, 255, 0.85);
    --scrollbar-track: transparent;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
    --bg-tafsir-arab: #f1f5f9;
}

body.dark-theme {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --bg-input: #0f172a;
    --bg-active-ayat: #064e3b;
    --player-bg: rgba(30, 41, 59, 0.85);
    --scrollbar-track: transparent;
    --scrollbar-thumb: #475569;
    --scrollbar-thumb-hover: #64748b;
    --bg-tafsir-arab: #182235;
}

* { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; margin: 0; display: flex; flex-direction: column; height: 100vh; background-color: var(--bg-body); color: var(--text-primary); transition: background-color 0.3s, color 0.3s; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }

/* Navbar */
.navbar { background: var(--bg-card); padding: 1rem 2rem; display: flex; justify-content: center; border-bottom: 1px solid var(--border-color); transition: 0.3s;}
.navbar-content { width: 100%; max-width: 800px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.logo { font-size: 1.5rem; margin: 0; color: var(--primary); font-weight: bold; }
.search-container { flex: 1; display: flex; align-items: center; }
#search-surah { width: 100%; padding: 10px 20px; border-radius: 30px; border: 1px solid var(--border-color); background: var(--bg-input); font-size: 1rem; color: var(--text-primary); transition: 0.3s; }
#search-surah:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,200,150,0.1); }
.theme-btn { background: transparent !important; border: none !important; box-shadow: none !important; font-size: 1.5rem; cursor: pointer; padding: 5px; transition: transform 0.2s; outline: none !important; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
.theme-btn:hover { transform: scale(1.1); }

/* Custom Qari Dropdown */
.settings-group { display: flex; align-items: center; gap: 15px; }
.custom-qari-dropdown { position: relative; z-index: 150; transition: 0.3s; }
.qari-dropdown-trigger { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary); padding: 8px 16px; border-radius: 30px; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 170px; justify-content: space-between; transition: all 0.2s ease; }
.qari-dropdown-trigger:hover { border-color: var(--primary); }
#qari-trigger-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.arrow-icon { transition: transform 0.2s; color: var(--text-secondary); flex-shrink: 0; }
.custom-qari-dropdown.open .arrow-icon { transform: rotate(180deg); }
.qari-dropdown-menu { list-style: none; padding: 10px 0; margin: 0; position: absolute; top: calc(100% + 10px); right: 0; width: 220px; background: var(--player-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-color); border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); display: none; overflow-y: auto; max-height: 250px; animation: slideDown 0.2s ease-out; transition: background-color 0.3s, border-color 0.3s; }
.custom-qari-dropdown.open .qari-dropdown-menu { display: block; }
.qari-dropdown-option { padding: 10px 20px; font-size: 0.9rem; color: var(--text-primary); cursor: pointer; transition: all 0.2s ease; text-align: left; }
.qari-dropdown-option:hover { background: rgba(0, 200, 150, 0.1); color: var(--primary); }
.qari-dropdown-option.active { font-weight: bold; color: var(--primary); background: rgba(0, 200, 150, 0.1); }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Layout Globals */
.container { flex: 1; width: 100%; max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; padding: 1rem; position: relative; }
.page-title { margin: 1rem 0; font-size: 1.8rem; text-align: center; font-weight: bold; }
.scroll-area { flex: 1; overflow-y: auto; padding-bottom: 150px; padding-right: 5px; }

/* Grid Surah */
.list-surah { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; align-content: start; }
.surah-item { background: var(--bg-card); border-radius: 12px; padding: 18px; border: 1px solid var(--border-color); cursor: pointer; transition: box-shadow 0.3s ease, border-color 0.3s ease; }
.surah-item:hover { border-color: var(--primary); box-shadow: 0 4px 15px rgba(0, 200, 150, 0.15); }
.surah-main { display: flex; justify-content: space-between; align-items: flex-start; }
.surah-left { display: flex; align-items: center; gap: 12px; }
.surah-number { font-size: 1rem; font-weight: 700; color: var(--primary); background: rgba(0, 200, 150, 0.1); width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.surah-names { display: flex; flex-direction: column; align-items: flex-start; }
.surah-latin { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px;}
.surah-arti { font-size: 0.85rem; color: var(--text-secondary); margin-top: 3px;}
.surah-arab { font-family: 'Amiri', serif; font-size: 1.8rem; line-height: 1; color: var(--text-primary); }
.surah-item-footer { margin-top: 15px; border-top: 1px dashed var(--border-color); padding-top: 12px; color: var(--text-secondary); font-size: 0.85rem; text-align: right; }

/* Badges Mekah/Madinah */
.badge-tempat { font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; font-weight: 600; letter-spacing: 0.5px;}
.badge-mekah { background: rgba(234, 179, 8, 0.15); color: #d97706; }
.badge-madinah { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
body.dark-theme .badge-mekah { color: #facc15; }
body.dark-theme .badge-madinah { color: #4ade80; }

/* Detail Header & Hero Banner */
.detail-header { position: sticky; top: 0; background: var(--bg-body); z-index: 50; padding: 10px 0 15px 0; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; transition: 0.3s; }
.btn-back { padding: 8px 20px; border-radius: 30px; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); cursor: pointer; font-weight: 600; transition: 0.3s; }
.btn-back:hover { background: var(--border-color); }
.btn-play-surah { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; padding: 8px 20px; border-radius: 30px; cursor: pointer; font-weight: bold; display: flex; align-items: center; box-shadow: 0 4px 10px rgba(0, 200, 150, 0.3); }

.surah-hero { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: 16px; padding: 2rem 1rem; text-align: center; margin-bottom: 2rem; box-shadow: 0 10px 25px rgba(0, 200, 150, 0.2); }
.hero-latin { font-size: 1.8rem; font-weight: bold; margin-bottom: 0.5rem; }
.hero-arab { font-family: 'Amiri', serif; font-size: 3.5rem; margin: 10px 0; font-weight: normal; }
.hero-stats { font-size: 0.95rem; opacity: 0.9; margin-top: 1rem; border-top: 1px solid rgba(255,255,255,0.2); padding-top: 1rem; display: flex; justify-content: center; align-items: center; gap: 10px;}
.surah-hero .badge-tempat { background: rgba(255, 255, 255, 0.25) !important; color: #ffffff !important; border: 1px solid rgba(255, 255, 255, 0.5); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }

/* Item Ayat */
.ayat-item { background: var(--bg-card); padding: 1.5rem; border-radius: 12px; margin-bottom: 1.2rem; border: 1px solid var(--border-color); scroll-margin-top: 80px; transition: 0.3s; }
.ayat-item.active { background: var(--bg-active-ayat); border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.ayat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px dashed var(--border-color); }
.ayat-index { font-weight: 700; color: var(--primary); font-size: 1rem; background: rgba(0, 200, 150, 0.1); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }

.ayat-controls-group { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;}
.btn-play-ayat { background: transparent; border: 1px solid var(--primary); color: var(--primary); padding: 6px 14px; border-radius: 30px; cursor: pointer; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 5px; transition: 0.2s;}
.btn-play-ayat:hover { background: var(--primary); color: white; }
.btn-tafsir { background: transparent; border: 1px solid var(--text-secondary); color: var(--text-secondary); padding: 6px 14px; border-radius: 30px; cursor: pointer; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 5px; transition: 0.2s; }
.btn-tafsir:hover { background: var(--text-secondary); color: var(--bg-card); }

.ayat-arab { font-family: 'Amiri', serif; font-size: 34px; text-align: right; margin-bottom: 1.5rem; line-height: 2.2; display: block; width: 100%; color: var(--text-primary);}
.ayat-latin { font-size: 15px; font-weight: 600; margin-bottom: 0.8rem; display: block; color: var(--primary); }
.ayat-indo { font-size: 15px; color: var(--text-secondary); display: block; line-height: 1.6; }

/* =========================================================
   GAYA NAVIGASI SURAH (Selanjutnya & Sebelumnya)
   ========================================================= */
.surah-navigation { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 15px; 
    margin: 40px 0 20px 0; 
    padding-top: 20px; 
    border-top: 1px dashed var(--border-color); 
}
.nav-btn { 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: 16px; 
    padding: 15px 20px; 
    display: flex; 
    align-items: center; 
    cursor: pointer; 
    transition: all 0.3s ease; 
    color: var(--text-primary); 
    text-decoration: none; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}
.nav-btn:hover { 
    border-color: var(--primary); 
    box-shadow: 0 5px 15px rgba(0, 200, 150, 0.1); 
    transform: translateY(-2px); 
}
.nav-btn.prev { grid-column: 1; justify-content: flex-start; text-align: left; gap: 15px; }
.nav-btn.next { grid-column: 2; justify-content: flex-end; text-align: right; gap: 15px; }
.nav-text { display: flex; flex-direction: column; gap: 4px; }
.nav-text small { color: var(--text-secondary); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;}
.nav-text span { font-weight: 700; font-size: 1.05rem; color: var(--primary); }
.nav-btn svg { color: var(--text-secondary); transition: 0.3s; flex-shrink: 0;}
.nav-btn:hover svg { color: var(--primary); }

/* Modal Tafsir Premium */
.modal { display: none; position: fixed; z-index: 200; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); backdrop-filter: blur(5px); justify-content: center; align-items: center; padding: 15px; }
.modal-content { background: var(--bg-card); border-radius: 20px; width: 100%; max-width: 700px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.3); border: 1px solid var(--border-color); animation: slideUp 0.3s ease-out; overflow: hidden; }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-header-left { display: flex; align-items: center; gap: 15px; }
.tafsir-icon { background: #3b82f6; color: white; width: 45px; height: 45px; border-radius: 50%; display: flex; justify-content: center; align-items: center; flex-shrink: 0;}
.modal-header h3 { margin: 0 0 5px 0; color: var(--text-primary); font-size: 1.2rem; }
.tafsir-badges { display: flex; gap: 8px; }
.tafsir-badges span { background: var(--border-color); color: var(--text-primary); font-size: 0.75rem; padding: 4px 10px; border-radius: 12px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; color: var(--text-primary); }
.tafsir-arab-box { background: var(--bg-tafsir-arab); border: 1px solid var(--border-color); padding: 20px; border-radius: 12px; margin-bottom: 25px; text-align: right; font-family: 'Amiri', serif; font-size: 28px; line-height: 2; color: var(--text-primary); }
#tafsir-text-content p { margin-top: 0; margin-bottom: 1.2rem; line-height: 1.8; text-align: justify; font-size: 0.95rem; }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Player Modern */
.modern-player { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 500px; background: var(--player-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(150, 150, 150, 0.2); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); border-radius: 40px; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; gap: 15px; z-index: 100; transition: 0.3s; }
.player-info { flex: 1; display: flex; flex-direction: column; overflow: hidden; white-space: nowrap; }
.player-title { font-weight: 700; font-size: 0.95rem; color: var(--primary); overflow: hidden; text-overflow: ellipsis; }
.player-ayat { font-size: 0.8rem; color: var(--text-secondary); }
.player-controls { display: flex; align-items: center; gap: 10px; flex: 2; }
.play-pause-btn { background: var(--primary); color: white; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; display: flex; justify-content: center; align-items: center; padding: 0; box-shadow: 0 4px 10px rgba(0, 200, 150, 0.3); transition: 0.2s; }
.play-pause-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.progress-bar { flex: 1; height: 6px; border-radius: 5px; background: var(--border-color); outline: none; -webkit-appearance: none; cursor: pointer; accent-color: var(--primary); }
.progress-bar::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); cursor: pointer; }
.close-btn { background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; transition: 0.2s;}
.close-btn:hover { color: #ef4444; }

/* =========================================================
   Responsive Mobile Rules (PERBAIKAN NAVIGASI HP)
   ========================================================= */
@media (max-width: 600px) {
    .navbar { padding: 15px; }
    .navbar-content { flex-direction: column; align-items: stretch; gap: 12px; }
    .logo { font-size: 1.6rem; text-align: center; margin-bottom: 5px; }
    .settings-group { width: 100%; justify-content: space-between; gap: 10px; }
    .custom-qari-dropdown { flex: 1; }
    .qari-dropdown-trigger { width: 100%; justify-content: space-between; font-size: 0.85rem;}
    .qari-dropdown-menu { top: calc(100% + 5px); bottom: auto; left: 0; right: 0; width: 100%; max-width: none; }
    .search-container { width: 100%; }

    .list-surah { grid-template-columns: 1fr; }
    .modern-player { bottom: 15px; width: 95%; border-radius: 20px; flex-direction: column; align-items: stretch; padding: 15px; gap: 10px; }
    .player-info { text-align: center; }
    .player-controls { width: 100%; justify-content: space-between; }
    .ayat-arab { font-size: 28px; }
    .modal-header-left { align-items: flex-start; }
    .tafsir-arab-box { font-size: 24px; padding: 15px; }
    
    /* FIX NAVIGASI MOBILE AGAR KIRI-KANAN */
    .surah-navigation { display: flex; flex-direction: row; gap: 10px; }
    .nav-btn { padding: 12px 10px; flex: 1; }
    .nav-btn.prev { gap: 5px; justify-content: flex-start; }
    .nav-btn.next { gap: 5px; justify-content: flex-end; }
    .nav-text small { font-size: 0.6rem; }
    .nav-text span { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; } /* Mencegah nama surah panjang merusak layout */
    .nav-btn svg { width: 20px; height: 20px; }
}
