/* Producer portal UI-kit styles. Mobile-first phone shell. */
@import url("../../colors_and_type.css");
@import url("https://unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css");

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: #1B1B1F; font-family: var(--font-sans); height: 100%; }

/* ---------- Motion primitives ---------- */
:root {
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fade-up {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.scroll > * { animation: fade-up 360ms var(--ease-out-quint) both; flex-shrink: 0; }
.scroll > *:nth-child(1) { animation-delay: 0ms; }
.scroll > *:nth-child(2) { animation-delay: 40ms; }
.scroll > *:nth-child(3) { animation-delay: 80ms; }
.scroll > *:nth-child(4) { animation-delay: 120ms; }
.scroll > *:nth-child(5) { animation-delay: 160ms; }
.scroll > *:nth-child(6) { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) {
  .scroll > * { animation: none; }
}

/* Live dot — pulsing red for active broadcasts */
.live-dot {
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--thaihao-primary);
  display: inline-block; flex-shrink: 0;
}
.live-dot::after {
  content: ""; position: absolute; inset: 0;
  border-radius: 50%; background: var(--thaihao-primary);
  animation: pulse-ring 1.6s ease-out infinite;
}

/* Phone shell that sits on a dark stage */
.stage {
  min-height: 100vh;
  padding: 32px 0;
  display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; justify-content: center;
  background: linear-gradient(180deg, #1B1B1F 0%, #131316 100%);
}
.phone {
  width: 380px;
  height: 800px;
  background: var(--surface);
  border-radius: 36px;
  border: 8px solid #2A2A30;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.5);
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
}
.phone .status {
  height: 32px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface);
}
.phone .status .right { display: flex; gap: 6px; align-items: center; }
.phone .notch { position: absolute; left: 50%; top: 6px; width: 100px; height: 20px; background: #2A2A30; border-radius: 999px; transform: translateX(-50%); z-index: 5; }

.viewport {
  flex: 1; min-height: 0;
  background: var(--surface);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 14px;
  background: var(--surface);
  border-bottom: var(--border-thin) solid var(--outline-variant);
}
.topbar .brand-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; height: 32px;
  background: var(--surface-container-low);
  border-radius: var(--radius-full);
  font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface);
  cursor: pointer;
  min-width: 0;
  max-width: 60%;
  overflow: hidden;
}
.topbar .brand-chip > span:not(.bdot) {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.topbar .brand-chip .bdot { width: 22px; height: 22px; border-radius: 50%; background: var(--thaihao-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; font-family: var(--font-display); }
.topbar .brand-chip i { font-size: 14px; color: var(--on-surface-variant); }
.topbar .spacer { flex: 1; }
.topbar-action { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.topbar-action:hover { background: var(--surface-container-low); }
.topbar-action i { font-size: 20px; color: var(--on-surface); }
.flag { font-size: 18px; }

.scroll {
  flex: 1; overflow: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}

/* page title */
.page-title { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 500; color: var(--on-surface); margin: 0 0 4px; }
.page-sub { font-family: var(--font-sans); font-size: 13px; color: var(--on-surface-variant); }

/* Metric cards */
.metric-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric {
  background: var(--surface-container-lowest);
  border: var(--border-thin) solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex; flex-direction: column; gap: 5px;
  min-width: 0;
  position: relative; overflow: hidden;
  transition: transform 220ms var(--ease-out-quint), border-color 220ms var(--ease-out-quint), box-shadow 220ms var(--ease-out-quint);
}
.metric::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--thaihao-primary), transparent);
  opacity: 0; transition: opacity 220ms var(--ease-out-quint);
}
.metric:hover { transform: translateY(-2px); border-color: var(--outline); box-shadow: 0 8px 20px -8px rgba(0,0,0,0.10); }
.metric:hover::after { opacity: 1; }
.metric:active { transform: scale(0.99); }
.metric .lbl { font-family: var(--font-sans); font-size: 10px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); }
.metric .row-val { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.metric .val { font-family: var(--font-mono); font-size: 18px; line-height: 1.1; font-weight: 500; color: var(--on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric .iso { font-family: var(--font-mono); font-size: 10px; color: var(--on-surface-variant); flex-shrink: 0; }
.metric .trust { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; row-gap: 4px; }
.metric .audit-link { color: var(--thaihao-primary); font-size: 11px; font-family: var(--font-sans); display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.metric .audit-link i { font-size: 13px; }
.metric .foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: var(--font-sans); font-size: 11px; color: var(--on-surface-variant); }
.metric .up { color: var(--color-text-on-success); display: inline-flex; align-items: center; gap: 2px; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: var(--radius-full); font-family: var(--font-sans); font-size: 12px; font-weight: 500; border: var(--border-thin) solid; white-space: nowrap; }
.pill.success { background: var(--color-background-success); color: var(--color-text-on-success); border-color: var(--color-border-success); }
.pill.warning { background: var(--color-background-warning); color: var(--color-text-on-warning); border-color: var(--color-border-warning); }
.pill.danger { background: var(--color-background-danger); color: var(--color-text-on-danger); border-color: var(--color-border-danger); }
.pill.info { background: var(--color-background-info); color: var(--color-text-on-info); border-color: var(--color-border-info); }
.pill.primary { background: var(--thaihao-primary-tint); color: var(--thaihao-primary); border-color: var(--thaihao-primary); }
.pill.neutral { background: var(--surface-container-low); color: var(--on-surface-variant); border-color: var(--outline-variant); }
.pill.sm { height: 18px; padding: 0 7px; font-size: 11px; }

/* Alert banner */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--color-background-warning);
  border-radius: var(--radius-lg);
  border: var(--border-thin) solid var(--color-border-warning);
  color: var(--color-text-on-warning);
  position: relative; overflow: hidden;
}
.alert::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--color-text-on-warning), transparent, var(--color-text-on-warning));
  background-size: 100% 200%;
  animation: ec-shimmer 3s linear infinite;
}
.alert i { font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.alert .body { flex: 1; min-width: 0; }
.alert .title { font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface); }
.alert .sub { font-family: var(--font-sans); font-size: 12px; color: var(--color-text-on-warning); margin-top: 2px; line-height: 1.4; }

