/* Shared light/dark styles.
   - Toggle button (.theme-toggle): shows a moon in light mode, a sun in dark.
   - Light-mode colours for the standalone pages (login, akun, lupa password,
     reset, verifikasi, status pembayaran, offline), which are dark by default.
   Loaded after each page's own <style>, so these win. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid var(--toggle-line, rgba(11,18,32,.1));
  background: var(--toggle-bg, rgba(255,255,255,.7));
  color: var(--toggle-fg, #0A1428);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:active { transform: scale(.94); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle { --toggle-line: rgba(255,255,255,.14); --toggle-bg: rgba(19,28,46,.85); --toggle-fg: #FFD166; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Standalone pages: fixed top-right toggle */
.theme-toggle.fixed-corner {
  position: fixed; z-index: 10;
  top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px;
}

html[data-theme="light"] {
  --bg: #F2F4F8;
  --card: #FFFFFF;
  --border: #DFE4EE;
  --text: #0A1428;
  --muted: #5A6379;
  --input-bg: #F7F9FD;
  --pill-bg: rgba(255,255,255,.85);
}
html[data-theme="light"] .card { box-shadow: 0 10px 30px rgba(10,20,40,.08); }
html[data-theme="light"] .order-amount { color: #C26A00; }

/* Logo that follows the theme */
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: block; }

/* Loading screen (page load / moving to another page), driven by theme.js.
   Drawn with pseudo-elements on <html> so it shows before <body> exists. */
