/* Perpustakaan Ulul Albab — tema hijau tua & emas */
:root {
  --hijau: #0F5132;
  --hijau-2: #146C43;
  --hijau-muda: #E7F2EC;
  --emas: #C9A227;
  --emas-muda: #FBF3D9;
  --krem: #FFFCF4;
  --teks: #1E2A24;
  --abu: #6B7A72;
  --garis: #E3E8E5;
  --merah: #C0392B;
  --merah-muda: #FDECEA;
  --radius: 16px;
  --bayang: 0 6px 20px rgba(15, 81, 50, .10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--krem); color: var(--teks); font-size: 16px; line-height: 1.45;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; font-size: 16px; }
a { color: var(--hijau); }
.tersembunyi { display: none !important; }

/* ---------- Kepala halaman ---------- */
.kepala {
  position: sticky; top: 0; z-index: 20;
  background: var(--hijau) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23C9A227' stroke-opacity='.18' stroke-width='1.2'%3E%3Cpath d='M28 6l6 16 16 6-16 6-6 16-6-16-16-6 16-6z'/%3E%3Crect x='17' y='17' width='22' height='22' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
  color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.kepala .kembali { background: rgba(255,255,255,.15); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 20px; cursor: pointer; }
.kepala .logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; object-fit: contain; padding: 2px; }
.kepala .judul-hal { flex: 1; min-width: 0; }
.kepala .judul-hal b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kepala .judul-hal small { color: var(--emas-muda); opacity: .9; font-size: 12.5px; }
.kepala .aksi-kanan { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; padding: 6px 10px; border-radius: 10px; cursor: pointer; font-size: 13px; }

.isi { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; }

