* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root {
    --hijau-tua: #005b43;
    --hijau-tua-2: #004936;
    --hijau-muda: #16805f;
    --hijau-pucat: #eaf5ef;
    --merah: #b52b2b;
    --emas: #d9a62e;
    --emas-muda: #f2d477;
    --putih: #ffffff;
    --teks: #17352c;
    --abu: #eef3f1;
}

body {
    margin: 0;
    background: var(--abu);
    color: var(--teks);
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================
   HEADER
   ========================= */

.topbar {
    min-height: 82px;
    padding: 14px 28px;
    background: var(--hijau-tua);
    border-bottom: 4px solid var(--emas);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
}

.topbar h1 {
    margin: 0;
    color: var(--putih);
    font-size: 25px;
    letter-spacing: .8px;
}

.topbar p {
    margin: 5px 0 0;
    color: #d8eee4;
    font-size: 14px;
}

.back-link {
    text-decoration: none;
    color: var(--hijau-tua);
    border: 2px solid var(--emas);
    border-radius: 8px;
    padding: 9px 14px;
    background: var(--putih);
    font-size: 14px;
    font-weight: 700;
}

.back-link:hover {
    background: var(--emas-muda);
    color: #3f2d00;
}

/* =========================
   LAYOUT UTAMA
   ========================= */

.reader-layout {
    width: min(1360px, calc(100% - 34px));
    margin: 18px auto 32px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 285px;
    gap: 18px;
    align-items: start;
}

.reader-panel {
    min-width: 0;
    background: var(--putih);
    border: 1px solid #c8d8d1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 67, 48, .08);
}

/* =========================
   TOOLBAR PEMBACA
   ========================= */

.reader-toolbar {
    min-height: 58px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #c9dcd4;
    background: var(--hijau-tua-2);
}

.reader-toolbar button,
.reader-bottom button {
    border: 1px solid var(--emas);
    background: var(--putih);
    color: var(--hijau-tua);
    border-radius: 7px;
    padding: 9px 13px;
    cursor: pointer;
    font-weight: 700;
}

.reader-toolbar button:hover,
.reader-bottom button:hover {
    background: var(--emas-muda);
    color: #3f2d00;
}

.reader-toolbar button:disabled,
.reader-bottom button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: #dcefe8;
}

.page-info strong {
    color: var(--emas-muda);
    font-size: 17px;
}

/* =========================
   AREA KITAB
   ========================= */

.book-viewer {
    padding: 26px 30px 30px;
    background:
        linear-gradient(135deg, #dceee5 0%, #edf6f1 48%, #d5e9df 100%);
    min-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/*
   Ukuran halaman sengaja diperkecil.
   Ini memberi ruang kosong yang cukup di sisi kiri/kanan
   sehingga halaman kitab tidak memenuhi seluruh area.
*/
.book-viewer img {
    display: block;
    width: min(76%, 760px);
    height: auto;
    background: var(--putih);
    border: 5px solid var(--putih);
    box-shadow:
        0 4px 16px rgba(0, 66, 45, .20),
        0 0 0 1px rgba(217, 166, 46, .35);
    user-select: none;
}

/* =========================
   NAVIGASI BAWAH
   ========================= */

.reader-bottom {
    padding: 12px 14px;
    border-top: 1px solid #c9dcd4;
    background: var(--hijau-pucat);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
}

#pageInput {
    width: 70px;
    padding: 9px 8px;
    border: 1px solid var(--hijau-muda);
    border-radius: 7px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--hijau-tua);
    background: var(--putih);
}

/* =========================
   MENU KANAN
   ========================= */

.side-menu {
    background: var(--putih);
    border: 1px solid #c8d8d1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 67, 48, .08);
    position: sticky;
    top: 15px;
}

.menu-title {
    padding: 17px 18px;
    color: var(--putih);
    background: var(--hijau-tua);
    border-bottom: 3px solid var(--emas);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: .4px;
}

.menu-item {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #dbe7e2;
    background: var(--putih);
    padding: 14px 13px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    cursor: pointer;
}

