/* BadaiWiFi Live — gaya halaman web live.
   Warna mengikuti AppColors aplikasi (primary #198BF6, secondary #06B6D4). */

:root {
  --primary: #198BF6;
  --secondary: #06B6D4;
  --accent: #8B5CF6;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --live: #EF4444;

  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-2: #64748B;
  --shadow: 0 2px 8px rgba(15, 23, 42, .06);
  --stage: #0B1220;
  --input: #FFFFFF;

  --r-card: 16px;
  --r-btn: 14px;
  --r-chip: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Poppins', var(--font);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220;
    --surface: #111A2E;
    --card: #15203A;
    --border: #26324D;
    --text: #F1F5F9;
    --text-2: #94A3B8;
    --shadow: none;
    --input: #0F1830;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --surface: #111A2E; --card: #15203A; --border: #26324D;
  --text: #F1F5F9; --text-2: #94A3B8; --shadow: none; --input: #0F1830;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
button { font: inherit; }
[hidden] { display: none !important; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 32px; height: 32px; object-fit: contain; }
.brand-text { font: 600 17px/1 var(--font-head); letter-spacing: -.01em; }
.brand-text b {
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-name { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.app { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px; }
.foot {
  display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center;
  padding: 18px 16px 24px; color: var(--text-2); font-size: 12px; text-align: center;
}

.boot { display: grid; place-items: center; min-height: 50vh; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tombol & input ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border: 0; border-radius: var(--r-btn);
  font-weight: 600; font-size: 15px; cursor: pointer; color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: transform .08s ease, opacity .15s ease, filter .15s ease;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; filter: none; transform: none; }
.btn-block { width: 100%; }
.btn-live { background: linear-gradient(90deg, #DC2626, var(--live)); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-link { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 6px; font-weight: 500; }

.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-btn);
  border: 1px solid var(--border); background: var(--input); color: var(--text);
  font: 500 16px var(--font); outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.input-otp { letter-spacing: .5em; text-align: center; font: 600 24px var(--font-head); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.err { color: var(--error); font-size: 13px; min-height: 18px; margin: 4px 0 10px; }

/* ── Login ─────────────────────────────────────────────────────────── */
.auth { max-width: 420px; margin: 4vh auto 0; padding: 28px 24px; }
.auth h1 { font: 700 24px/1.25 var(--font-head); margin: 0 0 6px; }
.auth p { margin: 0 0 22px; color: var(--text-2); }
.auth .ts { min-height: 70px; margin: 4px 0 8px; display: flex; justify-content: center; }
.auth .row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.auth-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.auth-badge { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }

/* ── Daftar siaran ─────────────────────────────────────────────────── */
.page-title { font: 700 22px/1.3 var(--font-head); margin: 4px 0 4px; }
.page-sub { color: var(--text-2); margin: 0 0 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.scard { overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; transition: transform .12s ease, border-color .12s ease; }
.scard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.scard-poster { aspect-ratio: 16 / 9; background: var(--stage) center / cover no-repeat; position: relative; }
.scard-poster .badge { position: absolute; top: 10px; left: 10px; }
.scard-body { padding: 14px 16px 16px; }
.scard-title { font: 600 16px/1.35 var(--font-head); margin: 0 0 4px; }
.scard-meta { color: var(--text-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.scard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.price { font: 700 16px var(--font-head); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff;
  background: rgba(15, 23, 42, .75);
}
.badge-live { background: var(--live); }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }
.badge-free { background: var(--success); }
.badge-paid { background: var(--primary); }
.badge-soon { background: var(--warning); }
.badge-app { background: #475569; }
@keyframes pulse { 50% { opacity: .35; } }

.empty { text-align: center; padding: 48px 16px; color: var(--text-2); }
.empty h2 { font: 600 18px var(--font-head); color: var(--text); margin: 12px 0 6px; }

/* ── Halaman nonton ────────────────────────────────────────────────── */
.watch { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .watch { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .side { position: sticky; top: 72px; height: calc(100vh - 92px); }
  .side.chat-off { height: auto; }
}
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-size: 13px; margin-bottom: 10px; }

.stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: var(--stage); border-radius: var(--r-card); overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: contain; }
.stage.pseudo-fs {
  position: fixed; inset: 0; z-index: 100; border-radius: 0; aspect-ratio: auto; height: 100dvh;
}
.stage:fullscreen { border-radius: 0; }
.stage:fullscreen video { object-fit: contain; }

/* Lapisan layar status (countdown, paywall, dst) di atas video. */
.overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; text-align: center; color: #F1F5F9;
  background: radial-gradient(120% 90% at 50% 0%, rgba(25, 139, 246, .28), rgba(11, 18, 32, .96) 60%);
}
.overlay h2 { font: 700 clamp(17px, 2.6vw, 24px)/1.3 var(--font-head); margin: 0; }
.overlay p { margin: 0; color: #CBD5E1; max-width: 460px; font-size: clamp(12px, 1.7vw, 14px); }
.overlay .big { font: 700 clamp(28px, 6vw, 52px)/1 var(--font-head); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.overlay .icon { font-size: clamp(28px, 5vw, 44px); line-height: 1; }
.overlay .actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.overlay .btn-ghost { color: #F1F5F9; border-color: rgba(255, 255, 255, .25); }

/* Kontrol pemutar */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 6px; padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7));
  transition: opacity .2s ease;
}
.stage.idle .controls { opacity: 0; pointer-events: none; }
.stage.idle { cursor: none; }
.cbtn {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer;
}
.cbtn:hover { background: rgba(255, 255, 255, .18); }
.cbtn svg { width: 22px; height: 22px; fill: currentColor; }
.ctl-live { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .05em; margin-left: 4px; }
.ctl-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.2s infinite; }
.spacer { flex: 1; }
.qbtn { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; }
.qmenu {
  position: absolute; right: 12px; bottom: 58px; z-index: 6; min-width: 150px;
  background: rgba(15, 23, 42, .96); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 6px;
}
.qmenu button {
  display: flex; width: 100%; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 0; border-radius: 8px;
  background: none; color: #E2E8F0; cursor: pointer; font-size: 13px; text-align: left;
}
.qmenu button:hover { background: rgba(255, 255, 255, .08); }
.qmenu button[aria-checked="true"] { color: #fff; font-weight: 700; }
.qmenu button[aria-checked="true"]::after { content: "✓"; }
.tap-sound {
  position: absolute; top: 12px; left: 12px; z-index: 4; border: 0; border-radius: 20px; padding: 7px 12px;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}
.reconnect {
  position: absolute; top: 12px; right: 12px; z-index: 4; padding: 6px 10px; border-radius: 20px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px;
}

/* Info di bawah video */
.info { padding: 14px 16px; margin-top: 12px; }
.info-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.info h1 { font: 600 18px/1.35 var(--font-head); margin: 6px 0 2px; }
.viewers { color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* Vote */
.vote { padding: 16px; margin-top: 12px; }
.vote h3, .side h3 { font: 600 15px var(--font-head); margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.vote .sub { color: var(--text-2); font-size: 12px; margin-bottom: 12px; }
.vrow {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; overflow: hidden;
  padding: 10px 12px; margin-bottom: 8px; border-radius: var(--r-chip); cursor: pointer; text-align: left;
  border: 1px solid var(--border); background: var(--input); color: var(--text);
}
.vrow:disabled { cursor: default; }
.vrow .bar { position: absolute; inset: 0 auto 0 0; opacity: .14; transition: width .5s ease; }
.vrow.home .bar { background: var(--primary); }
.vrow.away .bar { background: var(--error); }
.vrow.mine { border-color: var(--primary); }
.vrow.away.mine { border-color: var(--error); }
.vrow img { width: 30px; height: 30px; object-fit: contain; border-radius: 6px; position: relative; }
.vrow .nm { flex: 1; font-weight: 600; position: relative; }
.vrow .pct { font: 700 15px var(--font-head); position: relative; }
.vrow .cnt { color: var(--text-2); font-size: 11px; position: relative; min-width: 60px; text-align: right; }
.vfoot { color: var(--text-2); font-size: 12px; }

/* Chat */
.side { display: flex; flex-direction: column; overflow: hidden; }
.side-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; padding: 10px 14px; min-height: 220px; max-height: 50vh; }
@media (min-width: 960px) { .chat-list { max-height: none; } }
.msg { margin: 0 0 8px; word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.45; }
.msg .who { font-weight: 700; margin-right: 6px; }
.msg.admin .who { color: var(--accent); }
.msg.react { display: flex; align-items: center; gap: 6px; }
.msg.react img { width: 22px; height: 22px; object-fit: contain; }
.chat-empty { color: var(--text-2); text-align: center; padding: 24px 8px; font-size: 13px; }
.reacts { display: flex; gap: 6px; padding: 8px 12px 0; flex-wrap: wrap; }
.react-btn {
  border: 1px solid var(--border); background: var(--input); border-radius: 20px; height: 34px; min-width: 38px;
  padding: 0 8px; cursor: pointer; font-size: 17px; display: grid; place-items: center; color: var(--text);
}
.react-btn img { width: 22px; height: 22px; object-fit: contain; }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; }
.chat-form .input { min-height: 42px; font-size: 14px; }
.chat-form .btn { min-height: 42px; padding: 0 16px; }
.chat-note { padding: 10px 14px 14px; color: var(--text-2); font-size: 12px; text-align: center; }

/* Sheet pembayaran */
.sheet-bg { position: fixed; inset: 0; z-index: 200; background: rgba(2, 6, 23, .6); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } }
.sheet {
  width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto;
  background: var(--surface); color: var(--text); border-radius: 20px 20px 0 0; padding: 22px 20px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .sheet { border-radius: 20px; } }
.sheet h2 { font: 600 18px var(--font-head); margin: 0 0 4px; }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.x { border: 0; background: var(--bg); color: var(--text); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.methods { display: grid; gap: 8px; margin: 12px 0; }
.method {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-chip); background: var(--input); cursor: pointer; color: var(--text); text-align: left;
}
.method[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.method:disabled { opacity: .5; cursor: default; }
.method .m-name { font-weight: 600; }
.method .m-note { color: var(--text-2); font-size: 12px; }
.total { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px dashed var(--border); margin-top: 6px; }
.total b { font: 700 18px var(--font-head); }
.qr-box { background: #fff; padding: 14px; border-radius: 14px; width: min(280px, 100%); margin: 8px auto; }
.qr-box img { display: block; width: 100%; image-rendering: pixelated; }
.va-box { text-align: center; padding: 16px; border: 1px dashed var(--border); border-radius: 14px; margin: 8px 0; }
.va-num { font: 700 24px var(--font-head); letter-spacing: .06em; word-break: break-all; }
.pay-status { text-align: center; color: var(--text-2); font-size: 13px; margin: 10px 0; display: flex; justify-content: center; align-items: center; gap: 8px; }
.pay-status .spinner { width: 16px; height: 16px; border-width: 2px; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 300; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px;
  background: #0F172A; color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.is-err { background: #B91C1C; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