/* Section */
.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; align-items: baseline; gap: 8px; }
.section-head h2 { font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--on-surface); margin: 0; }
.section-head .more { margin-left: auto; color: var(--thaihao-primary); font-family: var(--font-sans); font-size: 12px; }

/* List card */
.list {
  background: var(--surface-container-lowest);
  border: var(--border-thin) solid var(--outline-variant);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.list-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 10px; padding: 12px 14px;
  border-bottom: var(--border-thin) solid var(--outline-variant);
  align-items: center;
  transition: background 150ms var(--ease-out-quint);
}
.list-row:active { background: var(--surface-container-low); }
.list-row:last-child { border-bottom: none; }
.list-row .ic { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-container-low); color: var(--on-surface); display: flex; align-items: center; justify-content: center; }
.list-row .ic i { font-size: 18px; }
.list-row .title { font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface); }
.list-row .sub { font-family: var(--font-sans); font-size: 12px; color: var(--on-surface-variant); }
.list-row .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.list-row .right .num { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--on-surface); white-space: nowrap; }

/* Quick links */
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick {
  background: var(--surface-container-lowest);
  border: var(--border-thin) solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  cursor: pointer;
  transition: transform 200ms var(--ease-out-quint), background 200ms var(--ease-out-quint);
}
.quick:active { transform: scale(0.96); background: var(--surface-container-low); }
.quick i { font-size: 20px; color: var(--thaihao-primary); }
.quick span { font-family: var(--font-sans); font-size: 11px; color: var(--on-surface); text-align: center; }

