/* ==========================================================================
   Bimxyz — ui-upgrade.css
   Lapisan polish di atas theme.css. Tidak mengubah struktur HTML existing.
   Urutan load: theme.css → ui-upgrade.css (file ini) → CSS inline halaman.

   Prinsip:
   - Menghormati token tema (--primary #4C7DFF) — bukan rebranding.
   - Memperbaiki: skala tipografi, ritme vertikal, kedalaman kartu,
     tap target ≥44px, fokus keyboard, dan language switch.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Token tambahan
   -------------------------------------------------------------------------- */
:root {
  --u-primary: #4C7DFF;
  --u-primary-hi: #6B93FF;
  --u-primary-dim: rgba(76, 125, 255, 0.14);
  --u-primary-glow: rgba(76, 125, 255, 0.28);

  --u-bg: #0a0a0a;
  --u-surface: #121212;
  --u-surface-2: #171717;
  --u-surface-3: #1c1c1e;

  --u-line: rgba(255, 255, 255, 0.08);
  --u-line-strong: rgba(255, 255, 255, 0.14);

  --u-ink: #f0f0f0;
  --u-ink-2: #a0a8b5;
  --u-ink-3: #8b93a1;

  --u-ok: #3ddc97;
  --u-warn: #f5a623;
  --u-danger: #ff5c5c;

  --u-r-sm: 10px;
  --u-r: 14px;
  --u-r-lg: 18px;
  --u-r-xl: 24px;

  --u-ease: cubic-bezier(0.22, 0.68, 0.24, 1);
  --u-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --u-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.7);
  --u-shadow-lg: 0 24px 56px -32px rgba(0, 0, 0, 0.9);

  --u-max: 1180px;
}

/* --------------------------------------------------------------------------
   2. Dasar: tipografi & ritme
   -------------------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

::selection {
  background: var(--u-primary);
  color: #fff;
}

/* Fokus keyboard yang konsisten & terlihat */
:focus-visible {
  outline: 2px solid var(--u-primary-hi);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Scrollbar halus (Chromium/WebKit) */
@media (min-width: 769px) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: #0a0a0a; }
  ::-webkit-scrollbar-thumb {
    background: #2a2a2e;
    border-radius: 99px;
    border: 3px solid #0a0a0a;
  }
  ::-webkit-scrollbar-thumb:hover { background: #3a3a40; }
}

/* Judul: line-height & wrapping lebih rapi */
h1, h2, h3, h4 {
  text-wrap: balance;
}
p, li {
  text-wrap: pretty;
}

/* Paragraf panjang: batasi lebar baca */
.subtitle,
.hero p,
.section-head p,
.faq-a,
.footer-desc {
  max-width: 68ch;
}

/* --------------------------------------------------------------------------
   3. Navbar
   -------------------------------------------------------------------------- */
.navbar {
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--u-ease), background 0.3s var(--u-ease),
    box-shadow 0.3s var(--u-ease);
}

/* kelas .scrolled ditambahkan oleh ui-upgrade.js */
.navbar.scrolled {
  border-bottom-color: var(--u-line);
  box-shadow: 0 8px 28px -20px rgba(0, 0, 0, 0.9);
}

.nav-logo img {
  transition: transform 0.25s var(--u-ease);
}
.nav-logo:hover img {
  transform: scale(1.05);
}

/* Nav link: indikator aktif lebih tegas */
@media (min-width: 769px) {
  .nav-links a {
    position: relative;
    font-weight: 500;
    transition: background 0.2s var(--u-ease), color 0.2s var(--u-ease);
  }
  /* Link aktif sudah punya pill background dari theme.css.
     Garis bawah tambahan membuat tepi pill terlihat "dobel",
     jadi indikator dipindah ke titik kecil di bawah label. */
  .nav-links a.active {
    font-weight: 600;
  }
  .nav-links a.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 14px;
    height: 2px;
    transform: translateX(-50%);
    border-radius: 2px;
    background: var(--u-primary-hi);
    opacity: 0.85;
  }
}