/* ---------- Kartu & elemen umum ---------- */
.kartu { background: #fff; border-radius: var(--radius); box-shadow: var(--bayang); padding: 16px; margin-bottom: 14px; border: 1px solid var(--garis); }
.kartu h3 { margin: 0 0 10px; font-size: 17px; color: var(--hijau); }
.tombol {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 800; cursor: pointer;
  background: var(--hijau); color: #fff; min-height: 48px; text-decoration: none; transition: transform .08s, opacity .2s;
}
.tombol:active { transform: scale(.98); }
.tombol:disabled { opacity: .55; cursor: not-allowed; }
.tombol.emas { background: var(--emas); color: #3B2F07; }
.tombol.garis { background: #fff; color: var(--hijau); border: 2px solid var(--hijau); }
.tombol.merah { background: var(--merah); }
.tombol.kecil { padding: 8px 12px; min-height: 38px; font-size: 14px; border-radius: 10px; }
.tombol.penuh { width: 100%; }
.baris-tombol { display: flex; gap: 10px; flex-wrap: wrap; }
.baris-tombol > * { flex: 1; }

label.lbl { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 6px; color: #2F4A3C; }
label.lbl .wajib { color: var(--merah); }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border: 1.5px solid #CBD6D0; border-radius: 12px; background: #fff; color: var(--teks);
  outline: none; transition: border .2s, box-shadow .2s;
}
.input:focus { border-color: var(--hijau-2); box-shadow: 0 0 0 3px rgba(20,108,67,.15); }
textarea.input { min-height: 80px; resize: vertical; }
.bantu { font-size: 12.5px; color: var(--abu); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 340px) { .grid-2 { grid-template-columns: 1fr; } }

.lencana { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--hijau-muda); color: var(--hijau); }
.lencana.emas { background: var(--emas-muda); color: #7A5C00; }
.lencana.merah { background: var(--merah-muda); color: var(--merah); }
.lencana.abu { background: #EEF1EF; color: var(--abu); }

.kosong { text-align: center; color: var(--abu); padding: 30px 10px; }

/* ---------- Beranda publik ---------- */
.sambut { text-align: center; padding: 28px 16px 8px; }
.sambut img { width: 210px; height: 210px; max-width: 70vw; max-height: 70vw; border-radius: 28px; background: #fff; box-shadow: var(--bayang); object-fit: contain; }
.sambut h1 { color: var(--hijau); margin: 14px 0 2px; font-size: 26px; }
.sambut p { margin: 2px 0; color: var(--abu); }
.ayat { margin: 18px auto; max-width: 460px; background: var(--emas-muda); border: 1px dashed var(--emas); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: #5B4706; text-align: center; }

/* ---------- Beranda staf ---------- */
.salam { background: linear-gradient(135deg, var(--hijau), var(--hijau-2)); color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; position: relative; overflow: hidden; }
.salam::after { content: '✦'; position: absolute; right: 14px; top: 4px; font-size: 64px; color: var(--emas); opacity: .25; }
.salam b { font-size: 19px; }
.statistik { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: 14px; padding: 14px; border: 1px solid var(--garis); box-shadow: var(--bayang); }
.stat .angka { font-size: 26px; font-weight: 900; color: var(--hijau); }
.stat .ket { font-size: 13px; color: var(--abu); }
.stat.emas .angka { color: #9A7400; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 380px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }
.menu-item { background: #fff; border: 1px solid var(--garis); border-radius: 16px; padding: 14px 8px; text-align: center; cursor: pointer; box-shadow: var(--bayang); position: relative; text-decoration: none; color: var(--teks); }
.menu-item .ikon { font-size: 30px; display: block; margin-bottom: 4px; }
.menu-item b { font-size: 13.5px; }
.menu-item.nonaktif { opacity: .5; cursor: default; }
.menu-item .segera { position: absolute; top: 6px; right: 6px; font-size: 9.5px; background: var(--emas-muda); color: #7A5C00; padding: 1px 6px; border-radius: 99px; font-weight: 800; }
.bar-rak { margin: 8px 0; }
.bar-rak .atas { display: flex; justify-content: space-between; font-size: 14px; }
.bar { height: 8px; background: var(--hijau-muda); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--hijau-2), var(--emas)); border-radius: 99px; }

/* ---------- Input katalog ---------- */
.mode-rak { display: flex; gap: 10px; align-items: center; background: var(--emas-muda); border: 1px solid #EBD99A; border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.mode-rak select { flex: 1; }
.mode-rak .sesi { font-size: 13px; color: #6B5300; text-align: right; white-space: nowrap; }
#reader { width: 100%; border-radius: 14px; overflow: hidden; background: #000; min-height: 0; }
#reader video { border-radius: 14px; }
.atau { text-align: center; color: var(--abu); font-size: 13px; margin: 12px 0; position: relative; }
.atau::before, .atau::after { content: ''; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--garis); }
.atau::before { left: 0; } .atau::after { right: 0; }
.cari-isbn { display: flex; gap: 8px; }
.cari-isbn .input { flex: 1; letter-spacing: 1px; }
.info-sumber { background: var(--hijau-muda); color: var(--hijau); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.info-sumber.peringatan { background: var(--emas-muda); color: #6B5300; }
.sampul-kotak { display: flex; gap: 12px; align-items: center; }
.sampul-kotak img, .sampul-kosong { width: 84px; height: 116px; border-radius: 8px; object-fit: cover; background: var(--hijau-muda); border: 1px solid var(--garis); display: flex; align-items: center; justify-content: center; font-size: 30px; flex-shrink: 0; }
.nopanggil-pratinjau { display: inline-block; background: #fff; border: 2px solid var(--hijau); border-radius: 8px; padding: 6px 12px; font-weight: 900; font-family: 'Courier New', monospace; font-size: 18px; letter-spacing: 1px; }
.sukses { text-align: center; }
.sukses .centang { font-size: 54px; }
.daftar-no { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.daftar-no span { background: var(--hijau-muda); color: var(--hijau); border-radius: 8px; padding: 4px 10px; font-weight: 800; font-family: 'Courier New', monospace; }
.mirip { border: 1.5px dashed var(--emas); background: var(--emas-muda); border-radius: 12px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }

/* ---------- Daftar koleksi ---------- */
.saring { display: grid; grid-template-columns: 1fr 120px; gap: 8px; margin-bottom: 10px; }
.item-buku { display: flex; gap: 12px; background: #fff; border: 1px solid var(--garis); border-radius: 14px; padding: 10px; margin-bottom: 10px; cursor: pointer; box-shadow: var(--bayang); text-decoration: none; color: var(--teks); }
.item-buku img, .item-buku .sampul-kosong { width: 56px; height: 78px; font-size: 22px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.item-buku .teks { min-width: 0; flex: 1; }
.item-buku .teks b { display: block; font-size: 15.5px; line-height: 1.3; }
.item-buku .teks small { color: var(--abu); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-buku .meta { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kode { font-family: 'Courier New', monospace; font-weight: 800; font-size: 13px; }

/* ---------- Detail ---------- */
.detail-atas { display: flex; gap: 14px; }
.detail-atas img, .detail-atas .sampul-kosong { width: 100px; height: 140px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.tabel-info { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-top: 8px; }
.tabel-info td { padding: 6px 4px; border-bottom: 1px solid var(--garis); vertical-align: top; }
.tabel-info td:first-child { color: var(--abu); width: 38%; }
.eks-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--garis); }
.eks-item:last-child { border-bottom: 0; }

/* ---------- Login ---------- */
.kotak-login { max-width: 380px; margin: 30px auto; }
.pin-input { letter-spacing: 10px; text-align: center; font-size: 24px; font-weight: 900; }

/* ---------- Toast, modal, memuat ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: #1E2A24; color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 100; max-width: 90vw; transition: transform .25s; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-weight: 700; }
#toast.tampil { transform: translateX(-50%) translateY(0); }
#toast.galat { background: var(--merah); }
#toast.berhasil { background: var(--hijau); }
#memuat { position: fixed; inset: 0; background: rgba(255,252,244,.75); z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-weight: 800; color: var(--hijau); backdrop-filter: blur(2px); }
.putar { width: 46px; height: 46px; border: 5px solid var(--hijau-muda); border-top-color: var(--hijau); border-right-color: var(--emas); border-radius: 50%; animation: putar .8s linear infinite; }
@keyframes putar { to { transform: rotate(360deg); } }
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
#modal .panel { background: #fff; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px 24px; animation: naik .2s ease-out; }
@media (min-width: 600px) { #modal { align-items: center; } #modal .panel { border-radius: 20px; } }
@keyframes naik { from { transform: translateY(40px); opacity: .5; } }
#modal h3 { margin-top: 0; color: var(--hijau); }

.kaki { text-align: center; font-size: 12px; color: var(--abu); padding: 10px; }

/* ---------- Rak e-book ---------- */
.chip-baris { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0 10px; padding-bottom: 2px; }
.chip { border: 1.5px solid var(--hijau); background: #fff; color: var(--hijau); border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip.aktif { background: var(--hijau); color: #fff; }
.item-ebook { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--garis); border-radius: 14px; padding: 10px; margin-bottom: 10px; box-shadow: var(--bayang); }
.item-ebook img, .sampul-ebook { width: 56px; height: 74px; border-radius: 8px; flex-shrink: 0; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 28px; }
.item-ebook .teks { flex: 1; min-width: 0; }
.item-ebook .teks b { display: block; font-size: 15px; line-height: 1.3; }
.item-ebook .teks small { display: block; color: var(--abu); font-size: 12.5px; }
.item-ebook .teks .meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 2px; }
.item-ebook .lisensi { font-size: 11px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-ebook .tombol { flex-shrink: 0; }
