/* =====================================================================
   upswap theme: the ONE place for colors, fonts and shared components.
   Every page on the platform (home, sign-in, studio, operator, search admin, shop, watch) loads this
   first; page stylesheets only lay things out and use the variables and classes defined here.
   Change a color, a font or a component here and it changes everywhere. No hex colors elsewhere.

   Personality: "live and listening". upswap does two things, and the look comes from them:
     LIVE SHOPPING     a show is on right now: coral, a pulsing dot, viewers, reactions floating up.
     REAL-TIME SEARCH  an assistant that listens and answers as you type: violet, typing dots,
                       the steps it takes appearing one by one, ticks on what matches.
   It should feel like a friendly conversation, not a form: rounded shapes, chat bubbles, people's
   initials, short plain words. The pieces, and when to use them:
     .kicker      section label    names a section, with a small dot (.kicker-live: pulsing coral). 1-4 words.
     .on-air      LIVE pill        anything live right now (a show, the host's timer).
     .viewers     viewer count     "214 watching", next to a LIVE pill.
     .reactions   floating hearts  over a live video or preview.
     .chat-bubble chat bubble      .chat-me (the shopper) and .chat-ai (the assistant); .chat-face beside
                                   (a person's initial; .chat-face-ai for the assistant).
     .typing-dots typing dots      the assistant is working on an answer.
     .agent-steps agent steps      what the assistant did, step by step ("Searched 1,020 products").
     .tag         match chip       one product fact or match ("Waterproof", "Under $150"); .tag-match, .tag-price.
     .highlight   marker swipe     the one phrase in a headline that matters.
     .badge       status pill      statuses in the studio (scheduled, ended, problem).
   Personality lives in these visuals, not in extra words: keep copy short and plain.
   Pages shown inside a retailer's website (shop, watch, the search chat) add class "neutral" on <body>:
   same components, quieter colors and the system font, so they sit well on any store.
   ===================================================================== */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/static/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  /* surfaces and text */
  --bg: #fbfaf8;              /* page: soft warm white */
  --surface: #ffffff;         /* cards and panels */
  --surface-muted: #f4f2ee;   /* quiet areas, table heads */
  --text: #16131d;
  --text-muted: #625d6b;
  --text-subtle: #9a95a3;
  --border: #e9e6e1;
  --border-strong: #d6d2cb;
  --ink-line: #d6d2cb;        /* outlines on buttons, dialogs and switches */

  /* the two features */
  --primary: #5b3df5;         /* real-time search: the assistant's violet */
  --primary-hover: #4a2fdb;
  --primary-soft: #efebff;
  --accent: #ff3b5c;          /* live shopping: coral */
  --accent-soft: #ffe8ec;
  --tape: #ffc53d;            /* sunshine: highlights and things that need a look */
  --tape-ink: #8a5a00;

  /* states */
  --success: #0e8a5f;
  --success-soft: #e3f6ee;
  --danger: #d92d20;
  --danger-hover: #b42318;
  --danger-soft: #fdecea;
  --warning: #b25e00;
  --warning-soft: #fff4dc;
  --info: #1e6fd9;
  --info-soft: #e7f0fd;
  --live: #ff3b5c;
  --live-hover: #e3264a;
  --live-soft: #ffe8ec;
  --on-color: #ffffff;        /* text on filled buttons and badges */
  --overlay: rgba(22, 19, 29, .55);
  --focus: rgba(91, 61, 245, .3);
  /* soft outlines for tinted boxes (a "-soft" background with a "-line" border) */
  --primary-line: #d6ccff;
  --success-line: #b3e5cf;
  --warning-line: #f6d89a;
  --danger-line: #f6c2bd;
  --live-line: #ffc2cd;

  /* night: the live studio, video stages, code blocks, tooltips and dark bars */
  --video-bg: #0b0a12;
  --night-bg: #100e18;
  --night-bar: #15121f;
  --night-panel: #1b1828;
  --night-menu: #211d31;
  --night-raised: #26213a;
  --night-raised-2: #2c2742;
  --night-hover: #362f52;
  --night-deep: #0c0a15;
  --night-glow: #3a2a8f;
  --night-strong: #ffffff;
  --night-text: #f1effa;
  --night-soft: #d4cfe6;
  --night-muted: #aaa3c2;
  --night-placeholder: #958eae;
  --night-faint: #6b6485;
  --night-accent: #b3a4ff;
  --night-accent-strong: #7a5cff;
  --night-accent-text: #d2c8ff;
  --night-accent-pale: #e7e1ff;
  --night-ok: #34d399;
  --night-ok-pale: #6ee7b7;
  --night-warn: #fbbf24;
  --night-warn-text: #fde68a;
  --night-warn-pale: #fef3c7;
  --night-warn-ink: #1f1300;
  --night-live: #ff4d6d;
  --night-live-pale: #ffc9d3;
  --night-away: #7c2d12;

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Bricolage Grotesque", var(--font);   /* friendly display face for headings and the brand */
  --font-read: var(--font);
  --font-hand: var(--font-head);
  --font-receipt: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --receipt: var(--surface);

  /* shape */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(22, 19, 29, .06);
  --shadow: 0 1px 3px rgba(22, 19, 29, .07), 0 4px 12px -6px rgba(22, 19, 29, .08);
  --shadow-lg: 0 24px 48px -16px rgba(22, 19, 29, .25);
  --shadow-print: 0 6px 16px -6px rgba(91, 61, 245, .45);   /* the glow under main buttons */
  --tilt: 0deg;
}