.menu-item:hover {
    background: var(--hijau-pucat);
    border-left: 4px solid var(--emas);
    padding-left: 9px;
}

.menu-letter {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 2px solid var(--hijau-muda);
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--putih);
    background: var(--hijau-tua);
}

.menu-item b {
    display: block;
    font-size: 14px;
    color: var(--hijau-tua);
}

.menu-item small {
    display: block;
    margin-top: 3px;
    color: #667c74;
    font-size: 11px;
    line-height: 1.35;
}

.menu-note {
    margin: 14px;
    padding: 13px;
    background: var(--hijau-pucat);
    border: 1px solid #c9ded5;
    border-left: 4px solid var(--merah);
    border-radius: 8px;
}

.menu-note strong {
    color: var(--hijau-tua);
    font-size: 13px;
}

.menu-note p {
    margin: 6px 0 0;
    color: #667c74;
    font-size: 12px;
    line-height: 1.5;
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 850px) {
    .reader-layout {
        grid-template-columns: 1fr;
    }

    .side-menu {
        position: static;
        order: -1;
    }

    .book-viewer {
        padding: 16px;
    }

    .book-viewer img {
        width: min(88%, 760px);
    }
}

@media (max-width: 520px) {
    .topbar {
        padding: 12px 14px;
        min-height: 72px;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .reader-layout {
        width: calc(100% - 14px);
        margin-top: 8px;
    }

    .reader-toolbar {
        padding: 8px;
    }

    .reader-toolbar button,
    .reader-bottom button {
        padding: 8px 9px;
        font-size: 12px;
    }

    .book-viewer {
        min-height: 55vh;
        padding: 10px;
    }

    .book-viewer img {
        width: 94%;
    }
}


/* =========================
   FOLDER AUDIO HIZIB
   ========================= */
.menu-red {
    background: var(--merah);
    border-color: var(--merah);
}
.audio-toggle { position: relative; }
.menu-arrow {
    margin-left: auto;
    color: var(--emas);
    font-size: 20px;
    font-weight: 700;
}
.audio-folder {
    background: #f7fbf9;
    border-bottom: 1px solid #dbe7e2;
}
.audio-folder-title {
    padding: 12px 13px 9px;
    color: var(--hijau-tua);
    font-size: 12px;
    font-weight: 800;
    border-bottom: 2px solid var(--emas);
}
.audio-range {
    padding: 10px;
    display: grid;
    gap: 6px;
    border-bottom: 1px solid #dbe7e2;
}
.audio-range label {
    font-size: 10px;
    color: #667c74;
    font-weight: 700;
}
.audio-range select {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #b9cec5;
    border-radius: 6px;
    background: #fff;
    color: var(--hijau-tua);
    font-size: 11px;
}
.play-range {
    margin-top: 4px;
    padding: 9px;
    border: 1px solid var(--merah);
    border-radius: 6px;
    background: var(--merah);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.play-range:hover { background: #932222; }
.audio-now {
    padding: 10px;
    background: var(--hijau-pucat);
    border-bottom: 1px solid #dbe7e2;
}
.audio-now strong {
    display: block;
    margin-bottom: 7px;
    color: var(--hijau-tua);
    font-size: 11px;
    line-height: 1.35;
}
.audio-now audio {
    display: block;
    width: 100%;
    height: 34px;
}
.audio-list {
    max-height: 390px;
    overflow-y: auto;
}
.audio-row {
    width: 100%;
    min-height: 43px;
    padding: 7px 8px;
    border: 0;
    border-bottom: 1px solid #e1ebe7;
    background: #fff;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 6px;
    text-align: left;
    cursor: pointer;
}
.audio-row:hover,
.audio-row.playing {
    background: #e7f3ed;
}
.audio-no {
    width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: var(--hijau-tua);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.audio-name {
    min-width: 0;
    color: #27463b;
    font-size: 10px;
    line-height: 1.3;
}
.audio-play {
    color: var(--merah);
    font-size: 12px;
    text-align: center;
}
@media (max-width: 850px) {
    .audio-list { max-height: 300px; }
}
