/* ==========================================================================
   MTs Al-Amin Tabanan - Stylesheet Utama
   Tema: Hijau Emerald Islami, Emas Elegan, Putih Bersih
   ========================================================================== */

:root {
  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-900: #064e3b;
  --gold-300: #fcd34d;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --gold-600: #d97706;
  --gold-700: #b45309;

  --bg-body: #ffffff;
  --bg-soft: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-soft: #475569;
  --border-c: #e2e8f0;
  --shadow-c: 0 4px 24px -8px rgba(4, 120, 87, .18);
  --radius: 16px;
}

html.dark {
  --bg-body: #0b1220;
  --bg-soft: #111c2e;
  --bg-card: #16233a;
  --text-main: #e6edf6;
  --text-soft: #a3b3c9;
  --border-c: #24354f;
  --shadow-c: 0 4px 24px -8px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  line-height: 1.65;
  transition: background .3s ease, color .3s ease;
  overflow-x: hidden;
}

body[dir="rtl"] { font-family: 'Amiri', 'Traditional Arabic', serif; }

h1, h2, h3, h4, h5 {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  margin: 0 0 .5rem;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Layout helpers ---------- */
.container-x { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 1rem; }
.section-pad { padding: 4.5rem 0; }
.text-soft { color: var(--text-soft); }

/* ---------- Pola Islami ---------- */
.islamic-pattern {
  background-color: var(--emerald-900);
  background-image:
    radial-gradient(circle at 25px 25px, rgba(251,191,36,.10) 2px, transparent 3px),
    radial-gradient(circle at 75px 75px, rgba(255,255,255,.06) 2px, transparent 3px),
    linear-gradient(135deg, transparent 46%, rgba(251,191,36,.06) 47%, rgba(251,191,36,.06) 53%, transparent 54%);
  background-size: 100px 100px, 100px 100px, 40px 40px;
}
.pattern-soft {
  background-image:
    linear-gradient(135deg, transparent 46%, rgba(4,120,87,.05) 47%, rgba(4,120,87,.05) 53%, transparent 54%),
    linear-gradient(45deg, transparent 46%, rgba(180,83,9,.04) 47%, rgba(180,83,9,.04) 53%, transparent 54%);
  background-size: 34px 34px;
}

/* ---------- Text gradient emas ---------- */
.text-gold-gradient {
  background: linear-gradient(90deg, #fde68a, #fbbf24 45%, #f59e0b 70%, #fde68a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-emerald-gradient {
  background: linear-gradient(90deg, var(--emerald-700), var(--emerald-500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Header / Navbar ---------- */
.site-header {
  position: sticky; top: 0; z-index: 200;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg-body) 88%, transparent);
  border-bottom: 1px solid var(--border-c);
  transition: box-shadow .3s;
}
.site-header.scrolled { box-shadow: 0 6px 24px -12px rgba(0,0,0,.28); }

.topbar {
  background: linear-gradient(90deg, var(--emerald-900), var(--emerald-700) 60%, var(--emerald-800));
  color: #d1fae5; font-size: .8rem;
}
.topbar a:hover { color: var(--gold-300); }

.nav-link {
  position: relative; padding: .55rem .8rem; border-radius: 10px;
  font-weight: 600; font-size: .92rem; color: var(--text-main);
  transition: color .2s, background .2s;
  display: inline-flex; align-items: center; gap: .35rem;
}
.nav-link:hover, .nav-link.active { color: var(--emerald-700); background: var(--emerald-50); }
html.dark .nav-link:hover, html.dark .nav-link.active { color: var(--gold-400); background: rgba(255,255,255,.06); }

.dropdown-panel {
  position: absolute; top: 100%; inset-inline-start: 0; min-width: 250px;
  background: var(--bg-card); border: 1px solid var(--border-c);
  border-radius: 14px; box-shadow: var(--shadow-c); padding: .5rem;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all .22s ease; z-index: 300;
}
.has-dropdown:hover .dropdown-panel,
.has-dropdown:focus-within .dropdown-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem; border-radius: 10px; font-size: .88rem; color: var(--text-soft);
  transition: background .18s, color .18s;
}
.dropdown-item:hover { background: var(--emerald-50); color: var(--emerald-700); }
html.dark .dropdown-item:hover { background: rgba(255,255,255,.07); color: var(--gold-400); }

/* Mobile drawer */
#mobile-nav {
  position: fixed; inset: 0 0 0 auto; width: min(88vw, 360px); z-index: 400;
  background: var(--bg-card); border-inline-start: 1px solid var(--border-c);
  transform: translateX(110%); transition: transform .32s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; padding: 1rem; box-shadow: -12px 0 40px -18px rgba(0,0,0,.4);
}
#mobile-nav.open { transform: translateX(0); }
#nav-overlay {
  position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 390;
  opacity: 0; visibility: hidden; transition: opacity .3s;
}
#nav-overlay.open { opacity: 1; visibility: visible; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .78rem 1.5rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  border: 1px solid transparent; cursor: pointer; transition: all .25s ease; text-align: center;
}
.btn-primary {
  background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500));
  color: #fff; box-shadow: 0 8px 22px -10px rgba(5,150,105,.85);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -12px rgba(5,150,105,.95); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  color: #3b2606; box-shadow: 0 8px 22px -10px rgba(245,158,11,.85);
}
.btn-gold:hover { transform: translateY(-2px); }
/* Varian outline untuk permukaan terang (kartu, panel) */
.btn-outline { border-color: var(--emerald-600); color: var(--emerald-700); background: transparent; }
.btn-outline:hover { background: var(--emerald-600); border-color: var(--emerald-600); color: #fff; transform: translateY(-2px); }
html.dark .btn-outline { border-color: rgba(110,231,183,.5); color: #6ee7b7; }
html.dark .btn-outline:hover { background: var(--emerald-600); border-color: var(--emerald-600); color: #fff; }
/* Varian outline untuk permukaan gelap (hero, seksi berpola islami) */
.btn-outline-light { border-color: rgba(255,255,255,.5); color: #fff; background: rgba(255,255,255,.08); backdrop-filter: blur(6px); }
.btn-outline-light:hover { background: rgba(255,255,255,.2); color: #fff; transform: translateY(-2px); }
.btn-ghost { border-color: var(--border-c); color: var(--text-main); background: var(--bg-card); }
.btn-ghost:hover { border-color: var(--emerald-500); color: var(--emerald-700); }
.btn-sm { padding: .45rem 1rem; font-size: .82rem; }

/* ---------- Kartu ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--border-c);
  border-radius: var(--radius); box-shadow: var(--shadow-c);
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s;
  overflow: hidden;
}
.card-hover:hover { transform: translateY(-6px); border-color: var(--emerald-500); box-shadow: 0 18px 40px -18px rgba(4,120,87,.4); }

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .22rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: var(--emerald-50); color: var(--emerald-700);
}
html.dark .badge { background: rgba(16,185,129,.16); color: #6ee7b7; }
.badge-gold { background: #fef3c7; color: var(--gold-700); }
html.dark .badge-gold { background: rgba(245,158,11,.18); color: var(--gold-300); }

/* ---------- Judul seksi ---------- */
.section-title { font-size: clamp(1.6rem, 3.6vw, 2.4rem); }
.section-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--emerald-600);
}
.divider-gold {
  width: 88px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--gold-500), var(--emerald-500));
  margin: .85rem 0 1.35rem;
}
.center .divider-gold { margin-inline: auto; }

/* ---------- Hero slider ---------- */
.hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease, transform 7s linear;
  background-size: cover; background-position: center; transform: scale(1.05);
}
.hero-slide.active { opacity: 1; transform: scale(1.14); }

