/* ============================================================
   PILIHAN TEMA - Melek Digital
   Empat tema warna yang bisa dipilih pengunjung. Pilihannya
   tersimpan di peramban, jadi tidak perlu memilih berulang kali.
   Tema baku: Warm Paper.
   ============================================================ */

/* ── 1. WARM PAPER (baku) - gading hangat ── */
[data-tema="warm-paper"] {
  --bg-dark: #181410;
  --bg-card: #251e17;
  --bg-panel: #201a14;
  --bg-input: #2b231a;
  --text: #e8e2d6;
  --text-muted: #9c9184;
  --border: #332a20;
  --accent: #b8860b;
  --accent-light: #e0b354;
  --gold-soft: rgba(184, 134, 11, 0.18);
  --green: #4cba85;
  --green-dark: #2e8b57;
  --red: #e0674f;
  --purple: #9b6fb0;
  --tombol-teks: #04231a;
}

/* ── 2. IVORY READ - baca terang ── */
[data-tema="ivory-read"] {
  --bg-dark: #faf7f0;
  --bg-card: #ffffff;
  --bg-panel: #f2eee4;
  --bg-input: #ffffff;
  --text: #2b2f36;
  --text-muted: #6b7280;
  --border: #dcd5c6;
  --accent: #9c6f00;
  --accent-light: #b8860b;
  --gold-soft: rgba(156, 111, 0, 0.16);
  --green: #2e8b57;
  --green-dark: #1f6b42;
  --red: #c0392b;
  --purple: #7d5a92;
  --tombol-teks: #ffffff;
}

/* ── 3. GREEN EARTH - hijau bumi ── */
[data-tema="green-earth"] {
  --bg-dark: #0d1512;
  --bg-card: #16201b;
  --bg-panel: #111a16;
  --bg-input: #1c2a23;
  --text: #dce5df;
  --text-muted: #8fa197;
  --border: #24352c;
  --accent: #e0b354;
  --accent-light: #f0cc7a;
  --gold-soft: rgba(224, 179, 84, 0.18);
  --green: #2e8b57;
  --green-dark: #237046;
  --red: #e0674f;
  --purple: #8fa8d4;
  --tombol-teks: #04231a;
}

/* ── 4. NAVY CIVIC - biru pemerintahan ── */
[data-tema="navy-civic"] {
  --bg-dark: #0d1119;
  --bg-card: #161d2c;
  --bg-panel: #121824;
  --bg-input: #1c2537;
  --text: #dfe4ee;
  --text-muted: #93a0b8;
  --border: #243047;
  --accent: #3b82f6;
  --accent-light: #93c5fd;
  --gold-soft: rgba(59, 130, 246, 0.18);
  --green: #4cba85;
  --green-dark: #1b4d8f;
  --red: #e0674f;
  --purple: #9b8fd4;
  --tombol-teks: #0d1119;
}

/* ── PENYESUAIAN TEMA TERANG (Ivory Read) ── */
[data-tema="ivory-read"] .hero-besar h1,
[data-tema="ivory-read"] .card h3,
[data-tema="ivory-read"] .section-title,
[data-tema="ivory-read"] .terpopuler h3,
[data-tema="ivory-read"] .card-data .angka,
[data-tema="ivory-read"] .pita-butir .angka {
  color: #1f2530;
}

