/* ===============================
   Hafalan Qur'an — Style Utama
   Tema: Monokrom putih bermotif
   =============================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #FFFFFF;
    --pattern: #EEEEEE;
    --text-utama: #1A1A1A;
    --text-terjemah: #555555;
    --text-sekunder: #999999;
    --border: #E5E5E5;
    --tombol-aktif: #000000;
    --tombol-hover: #333333;
    --font-arab: 'Amiri Quran', 'Scheherazade New', 'Traditional Arabic', serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    background-image: url('../img/pattern.jpeg');
    background-repeat: repeat;
    background-size: 320px 320px;
    color: var(--text-utama);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container utama */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========== Navbar ========== */
.navbar {
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-utama);
    font-weight: 600;
    font-size: 1.1rem;
}

.logo-img {
    height: 48px;        /* Ubah ke 40 / 56 / 64 sesuai selera */
    width: auto;
    max-width: 60px;     /* Batas aman supaya tidak melebar */
    object-fit: contain;
    display: block;
}

.nav-links {
    display: flex;
    gap: 1.75rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-terjemah);
    font-size: 0.95rem;
    transition: color 0.2s ease;
    position: relative;
}

.nav-links a:hover {
    color: var(--tombol-aktif);
}

.nav-links a.active {
    color: var(--tombol-aktif);
    font-weight: 600;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1.05rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--tombol-aktif);
}

/* ========== Tipografi ========== */
h1, h2, h3, h4 {
    color: var(--text-utama);
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-terjemah);
}

a {
    color: var(--tombol-aktif);
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--tombol-hover);
}

/* ========== Main ========== */
main {
    flex: 1;
    padding: 2.5rem 0;
}

/* ========== Tombol ========== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--tombol-aktif);
    color: #FFFFFF;
    text-decoration: none;
    border: 1px solid var(--tombol-aktif);
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
    background-color: var(--tombol-hover);
    color: #FFFFFF;
    border-color: var(--tombol-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn-outline {
    background-color: transparent;
    color: var(--tombol-aktif);
    border: 1px solid var(--tombol-aktif);
}

.btn-outline:hover {
    background-color: var(--tombol-aktif);
    color: #FFFFFF;
}

/* ========== Card ========== */
.card {
    background-color: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* ========== Form ========== */
select, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #FFFFFF;
    color: var(--text-utama);
    transition: border-color 0.2s ease;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--tombol-aktif);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-utama);
    font-size: 0.95rem;
}

/* ========== Hero / Intro ========== */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1.1rem;
    max-width: 540px;
    margin: 0 auto 1.5rem;
}

/* ========== Footer ========== */
.footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
}

.footer p {
    color: var(--text-sekunder);
    font-size: 0.875rem;
    margin: 0;
}

