/* StreamHub Myanmar — shared design tokens & components (Portal, Admin, lock pages) */
:root {
  --bg: #0f0b14;
  --bg-2: #150f1b;
  --surface: #1c1524;
  --surface-2: #261d30;
  --line: #3a2f46;
  --text: #f6f0e6;
  --muted: #b8acc2;
  --gold: #e6b450;
  --gold-2: #f7d98c;
  --gold-ink: #2a1c05;
  --ok: #37c98b;
  --warn: #f5a524;
  --bad: #f0545a;
  --info: #5aa9f2;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Noto Sans Myanmar", "Padauk", "Myanmar Text", "Myanmar Sangam MN", "Pyidaungsu",
    system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(230, 180, 80, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(160, 60, 120, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  /* Burmese stacked vowels/medials need generous line-height to avoid clipping */
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--gold-2); }
h1, h2, h3 { line-height: 1.6; margin: 0 0 0.4em; font-weight: 700; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.6em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }
.container.wide { max-width: 1180px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
.grow { flex: 1 1 auto; }

/* ---------- card ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* ---------- brand header ---------- */
.brandbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; position: sticky; top: 0; z-index: 20;
  background: rgba(15, 11, 20, 0.85);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink); font-size: 18px;
}
.brand small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--muted); line-height: 1.3; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 0.95rem; line-height: 1.5; padding: 9px 14px; border-radius: var(--radius-sm);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; white-space: nowrap;
}
.btn:hover { border-color: #5a4a6a; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--gold-ink); border-color: transparent; font-weight: 700; }
.btn.danger { background: rgba(240, 84, 90, 0.12); border-color: rgba(240, 84, 90, 0.45); color: #ffb3b5; }
.btn.ok { background: rgba(55, 201, 139, 0.12); border-color: rgba(55, 201, 139, 0.45); color: #a6f0cf; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 0.84rem; border-radius: 8px; }
.btn.lg { padding: 14px 18px; font-size: 1.08rem; border-radius: 12px; }
.btn.block { width: 100%; }

/* ---------- forms ---------- */
label { display: block; font-size: 0.86rem; color: var(--muted); margin-bottom: 4px; }
.field + .field { margin-top: 12px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; line-height: 1.6; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230, 180, 80, 0.18); }
textarea { min-height: 72px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--gold); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span {
  display: grid; place-items: center; padding: 0 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted);
}
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; color: var(--text); font-size: 0.95rem; margin: 0; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 26px; background: var(--line); position: relative; cursor: pointer; flex: 0 0 auto; transition: background 0.2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked { background: var(--gold); }
.switch input:checked::after { transform: translateX(20px); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; line-height: 1.8; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: #9ff0cc; border-color: rgba(55, 201, 139, 0.45); background: rgba(55, 201, 139, 0.12); }
.badge.warn { color: #ffd591; border-color: rgba(245, 165, 36, 0.45); background: rgba(245, 165, 36, 0.12); }
.badge.bad { color: #ffb3b5; border-color: rgba(240, 84, 90, 0.45); background: rgba(240, 84, 90, 0.12); }
.badge.info { color: #b5d8ff; border-color: rgba(90, 169, 242, 0.45); background: rgba(90, 169, 242, 0.12); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

/* ---------- details / collapsible ---------- */
details.collapse { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
details.collapse + details.collapse { margin-top: 12px; }
details.collapse > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::after { content: "▾"; color: var(--muted); transition: transform 0.2s; }
details.collapse[open] > summary::after { transform: rotate(180deg); }
details.collapse > .collapse-body { padding: 0 16px 16px; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 0.92rem; animation: toast-in 0.25s ease both; text-align: center; }
.toast.ok { border-color: rgba(55, 201, 139, 0.6); }
.toast.bad { border-color: rgba(240, 84, 90, 0.6); }
.toast.out { animation: toast-out 0.25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 16px; background: rgba(5, 3, 8, 0.7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-box { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.modal-box.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 16px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---------- footer credit ---------- */
.site-footer { text-align: center; padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 0.85rem; }
.site-footer .credit-line { color: var(--gold-2); font-weight: 600; }

/* ---------- lock page (server-rendered for invalid /live links) ---------- */
.lock-page { display: grid; place-items: center; min-height: 100dvh; padding: 20px; }
.lock-card { max-width: 420px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px 22px; box-shadow: var(--shadow); }
.lock-card .lock-icon { font-size: 52px; line-height: 1.2; }
.lock-card .btn { margin-top: 10px; }
.lock-page .credit { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: var(--gold-2); font-size: 0.85rem; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center-screen { min-height: 70dvh; display: grid; place-items: center; }