/* Inside a retailer's website: same components, quieter. */
body.neutral {
  --bg: #ffffff;
  --surface-muted: #f6f6f7;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ink-line: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --font-head: var(--font);
  --shadow-print: var(--shadow-sm);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--font-head); letter-spacing: -.02em; }
h1 { font-size: 26px; font-weight: 750; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.35; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.icon { width: 18px; height: 18px; flex: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font: inherit; font-size: 14px; font-weight: 650; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-color); box-shadow: var(--shadow-print); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-muted); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--on-color); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-success { background: var(--success); color: var(--on-color); }
.btn-live { background: var(--live); color: var(--on-color); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--live) 60%, transparent); }
.btn-live:hover { background: var(--live-hover); transform: translateY(-1px); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy .icon { visibility: hidden; }
.btn.is-busy::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .7); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after { border-color: var(--text-subtle); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-muted); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: 14px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
input:disabled, select:disabled { background: var(--surface-muted); cursor: not-allowed; }
.form-error { color: var(--danger); font-size: 13px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.card-header p { margin-top: 2px; font-size: 13px; color: var(--text-muted); }

/* ---------- badges = status pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--surface-muted); color: var(--text-muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge .icon { width: 14px; height: 14px; }
.badge-live { background: var(--live); color: var(--on-color); font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.badge-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--on-color); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.badge-scheduled, .badge-ai { background: var(--primary-soft); color: var(--primary-hover); }
.badge-ended { background: var(--surface-muted); color: var(--text-muted); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-solid { background: var(--accent); color: var(--on-color); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--surface-muted); color: var(--text-muted); font-size: 12px; font-weight: 650; text-align: left; }
.table td { padding: 12px 22px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- dialogs ---------- */
dialog, .modal-box { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }

/* ---------- personality: live and listening (see the header for what each piece means) ---------- */

/* Section label with a small dot; .kicker-live makes the dot a pulsing live light. */
.kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 5px 12px 5px 10px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); color: var(--text-muted); font: 650 13px/1.2 var(--font); box-shadow: var(--shadow-sm); }
.kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.kicker-live::before { background: var(--live); box-shadow: 0 0 0 3px var(--live-soft); animation: pulse 1.6s ease-in-out infinite; }
body.neutral .kicker { padding: 0; border: 0; background: none; box-shadow: none; }

/* LIVE pill. */
.on-air { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--live); color: var(--on-color); font: 750 11.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.on-air:not(:has(.on-air-dot))::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--on-color); animation: pulse 1.4s ease-in-out infinite; }
.viewers { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Floating reactions: <div class="reactions"><span>❤️</span><span>🔥</span>…</div> over a video. */
.reactions { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 140px; pointer-events: none; }
.reactions > span { position: absolute; bottom: 0; left: 50%; font-size: 20px; opacity: 0; animation: float-up 3.6s ease-out infinite; }
.reactions > span:nth-child(2) { animation-delay: 1.2s; margin-left: -14px; }
.reactions > span:nth-child(3) { animation-delay: 2.4s; margin-left: 6px; }
.reactions > span:nth-child(4) { animation-delay: .6s; margin-left: -4px; }
@keyframes float-up { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(-50%, -130px) scale(1.1); opacity: 0; } }

/* Chat bubbles and faces (named chat-* so they don't clash with the studio's own .bubble and .avatar). */
.chat-bubble { max-width: 86%; padding: 9px 13px; border-radius: 18px; font-size: 14px; line-height: 1.4; }
.chat-me { margin-left: auto; border-bottom-right-radius: 6px; background: var(--primary); color: var(--on-color); }
.chat-ai { border-bottom-left-radius: 6px; background: var(--surface-muted); color: var(--text); }
.chat-face { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--tape); color: var(--text); font-size: 12px; font-weight: 750; }
.chat-face-ai { background: var(--primary); color: var(--on-color); }

/* Typing dots: the assistant is working. */
.typing-dots { display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--surface-muted); }
.typing-dots > span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-subtle); animation: typing 1.2s ease-in-out infinite; }
.typing-dots > span:nth-child(2) { animation-delay: .15s; }
.typing-dots > span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Agent steps: <ol class="agent-steps"><li class="is-done">Searched 1,020 products</li>…</ol>. */
.agent-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.agent-steps > li { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--primary-soft); color: var(--primary-hover); font-size: 12.5px; font-weight: 600; }
.agent-steps > li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.agent-steps > li.is-done { background: var(--success-soft); color: var(--success); }

/* Match chip: one product fact or match. */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--surface-muted); color: var(--text); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tag-match { background: var(--success-soft); color: var(--success); }
.tag-match::before { content: "✓"; font-weight: 800; }
.tag-price { background: var(--text); color: var(--on-color); font-weight: 750; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Marker swipe behind the one phrase in a headline that matters. */
.highlight { padding: 0 .08em; background: linear-gradient(transparent 58%, color-mix(in srgb, var(--tape) 75%, transparent) 58%, color-mix(in srgb, var(--tape) 75%, transparent) 92%, transparent 92%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* gradient text for the brand moment: search violet into live coral */
.spark-text { background: linear-gradient(90deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (prefers-reduced-motion: reduce) {
  .badge-live::before, .on-air::before, .kicker-live::before, .typing-dots > span { animation: none; }
  .reactions { display: none; }
}