html.jdd-loading::before,
html.jdd-loading::after {
  position: fixed; z-index: 2147483646; opacity: 1;
  transition: opacity .3s ease; pointer-events: auto;
}
html.jdd-loading::before {
  content: ""; inset: 0;
  background:
    url("/icons/logo.webp") center calc(50% - 34px) / 150px auto no-repeat,
    radial-gradient(circle at 50% 45%, #FFFFFF 0%, #EEF2F8 75%);
}
html.jdd-loading::after {
  content: "MEMUAT";
  left: 50%; top: calc(50% + 46px); transform: translateX(-50%);
  width: 180px; padding-top: 22px; text-align: center;
  font: 600 11px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .4em; text-indent: .4em; color: #7C8AA6;
  background:
    linear-gradient(90deg, #1E6FE0, #4DA3FF) no-repeat -60px 0 / 60px 4px,
    linear-gradient(rgba(11, 18, 32, .08), rgba(11, 18, 32, .08)) no-repeat 0 0 / 100% 4px;
  animation: jddLoadBar 1.1s ease-in-out infinite;
}
html[data-theme="dark"].jdd-loading::before {
  background:
    url("/icons/logo-dark.webp") center calc(50% - 34px) / 150px auto no-repeat,
    radial-gradient(circle at 50% 45%, #13233D 0%, #070E1C 75%);
}
html[data-theme="dark"].jdd-loading::after {
  color: #5F6E88;
  background:
    linear-gradient(90deg, #1E6FE0, #4DA3FF) no-repeat -60px 0 / 60px 4px,
    linear-gradient(rgba(255, 255, 255, .08), rgba(255, 255, 255, .08)) no-repeat 0 0 / 100% 4px;
}
html.jdd-loading.jdd-hide::before,
html.jdd-loading.jdd-hide::after { opacity: 0; pointer-events: none; }
@keyframes jddLoadBar {
  0%   { background-position: -60px 0, 0 0; }
  100% { background-position: 180px 0, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  html.jdd-loading::after { animation: none; background-position: 60px 0, 0 0; }
}

/* Bottom navigation on standalone pages (Riwayat, Akun) - same look as the
   store's nav. Active tab = blue pill. */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 430px; box-sizing: border-box; z-index: 50;
  display: flex; gap: 4px; padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--nav-bg, rgba(255,255,255,.95)); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  font-family: 'Space Grotesk', system-ui, sans-serif;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 6px; border-radius: 14px; text-decoration: none;
  font-size: 10.5px; font-weight: 700; color: var(--nav-fg, #8B93A5);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a.active {
  color: #fff; background: linear-gradient(135deg, #1565D8, #2F86F6);
  box-shadow: 0 6px 16px rgba(21,101,216,.35);
}
.bottom-nav a:active { transform: scale(.96); }
html:not([data-theme="light"]) .bottom-nav { --nav-bg: rgba(12,20,36,.95); --nav-fg: #7C8AA6; }

/* ===== Laptop / desktop (>= 1024px): the bottom navigation becomes a
   sidebar on the left - store (#jdd-nav) and Riwayat/Akun (.bottom-nav).
   The store's nav is styled inline by its app runtime, hence !important. */
.jdd-side-brand, .jdd-side-foot { display: none; }
@media (min-width: 1024px) {
  .bottom-nav, #jdd-nav {
    left: 0 !important; top: 0 !important; bottom: 0 !important; transform: none !important;
    width: 256px !important; max-width: none !important; display: flex !important;
    flex-direction: column !important; justify-content: flex-start !important; gap: 4px !important;
    padding: 22px 14px 18px !important; border-top: 0 !important;
    border-right: 1px solid var(--line, var(--border)) !important; overflow-y: auto;
  }
  .bottom-nav > a, #jdd-nav > a, #jdd-nav > div:not(.jdd-side-brand):not(.jdd-side-foot) {
    flex: none !important; flex-direction: row !important; justify-content: flex-start !important;
    gap: 12px !important; padding: 11px 14px !important; font-size: 14px !important; border-radius: 12px !important;
  }
  .bottom-nav > a:not(.active):hover, #jdd-nav > a:hover, #jdd-nav > div:not(.jdd-side-brand):not(.jdd-side-foot):hover { background: rgba(127,140,170,.12); }
  .bottom-nav > a:active, #jdd-nav > *:active { transform: none; }
  .jdd-side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; margin-bottom: 10px; border-bottom: 1px solid var(--line, var(--border)); }
  .jdd-side-brand img { height: 38px; width: auto; }
  .jdd-side-brand span { font-size: 8.5px; font-weight: 700; letter-spacing: 1.2px; line-height: 1.45; color: var(--muted, #8B93A5); padding-left: 10px; border-left: 1px solid var(--line, var(--border)); }
  .jdd-side-foot { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line, var(--border)); }
  .jdd-side-foot a, .jdd-side-foot button { flex: none; flex-direction: row; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--nav-fg, var(--muted-2, #8B93A5)); font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; text-align: left; }
  .jdd-side-foot a:hover, .jdd-side-foot button:hover { background: rgba(127,140,170,.12); color: var(--text); }
  .jdd-side-foot .icon-sun { display: none; }
  html[data-theme="dark"] .jdd-side-foot .icon-sun { display: block; }
  html[data-theme="dark"] .jdd-side-foot .icon-moon { display: none; }

  /* Riwayat / Akun: content next to the sidebar, a bit wider */
  body:has(.bottom-nav) { padding-left: calc(256px + 40px) !important; padding-right: 40px !important; padding-bottom: 48px !important; }
  body:has(.bottom-nav) .wrap { max-width: 720px; }
  body:has(.bottom-nav) .theme-toggle.fixed-corner { display: none; }
}

/* jddConfirm / jddAlert dialog (theme.js) */
.jdd-dialog { width: min(92vw, 380px); border: 0; border-radius: 18px; padding: 22px 20px 18px; background: #fff; color: #0A1428; box-shadow: 0 24px 60px rgba(10,20,40,.28); font-family: inherit; }
.jdd-dialog::backdrop { background: rgba(10,20,40,.45); backdrop-filter: blur(2px); }
.jdd-dialog h2 { margin: 0 0 8px; font-size: 17px; letter-spacing: -.2px; }
.jdd-dialog p { margin: 0; font-size: 14px; line-height: 1.55; color: #4A546A; white-space: pre-line; }
.jdd-dialog-actions { display: flex; gap: 10px; margin-top: 20px; }
.jdd-dialog-actions button { flex: 1; height: 44px; border-radius: 12px; font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.jdd-dialog-cancel { background: #F3F5FB; color: #0A1428; border: 1px solid #DFE4EE; }
.jdd-dialog-ok { background: linear-gradient(135deg, #1565D8, #2F86F6); color: #fff; border: 0; }
.jdd-dialog-ok.danger { background: #E5484D; }
.jdd-dialog button:focus-visible { outline: 3px solid rgba(47,134,246,.45); outline-offset: 2px; }
html[data-theme="dark"] .jdd-dialog { background: #131C2E; color: #E7ECF5; box-shadow: 0 24px 60px rgba(0,0,0,.55); }
html[data-theme="dark"] .jdd-dialog p { color: #9AA6BC; }
html[data-theme="dark"] .jdd-dialog-cancel { background: #0E1626; color: #E7ECF5; border-color: #263248; }