/* ========== Utility ========== */
.text-center { text-align: center; }
.text-arab {
    font-family: var(--font-arab);
    direction: rtl;
    font-size: 2rem;
    line-height: 2.2;
    color: var(--text-utama);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Mobile (≤ 640px) */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .logo {
        gap: 0.5rem;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .logo-img {
        height: 38px;
        max-width: 50px;
    }
    
    .logo-text {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .nav-links {
        gap: 0.85rem;
        flex-shrink: 0;
    }
    
    .nav-links a {
        font-size: 0.85rem;
    }
    
    .nav-links a.active::after {
        display: none;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    .hero { padding: 2rem 0 1.5rem; }
    .hero h1 { font-size: 1.75rem; }
    .hero p { font-size: 1rem; }
    .text-arab { font-size: 1.6rem; }
    
    .card {
        padding: 1.25rem 1rem;
    }
    
    .font-switcher {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.875rem 1rem;
    }
    
    /* Qari Switcher — sama style-nya dengan edisi-switcher */
    .qari-switcher {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }
    
    .qari-switcher label {
        margin: 0;
        font-weight: 600;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    .qari-switcher select {
        flex: 1;
        min-width: 200px;
        font-size: 0.95rem;
    }
    
    @media (max-width: 640px) {
        .qari-switcher {
            flex-direction: column;
            align-items: stretch;
        }
    }
    
    main {
        padding: 1.5rem 0;
    }
    /* Gap antar card di mobile */
    .card + .card,
    .kontrol + .kontrol-aksi,
    .kontrol-aksi + .edisi-switcher,
    .edisi-switcher + .audio-controls,
    .audio-controls + .font-switcher,
    .font-switcher + .ayat-list,
    .card + .ayat-list {
        margin-top: 1rem;
    }
}

/* Mobile sempit (≤ 420px) */
@media (max-width: 420px) {
    .logo-text {
        display: none;
    }
    
    .logo-img {
        height: 36px;
        max-width: 48px;
    }
    
    .nav-links {
        gap: 0.65rem;
    }
    
    .nav-links a {
        font-size: 0.8rem;
    }
    
    .nav-inner {
        padding: 0.65rem 0.875rem;
    }
}
/* ========== Auto-hide header pada landscape mobile ========== */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        transition: transform 0.3s ease;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    .header.hidden-on-scroll {
        transform: translateY(-100%);
    }
    body {
        padding-top: 55px;
    }
}

.search-result-item {
    display: block;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.search-result-item:hover {
    background: rgba(0,0,0,0.03);
    border-color: var(--accent, #2d5a3f);
}

/* ===== Surah Picker (custom searchable list) ===== */
.surah-picker {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.surah-search-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: none;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
    outline: none;
}
.surah-search-input:focus {
    background: #fafafa;
}
.surah-selected {
    padding: 0.5rem 0.9rem;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    color: var(--text-sekunder, #666);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.surah-selected.has-selection {
    background: rgba(45, 90, 63, 0.08);
    color: var(--text-primer, #000);
    font-weight: 500;
}
.surah-selected small {
    color: var(--text-sekunder, #666);
    font-size: 0.8rem;
}
.surah-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 260px;
    overflow-y: auto;
}
.surah-list-loading,
.surah-list-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-sekunder, #666);
    font-size: 0.9rem;
}
.surah-item {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f3f3;
    transition: background 0.12s;
    font-size: 0.95rem;
}
.surah-item:last-child {
    border-bottom: none;
}
.surah-item:hover {
    background: #f7f7f7;
}
.surah-item.is-match {
    background: rgba(255, 235, 100, 0.45);  /* highlight kuning */
    font-weight: 600;
}
.surah-item.is-selected {
    background: rgba(45, 90, 63, 0.12);
    color: var(--accent, #2d5a3f);
    font-weight: 600;
}
.surah-item.is-match.is-selected {
    background: linear-gradient(90deg, rgba(255,235,100,0.45), rgba(45,90,63,0.12));
}

/* Halaman Tentang */
.tentang-page { max-width: 760px; padding: 2rem 1.5rem; }
.tentang-hero {
    text-align: center;
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 2rem;
}
.tentang-logo { width: 90px; margin-bottom: 1rem; }
.tentang-hero h1 { font-size: 1.8rem; margin-bottom: 0.4rem; font-weight: 700; }
.tentang-tagline { color: #666; font-size: 1rem; }

.tentang-section { margin-bottom: 2rem; }
.tentang-section h2 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.tentang-section p {
    line-height: 1.7;
    color: #333;
    margin-bottom: 0.75rem;
}
.tentang-list {
    padding-left: 1.5rem;
    line-height: 1.9;
    color: #333;
}
.tentang-list li { margin-bottom: 0.35rem; }
.tentang-list a { color: #2d5a3f; text-decoration: underline; }

.tentang-credits {
    background: rgba(45, 90, 63, 0.04);
    border-left: 3px solid #2d5a3f;
    padding: 1.25rem 1.5rem;
    border-radius: 0 8px 8px 0;
}
.tentang-version {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

@media (max-width: 640px) {
    .tentang-page { padding: 1.25rem 1rem; }
    .tentang-logo { width: 70px; }
    .tentang-hero h1 { font-size: 1.4rem; }
    .tentang-section h2 { font-size: 1.05rem; }
}