/* Pipeline */
.pipeline { display: flex; align-items: center; padding: 4px 0; }
.pipeline .step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pipeline .node { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-container); color: var(--on-surface-variant); display: flex; align-items: center; justify-content: center; font-family: var(--font-sans); font-size: 11px; font-weight: 500; border: 1px solid var(--outline-variant); flex-shrink: 0; }
.pipeline .node.done { background: var(--color-text-on-success); color: #fff; border-color: var(--color-text-on-success); }
.pipeline .node.active { background: var(--thaihao-primary); color: #fff; border-color: var(--thaihao-primary); }
.pipeline .seg { flex: 0 0 16px; height: 2px; background: var(--outline-variant); }
.pipeline .seg.done { background: var(--color-text-on-success); }
.pipeline .label { font-family: var(--font-sans); font-size: 10px; color: var(--on-surface-variant); text-align: center; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: clip; }
.pipeline .label.active { color: var(--thaihao-primary); font-weight: 500; }

/* Hero card for onboarding state */
.hero {
  background: var(--surface-container-lowest);
  border: var(--border-thin) solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  text-align: center;
}
.hero .ic-large { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.hero .ic-large i { font-size: 28px; }
.hero .ic-large.success { background: var(--color-background-success); color: var(--color-text-on-success); }
.hero .ic-large.warning { background: var(--color-background-warning); color: var(--color-text-on-warning); }
.hero .ic-large.danger { background: var(--color-background-danger); color: var(--color-text-on-danger); }
.hero h3 { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--on-surface); margin: 0; }
.hero p { font-family: var(--font-sans); font-size: 13px; color: var(--on-surface-variant); line-height: 1.5; margin: 0; }

/* Waterfall (settlement) */
.waterfall { display: flex; flex-direction: column; gap: 0; }
.waterfall .step {
  display: grid; grid-template-columns: 24px 1fr auto;
  gap: 10px; padding: 10px 0;
  border-bottom: var(--border-thin) solid var(--outline-variant);
  align-items: center;
}
.waterfall .step:last-child { border-bottom: none; }
.waterfall .node { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; }
.waterfall .node.done { background: var(--color-background-success); color: var(--color-text-on-success); }
.waterfall .node.now { background: var(--thaihao-primary); color: #fff; }
.waterfall .node.next { background: var(--surface-container); color: var(--on-surface-variant); }
.waterfall .label { font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--on-surface); }
.waterfall .sub { font-family: var(--font-sans); font-size: 11px; color: var(--on-surface-variant); }
.waterfall .num { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--on-surface); }

/* Bottom tab nav */
.bottombar {
  height: 64px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface-container-lowest);
  border-top: var(--border-thin) solid var(--outline-variant);
  padding-bottom: 4px;
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--on-surface-variant); cursor: pointer; transition: color 160ms var(--ease-out-quint), transform 160ms var(--ease-out-quint); }
.tab:active { transform: scale(0.94); }
.tab i { font-size: 22px; }
.tab span { font-family: var(--font-sans); font-size: 10px; }
.tab.active { color: var(--thaihao-primary); }

/* Bottom sheet */
.sheet-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,0.40); z-index: 8;
  opacity: 0; pointer-events: none; transition: opacity var(--motion-default);
}
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 9;
  background: var(--surface-container-lowest);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  transform: translateY(100%);
  transition: transform var(--motion-slow);
  padding: 18px 16px 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.sheet.open { transform: translateY(0); }
.sheet .handle { width: 36px; height: 4px; border-radius: 2px; background: var(--outline-variant); margin: -6px auto 8px; }
.sheet h3 { font-family: var(--font-sans); font-size: 15px; font-weight: 500; margin: 0; }

/* Brand option row */
.brand-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
}
.brand-row:hover { background: var(--surface-container-low); }
.brand-row.active { background: var(--thaihao-primary-tint); position: relative; }
.brand-row.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; background: var(--thaihao-primary); border-radius: 0 2px 2px 0; }
.brand-row .bdot { width: 36px; height: 36px; border-radius: 50%; background: var(--thaihao-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; font-family: var(--font-display); }
.brand-row .bname { font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--on-surface); }
.brand-row .bsub { font-family: var(--font-sans); font-size: 12px; color: var(--on-surface-variant); }
.brand-row .check i { font-size: 18px; color: var(--thaihao-primary); }
.brand-row.active .bdot { background: var(--thaihao-primary); }

/* Buttons (mobile-sized — 44px target) */
.btn-primary {
  height: 44px; padding: 0 16px;
  background: var(--gradient-primary); color: #fff;
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 4px 12px -4px rgba(172, 0, 34, 0.35);
  transition: transform 180ms var(--ease-out-quint), box-shadow 180ms var(--ease-out-quint);
}
.btn-primary:active { background: var(--thaihao-primary-pressed); transform: translateY(1px); box-shadow: 0 2px 6px -2px rgba(172, 0, 34, 0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(172, 0, 34, 0.45); }
.btn-secondary {
  height: 44px; padding: 0 16px;
  background: var(--surface-container-lowest); color: var(--on-surface);
  border-radius: var(--radius);
  border: var(--border-default) solid var(--outline-variant);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500;
  cursor: pointer;
}

/* Stage label */
.stage-label {
  font-family: var(--font-sans); font-size: 12px; font-weight: 500;
  color: rgba(255,255,255,0.7); text-align: center; margin-bottom: 8px; letter-spacing: 0.05em; text-transform: uppercase;
}
.phone-wrap { display: flex; flex-direction: column; align-items: center; }
.kit-header { width: 100%; text-align: center; padding-top: 6px; }
.kit-header h1 { color: #fff; font-family: var(--font-display); font-weight: 500; font-size: 18px; margin: 0; }
.kit-header p { color: rgba(255,255,255,0.5); font-family: var(--font-sans); font-size: 12px; margin: 4px 0 16px; }