/* ---------- Animasi ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }

@keyframes floaty { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-14px);} }
.animate-floaty { animation: floaty 6s ease-in-out infinite; }

@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border-c) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px;
}

@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.55);} 70% { box-shadow: 0 0 0 16px rgba(16,185,129,0);} 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0);} }
.pulse-ring { animation: pulse-ring 2.4s infinite; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-c); }
table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--bg-card); }
table.data-table thead th {
  background: var(--emerald-700); color: #fff; text-align: start;
  padding: .8rem .9rem; font-weight: 700; white-space: nowrap; font-size: .82rem;
}
table.data-table tbody td { padding: .72rem .9rem; border-top: 1px solid var(--border-c); color: var(--text-soft); }
table.data-table tbody tr:hover { background: var(--bg-soft); }

/* ---------- Form ---------- */
.form-label { display: block; font-size: .82rem; font-weight: 700; margin-bottom: .35rem; color: var(--text-main); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .7rem .9rem; border-radius: 12px;
  border: 1px solid var(--border-c); background: var(--bg-card); color: var(--text-main);
  font-size: .9rem; font-family: inherit; transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--emerald-500); box-shadow: 0 0 0 3px rgba(16,185,129,.18);
}
.form-hint { font-size: .74rem; color: var(--text-soft); margin-top: .25rem; }