[data-tema="ivory-read"] .hero-besar .badge { background: var(--green-dark); color: #fff; }
[data-tema="ivory-read"] nav { background: rgba(250, 247, 240, 0.96); }
[data-tema="ivory-read"] .nav-links a { color: #5a6270; }
[data-tema="ivory-read"] .logo { color: #1f2530; }
[data-tema="ivory-read"] .logo span { color: var(--green-dark); }
[data-tema="ivory-read"] .card:hover { border-color: #b9b1a0; }
[data-tema="ivory-read"] .card-data .keterangan { color: #6b7280; }
[data-tema="ivory-read"] .pita-label { color: #fff; }
[data-tema="ivory-read"] .iklan-tanda { color: #8a8272; }
[data-tema="ivory-read"] .populer-satu .nomor { color: rgba(156, 111, 0, 0.5); }
[data-tema="ivory-read"] .hamburger { color: #1f2530; }
[data-tema="ivory-read"] .btn-primary { color: #fff; }
[data-tema="ivory-read"] footer { background: #f2eee4; }

/* ── PEMILIH TEMA ── */
.pemilih-tema {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tombol-tema {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.tombol-tema:hover { border-color: var(--accent); }

.daftar-tema {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  min-width: 225px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 1200;
}

.daftar-tema.terbuka { display: block; }

.pilihan-tema {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.82rem;
}

.pilihan-tema:hover { background: var(--bg-panel); }

.pilihan-tema.aktif { background: var(--gold-soft); }

.pilihan-tema .contoh {
  display: flex;
  gap: 3px;
  flex: 0 0 auto;
}

.pilihan-tema .bulat {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.4);
}

.pilihan-tema .nama { font-weight: 600; }

.pilihan-tema .tanda-centang {
  margin-left: auto;
  color: var(--green);
  font-weight: 700;
  visibility: hidden;
}

.pilihan-tema.aktif .tanda-centang { visibility: visible; }

.judul-tema {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem 0.5rem;
}

@media (max-width: 768px) {
  .pemilih-tema { order: 2; }
  .tombol-tema { padding: 0.35rem 0.55rem; font-size: 0.72rem; }
  .tombol-tema .tulisan-tema { display: none; }
  .daftar-tema { right: -3rem; min-width: 210px; }
}

/* ── PERBAIKAN KONTRAS TEMA TERANG (Ivory Read) ── */
[data-tema="ivory-read"] {
  --text-muted: #5a5f68;   /* abu digelapkan agar teks kecil lolos ambang baca */
  --accent: #8a6100;        /* emas dipekatkan agar link terbaca di latar krem */
  --accent-light: #9c6f00;
  --green: #237046;         /* hijau dipekatkan */
  --red: #b03024;
}

/* Pita data di tema terang: beri latar lebih lembut dan angka lebih tegas */
[data-tema="ivory-read"] .pita-data { background: #ece6d8; }
[data-tema="ivory-read"] .pita-butir .nama { color: #4b5058; }
[data-tema="ivory-read"] .pita-butir .angka { color: #1f2530; }
[data-tema="ivory-read"] .pita-butir .naik { color: #1b6b45; }
[data-tema="ivory-read"] .pita-butir .turun { color: #a52a1e; }
[data-tema="ivory-read"] .pita-label { background: #9c6f00; color: #fff; }

/* Kartu data di tema terang */
[data-tema="ivory-read"] .card-data .keterangan { color: #545a63; }
[data-tema="ivory-read"] .card-data .tren.naik { color: #1b6b45; }
[data-tema="ivory-read"] .card-data .tren.turun { color: #a52a1e; }

/* Label kanal dan badge di tema terang */
[data-tema="ivory-read"] .badge-kanal { color: #1b6b45; font-weight: 700; }
[data-tema="ivory-read"] .badge-kanal.opini { color: #6b4a80; }
[data-tema="ivory-read"] .badge-kanal.analisis { color: #8a6100; }
[data-tema="ivory-read"] .meta-baris .kanal-tanda { color: #1b6b45; }

/* Tombol utama di tema terang */
[data-tema="ivory-read"] .nav-aksi a,
[data-tema="ivory-read"] .tombol-tema { color: #1f2530; }
[data-tema="ivory-read"] .putusan.hoaks { background: rgba(176,48,36,0.14); color: #a52a1e; }
[data-tema="ivory-read"] .putusan.fakta { background: rgba(27,107,69,0.13); color: #1b6b45; }
[data-tema="ivory-read"] .putusan.menyesatkan { background: rgba(176,48,36,0.12); color: #96500f; }
[data-tema="ivory-read"] .card-cekfakta .strip-putusan { background: #f2eee4; }

/* ── PENYEMPURNAAN TERAKHIR TEMA TERANG ── */
[data-tema="ivory-read"] .lihat-semua { color: #7a5500; font-weight: 700; }
[data-tema="ivory-read"] .lihat-semua:hover { color: #5c3f00; text-decoration: underline; }
[data-tema="ivory-read"] .terpopuler .kecil { color: #4f545c; font-size: 0.75rem; font-weight: 500; }
[data-tema="ivory-read"] .card-data .tren { font-weight: 700; }
[data-tema="ivory-read"] .card-data .keterangan { font-size: 0.82rem; font-weight: 500; }
[data-tema="ivory-read"] .populer-satu h4 { color: #262c36; }

/* Umum: link "Lihat semua" dipertegas sedikit di semua tema */
.section-title .lihat-semua { text-decoration: none; }
.section-title .lihat-semua:hover { text-decoration: underline; }

/* Teks kecil di panel Terpopuler dinaikkan ukurannya agar mudah dibaca */
.populer-satu .kecil { font-size: 0.75rem; }

/* ── PENYEMPURNAAN PEMILIH TEMA DI SELULER ── */
@media (max-width: 768px) {
  /* Tombol tema diperbesar agar mudah disentuh (ukuran sasaran jari) */
  .tombol-tema {
    padding: 0.55rem 0.7rem;
    min-height: 40px;
    min-width: 40px;
    font-size: 1rem;
    justify-content: center;
  }
  .tombol-tema .tanda-panah { font-size: 0.85rem; opacity: 0.75; }

  /* Jarak antarelemen panel disamakan */
  .nav-aksi { gap: 0.55rem !important; }

  /* Daftar tema: batasi tinggi & pastikan tidak menyentuh tepi */
  .daftar-tema {
    right: 0;
    max-height: 60vh;
    overflow-y: auto;
    min-width: 200px;
    max-width: calc(100vw - 1.5rem);
  }
}

/* Di layar sangat sempit, daftar tema tidak boleh melewati tepi layar */
@media (max-width: 380px) {
  .daftar-tema { right: -1.5rem; min-width: 190px; }
  .pilihan-tema { padding: 0.6rem 0.5rem; font-size: 0.8rem; }
  .pilihan-tema .bulat { width: 13px; height: 13px; }
}