/* --------------------------------------------------------------------------
   4. Language switch
   -------------------------------------------------------------------------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin-left: 10px;
  border: 1px solid var(--u-line-strong);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  flex: none;
}

.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--u-ink-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  min-width: 32px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s var(--u-ease), color 0.18s var(--u-ease);
}

.lang-switch button:hover {
  color: var(--u-ink);
  background: rgba(255, 255, 255, 0.06);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--u-primary);
  color: #fff;
  box-shadow: 0 2px 10px -4px var(--u-primary-glow);
}

.lang-globe {
  width: 14px;
  height: 14px;
  margin: 0 4px 0 5px;
  color: var(--u-ink-3);
  opacity: 0.75;
  flex: none;
}

/* di mobile: tetap terlihat, sedikit lebih besar untuk tap */
@media (max-width: 768px) {
  .lang-switch {
    margin-left: auto;
    margin-right: 12px;
    padding: 3px;
  }
  .lang-switch button {
    min-width: 40px;
    min-height: 36px;
    font-size: 12px;
    padding: 0 10px;
  }
  .lang-globe {
    margin: 0 3px 0 5px;
  }
  /* panel menu mobile: penuh, jangan tembus pandang */
  .nav-links.active {
    background: #121212 !important;
  }
}

/* Halaman tanpa navbar: switcher mengambang di kanan atas */
.lang-switch-floating {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 90;
  margin: 0;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 22px -14px rgba(0, 0, 0, 0.9);
}

/* --------------------------------------------------------------------------
   5. Tombol: target tap & affordance
   -------------------------------------------------------------------------- */
.btn-primary,
.btn-secondary,
.buy-btn,
button.btn,
a.btn {
  min-height: 44px;
  transition: transform 0.16s var(--u-ease), box-shadow 0.2s var(--u-ease),
    background 0.2s var(--u-ease), border-color 0.2s var(--u-ease);
}

.btn-primary:hover,
.buy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px -14px var(--u-primary-glow);
}

.btn-primary:active,
.btn-secondary:active,
.buy-btn:active {
  transform: translateY(0) scale(0.99);
}

.btn-secondary:hover {
  border-color: var(--u-line-strong);
  background: rgba(255, 255, 255, 0.04);
}

/* link inline di footer & body: target tap minimal */
.footer-links a,
.footer-bottom a,
a.inline-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

/* --------------------------------------------------------------------------
   6. Kartu: kedalaman & hover
   -------------------------------------------------------------------------- */
.feature-card,
.testi-card,
.benefit-card,
.tos-card,
.produk-card,
.paket-card {
  transition: transform 0.22s var(--u-ease), border-color 0.22s var(--u-ease),
    box-shadow 0.22s var(--u-ease), background 0.22s var(--u-ease);
  will-change: transform;
}

.feature-card:hover,
.testi-card:hover,
.benefit-card:hover,
.produk-card:hover {
  transform: translateY(-3px);
  border-color: var(--u-line-strong);
  box-shadow: var(--u-shadow);
}

/* Icon container: gradient halus + glow */
.feature-icon {
  background: linear-gradient(145deg, rgba(76, 125, 255, 0.18), rgba(76, 125, 255, 0.06));
  border: 1px solid rgba(76, 125, 255, 0.22);
  transition: transform 0.25s var(--u-ease), box-shadow 0.25s var(--u-ease);
}

.feature-card:hover .feature-icon {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 22px -12px var(--u-primary-glow);
}

/* Badge / eyebrow */
.section-eyebrow,
.hero-badge {
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   7. Hero: kedalaman latar & angka statistik
   -------------------------------------------------------------------------- */
section.hero {
  position: relative;
  isolation: isolate;
}

section.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(720px 420px at 78% -10%, rgba(76, 125, 255, 0.13), transparent 62%),
    radial-gradient(560px 380px at 8% 4%, rgba(76, 125, 255, 0.06), transparent 66%);
}

.hero-stats .stat-value,
.hero-stat strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.hero-stats .stat-label,
.hero-stat span {
  color: var(--u-ink-3);
}

/* Rapikan jarak hero → section berikutnya.
   Sebelumnya hero padding-bottom 70px + section padding-top 70px
   menyisakan ~160px ruang kosong yang terasa menggantung. */