/* ---------- Tab ---------- */
.tab-btn {
  padding: .6rem 1.15rem; border-radius: 999px; font-weight: 700; font-size: .86rem;
  border: 1px solid var(--border-c); background: var(--bg-card); color: var(--text-soft); cursor: pointer;
  transition: all .22s;
}
.tab-btn:hover { border-color: var(--emerald-500); color: var(--emerald-700); }
.tab-btn.active { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500)); color: #fff; border-color: transparent; }

/* ---------- Floating widget ---------- */
.fab-stack { position: fixed; inset-inline-end: 1.1rem; bottom: 1.1rem; z-index: 350; display: flex; flex-direction: column; gap: .7rem; align-items: flex-end; }
.fab {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 1.25rem; border: none; cursor: pointer;
  box-shadow: 0 10px 26px -10px rgba(0,0,0,.5); transition: transform .25s;
}
.fab:hover { transform: scale(1.08); }
.fab-wa { background: #25d366; }
.fab-ai { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500)); }
.fab-chat { background: linear-gradient(135deg, var(--gold-600), var(--gold-400)); color: #3b2606; }

.chat-panel {
  position: fixed; inset-inline-end: 1.1rem; bottom: 5.4rem; z-index: 360;
  width: min(92vw, 390px); height: min(70vh, 560px);
  background: var(--bg-card); border: 1px solid var(--border-c); border-radius: 20px;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.5); display: none; flex-direction: column; overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.chat-bubble { max-width: 84%; padding: .65rem .9rem; border-radius: 16px; font-size: .86rem; line-height: 1.55; }
.chat-bubble.bot { background: var(--bg-soft); color: var(--text-main); align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-bubble.me { background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500)); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }

/* ---------- CBT ---------- */
.cbt-fullscreen { user-select: none; }
.q-nav-btn {
  width: 42px; height: 42px; border-radius: 10px; font-weight: 700; font-size: .84rem;
  border: 1px solid var(--border-c); background: var(--bg-card); color: var(--text-soft); cursor: pointer;
  transition: all .18s;
}
.q-nav-btn.answered { background: var(--emerald-600); color: #fff; border-color: transparent; }
.q-nav-btn.current { outline: 3px solid var(--gold-400); outline-offset: 1px; }
.q-nav-btn.flagged { background: var(--gold-500); color: #3b2606; border-color: transparent; }

.opt-item {
  display: flex; gap: .75rem; align-items: flex-start; padding: .8rem 1rem;
  border: 2px solid var(--border-c); border-radius: 14px; cursor: pointer; transition: all .18s;
  background: var(--bg-card);
}
.opt-item:hover { border-color: var(--emerald-500); background: var(--emerald-50); }
html.dark .opt-item:hover { background: rgba(16,185,129,.1); }
.opt-item.selected { border-color: var(--emerald-600); background: var(--emerald-50); font-weight: 600; }
html.dark .opt-item.selected { background: rgba(16,185,129,.18); }

/* ---------- Admin sidebar ---------- */
.admin-side-link {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .85rem; border-radius: 11px;
  font-size: .87rem; font-weight: 600; color: rgba(255,255,255,.78); transition: all .2s; cursor: pointer;
}
.admin-side-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-side-link.active { background: linear-gradient(90deg, rgba(251,191,36,.25), transparent); color: var(--gold-300); border-inline-start: 3px solid var(--gold-400); }

/* ---------- Stat counter ---------- */
.stat-num { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 900; line-height: 1; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-inline-start: 2rem; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--emerald-500), var(--gold-400)); }
.timeline-item { position: relative; padding-bottom: 1.6rem; }
.timeline-item::before {
  content: ''; position: absolute; inset-inline-start: -2rem; top: 5px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg-card); border: 3px solid var(--emerald-600);
}

/* ---------- Utility ---------- */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.glass { background: rgba(255,255,255,.1); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.2); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--emerald-600); border-radius: 10px; border: 2px solid var(--bg-soft); }
::-webkit-scrollbar-thumb:hover { background: var(--emerald-700); }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .fab-stack, .no-print, #mobile-nav, #nav-overlay { display: none !important; }
  body { background: #fff; color: #000; }
  .print-area { box-shadow: none !important; border: 1px solid #999 !important; }
}

/* ---------- Responsif ---------- */
@media (max-width: 768px) {
  .section-pad { padding: 3rem 0; }
  .timeline { padding-inline-start: 1.6rem; }
}