@media (min-width: 769px) {
  section.hero {
    padding-bottom: 46px;
  }
  section.hero + section.section {
    padding-top: 58px;
  }
}

/* Stat pertama adalah tautan status — beri affordance yang jelas
   tanpa membuatnya terlihat berbeda dari dua stat lainnya. */
.hero-stat-link {
  border-radius: var(--u-r-sm);
  transition: transform 0.2s var(--u-ease);
}
.hero-stat-link:hover {
  transform: translateY(-2px);
}
.hero-stat-link:focus-visible {
  outline: 2px solid var(--u-primary-hi);
  outline-offset: 4px;
}

/* Baris statistik: kolom seimbang, bukan flex-center yang pincang
   saat salah satu label lebih panjang. */
@media (min-width: 769px) {
  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    justify-content: stretch;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }
  .hero-stats > * {
    min-width: 0;
  }
  .hero-stat,
  .hero-stats > * {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .hero-stat span,
  .hero-stats .stat-label {
    display: block;
    font-size: 0.82rem;
    line-height: 1.4;
    text-wrap: balance;
  }
}

/* --------------------------------------------------------------------------
   8. Form: konsistensi & keadaan fokus
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
  transition: border-color 0.18s var(--u-ease), box-shadow 0.18s var(--u-ease),
    background 0.18s var(--u-ease);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--u-primary) !important;
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.16);
  outline: none;
}

/* pesan error / hint */
.email-hint {
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   9. Tabel & daftar legal
   -------------------------------------------------------------------------- */
.tos-list li,
.tos-card p,
.tos-card li {
  line-height: 1.72;
}

.tos-num {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   9b. Empty / error state
   -------------------------------------------------------------------------- */
.u-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 56px 24px;
  border: 1px dashed var(--u-line-strong);
  border-radius: var(--u-r-lg);
  background: rgba(255, 255, 255, 0.015);
}

.u-empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--u-ink-3);
  opacity: 0.8;
}

.u-empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--u-ink);
  margin: 0;
}

.u-empty-state p {
  font-size: 0.9rem;
  color: var(--u-ink-3);
  max-width: 44ch;
  line-height: 1.6;
  margin: 0;
}

.u-retry-btn {
  margin-top: 6px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--u-r-sm);
  border: 0;
  background: var(--u-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s var(--u-ease), transform 0.16s var(--u-ease);
}

.u-retry-btn:hover {
  background: var(--u-primary-hi);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--u-line);
}

.footer-social a {
  transition: transform 0.2s var(--u-ease), background 0.2s var(--u-ease),
    color 0.2s var(--u-ease);
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-social a:hover {
  transform: translateY(-2px);
}

.footer-links a {
  transition: color 0.18s var(--u-ease), transform 0.18s var(--u-ease);
}

.footer-links a:hover {
  color: var(--u-primary-hi);
}

/* --------------------------------------------------------------------------
   11. Halaman checkout (order/pay/perpanjang) — modal & stepper
   -------------------------------------------------------------------------- */
.qris-card {
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.95);
}

.checkout-step.active .step-num {
  box-shadow: 0 0 0 4px rgba(76, 125, 255, 0.16);
}

/* Tombol utama checkout */
.buy-btn {
  box-shadow: 0 8px 22px -14px var(--u-primary-glow);
}

/* --------------------------------------------------------------------------
   12. Animasi masuk halus (dihormati reduced-motion)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .u-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s var(--u-ease), transform 0.6s var(--u-ease);
  }
  .u-reveal.u-in {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   13. Cetak
   -------------------------------------------------------------------------- */
@media print {
  .navbar, .site-footer, .lang-switch, .mobile-menu-btn { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}

/* --------------------------------------------------------------------------
   14. Perbaikan responsif kecil
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .lang-switch { margin-right: 6px; }
  .footer-social a { min-width: 44px; min-height: 44px; }
}

/* Pastikan tidak ada overflow horizontal dari elemen dekoratif */
section.hero::before,
.u-glow {
  max-width: 100vw;
}
