/* ============================================================
   Bid Wars — Design Tokens
   Red / white theme, Geist typeface. Imported from design handoff.
   ============================================================ */

:root {
  /* Brand — red */
  --red-50:  oklch(0.975 0.015 25);
  --red-100: oklch(0.945 0.040 25);
  --red-200: oklch(0.890 0.080 25);
  --red-300: oklch(0.820 0.130 25);
  --red-400: oklch(0.720 0.180 25);
  --red-500: oklch(0.625 0.215 25);  /* primary */
  --red-600: oklch(0.560 0.220 25);
  --red-700: oklch(0.475 0.195 25);
  --red-800: oklch(0.395 0.165 25);
  --red-900: oklch(0.310 0.130 25);

  /* Neutrals — warm-leaning */
  --ink-0:   #ffffff;
  --ink-50:  oklch(0.985 0.003 50);
  --ink-100: oklch(0.965 0.005 50);
  --ink-150: oklch(0.945 0.006 50);
  --ink-200: oklch(0.920 0.008 50);
  --ink-300: oklch(0.870 0.010 50);
  --ink-400: oklch(0.720 0.012 50);
  --ink-500: oklch(0.560 0.012 50);
  --ink-600: oklch(0.430 0.012 50);
  --ink-700: oklch(0.310 0.010 50);
  --ink-800: oklch(0.220 0.008 50);
  --ink-900: oklch(0.150 0.006 50);
  --ink-950: oklch(0.090 0.005 50);

  /* Status */
  --ok:      oklch(0.62 0.16 145);
  --ok-bg:   oklch(0.96 0.04 145);
  --warn:    oklch(0.72 0.16 80);
  --warn-bg: oklch(0.965 0.05 80);
  --info:    oklch(0.62 0.14 240);
  --info-bg: oklch(0.965 0.035 240);
  --err:     oklch(0.58 0.21 25);
  --err-bg:  oklch(0.965 0.04 25);
  --queue:   oklch(0.55 0.18 295);
  --queue-bg:oklch(0.965 0.04 295);

  /* Semantic — light mode defaults */
  --bg:        var(--ink-50);
  --surface:   var(--ink-0);
  --surface-2: var(--ink-100);
  --border:    var(--ink-200);
  --border-strong: var(--ink-300);
  --text:      var(--ink-900);
  --text-mute: var(--ink-600);
  --text-dim:  var(--ink-500);
  --primary:   var(--red-500);
  --primary-press: var(--red-600);
  --primary-soft:  var(--red-50);
  --on-primary: #fff;

  /* Legacy alias kept for older templates */
  --c-primary-50:  var(--red-50);
  --c-primary-100: var(--red-100);
  --c-primary-200: var(--red-200);
  --c-primary-300: var(--red-300);
  --c-primary-400: var(--red-400);
  --c-primary-500: var(--red-500);
  --c-primary-600: var(--red-600);
  --c-primary-700: var(--red-700);
  --c-primary-800: var(--red-800);
  --c-primary-900: var(--red-900);

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 20px;
  --r-5: 28px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(20, 14, 14, 0.04), 0 0 0 1px rgba(20, 14, 14, 0.04);
  --shadow-2: 0 4px 14px rgba(20, 14, 14, 0.06), 0 0 0 1px rgba(20, 14, 14, 0.04);
  --shadow-3: 0 14px 44px rgba(20, 14, 14, 0.14), 0 0 0 1px rgba(20, 14, 14, 0.05);
  --shadow-red: 0 6px 18px rgba(225, 29, 46, 0.28);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in:  cubic-bezier(0.55, 0, 0.7, 0.2);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-1: 140ms;
  --dur-2: 240ms;
  --dur-3: 360ms;
}

/* Creator mode — same red family with a touch warmer */
[data-mode="creator"] {
  --primary: oklch(0.625 0.215 18);
  --primary-press: oklch(0.560 0.220 18);
  --primary-soft: oklch(0.97 0.02 25);
}

/* Dark mode — swap surfaces, keep red primary readable */
.dark {
  --bg:        var(--ink-950);
  --surface:   var(--ink-900);
  --surface-2: var(--ink-800);
  --border:    var(--ink-800);
  --border-strong: var(--ink-700);
  --text:      var(--ink-50);
  --text-mute: var(--ink-300);
  --text-dim:  var(--ink-400);
  --primary-soft: oklch(0.30 0.12 25);
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-2: 0 4px 14px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-3: 0 14px 44px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
button, input, textarea, select { font-family: inherit; color: inherit; }

a, button, input, select, textarea {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Mono for numbers */
.num, .mono, .numeric, .money {
  font-family: var(--font-mono);
  font-feature-settings: "tnum", "zero";
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Buttons (semantic — used alongside Tailwind utilities)
   ============================================================ */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--r-pill);
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--dur-1) var(--ease-out),
              background var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-red);
}
.btn--primary:hover { background: var(--primary-press); }
.btn--ghost { background: var(--surface-2); color: var(--text); }
.btn--ghost:hover { background: var(--ink-150); }
.dark .btn--ghost:hover { background: var(--ink-700); }
.btn--outline {
  background: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}
.btn--danger { background: var(--err); color: white; }
.btn--block { width: 100%; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--xs { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn--square { border-radius: 8px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-4);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-pad { padding: 16px; }

/* ============================================================
   Inputs
   ============================================================ */
.input {
  appearance: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-3);
  padding: 12px 14px;
  font-size: 14.5px;
  width: 100%;
  outline: none;
  transition: border-color var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out);
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input--lg {
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  padding: 16px 16px;
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12px; font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--text);
}
.badge--ok    { background: var(--ok-bg); color: var(--ok); }
.badge--warn  { background: var(--warn-bg); color: oklch(0.45 0.15 70); }
.badge--info  { background: var(--info-bg); color: var(--info); }
.badge--err   { background: var(--err-bg); color: var(--err); }
.badge--queue { background: var(--queue-bg); color: var(--queue); }
.badge--solid { background: var(--ink-900); color: white; }
.badge--primary { background: var(--primary-soft); color: var(--primary); }

/* Heat score */
.heat {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}
.heat--novice    { background: oklch(0.94 0.02 240); color: oklch(0.40 0.10 240); }
.heat--rising    { background: oklch(0.95 0.03 145); color: oklch(0.40 0.13 145); }
.heat--trending  { background: oklch(0.96 0.05 60);  color: oklch(0.45 0.16 60);  }
.heat--legendary { background: oklch(0.95 0.05 25);  color: oklch(0.50 0.21 25);  }

/* Live dot */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--err);
  border-radius: 999px;
  position: relative;
}
.live-dot::after {
  content: ""; position: absolute; inset: -3px;
  border-radius: 999px;
  background: var(--err);
  opacity: 0.25;
  animation: pulse 1.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}

.tick { animation: tick 700ms var(--ease-out); }
@keyframes tick {
  0%   { background: var(--primary-soft); }
  100% { background: transparent; }
}

/* ============================================================
   Avatars
   ============================================================ */
.avatar {
  width: 40px; height: 40px;
  border-radius: 999px;
  background: var(--ink-200);
  color: var(--ink-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }
.avatar--xl { width: 92px; height: 92px; font-size: 30px; }

/* Color variants seeded by hash */
.avatar[data-tint="0"] { background: oklch(0.93 0.06 25);  color: oklch(0.40 0.15 25);  }
.avatar[data-tint="1"] { background: oklch(0.93 0.06 200); color: oklch(0.38 0.13 240); }
.avatar[data-tint="2"] { background: oklch(0.92 0.06 145); color: oklch(0.38 0.14 145); }
.avatar[data-tint="3"] { background: oklch(0.93 0.07 60);  color: oklch(0.42 0.16 60);  }
.avatar[data-tint="4"] { background: oklch(0.93 0.07 295); color: oklch(0.40 0.18 295); }
.avatar[data-tint="5"] { background: oklch(0.93 0.04 50);  color: oklch(0.30 0.04 50);  }

/* ============================================================
   Desktop shell — sidebar + topbar
   ============================================================ */
.dt-side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  gap: 4px;
}
.dt-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 18px;
}
.dt-brand__mark {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 9px;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  letter-spacing: -0.04em;
  box-shadow: 0 4px 12px rgba(225, 29, 46, 0.35);
}
.dt-brand__name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.dt-brand__mode {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--primary); text-transform: uppercase;
  margin-top: 1px;
}

.dt-nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.dt-nav-group__title {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 10px 6px;
}
.dt-nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-700);
  position: relative;
  transition: background 100ms;
  text-decoration: none;
}
.dark .dt-nav-item { color: var(--ink-300); }
.dt-nav-item:hover { background: var(--surface-2); }
.dt-nav-item[data-active="true"],
.dt-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.dt-nav-item__badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10.5px; font-weight: 700;
  padding: 0 7px; border-radius: 999px;
  min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}

.dt-side__footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

.dt-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  height: 60px;
}
.dt-page-title { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.dt-crumbs {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-mute); font-size: 13px;
}
.dt-crumbs__active { color: var(--text); font-weight: 600; }
.dt-search {
  flex: 1; max-width: 320px; margin-left: 12px;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-mute);
  cursor: pointer;
  border: none;
}
.dt-search__kbd {
  margin-left: auto;
  display: inline-flex; gap: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--text-dim);
}
.dt-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.dt-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px; border: none; background: transparent;
  cursor: pointer; color: var(--ink-700);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.dark .dt-icon-btn { color: var(--ink-300); }
.dt-icon-btn:hover { background: var(--surface-2); }
.dt-icon-btn__dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--surface);
}
.dt-mode-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  border: none;
}
.dt-mode-pill__avatar {
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
}
.dt-cta {
  background: var(--primary); color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 6px rgba(225, 29, 46, 0.25);
}
.dt-cta:hover { background: var(--primary-press); }

/* Main content */
.dt-main { overflow-y: auto; background: var(--bg); }
.dt-content { padding: 28px 32px 40px; }

/* Stat cards */
.dt-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
}
.dt-stat__label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute);
}
.dt-stat__value {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-size: 26px; font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
  color: var(--text);
}
.dt-stat__delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  color: var(--ok); margin-top: 4px;
}
.dt-stat__delta--down { color: var(--err); }

.dt-section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 6px 0 12px;
}
.dt-section-h__title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.dt-section-h__sub { font-size: 13px; color: var(--text-mute); margin-left: 8px; }
.dt-section-h__action {
  font-size: 13px; color: var(--primary);
  font-weight: 600; cursor: pointer;
  text-decoration: none;
}

/* Tables */
.dt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.dt-table thead th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-mute);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--ink-50);
}
.dark .dt-table thead th { background: var(--ink-900); }
.dt-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dt-table tbody tr:hover td { background: var(--ink-50); }
.dark .dt-table tbody tr:hover td { background: var(--ink-800); }
.dt-table tbody tr:last-child td { border-bottom: none; }

.dt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-1);
  color: var(--text);
  text-decoration: none;
}
.chip[data-active="true"], .chip.active {
  background: var(--ink-900); color: white;
  border-color: var(--ink-900);
}
.chip--filter[data-active="true"], .chip--filter.active {
  background: var(--primary-soft); color: var(--primary);
  border-color: var(--primary);
}

/* Toast */
.toast {
  background: var(--ink-900);
  color: white;
  padding: 12px 14px;
  border-radius: var(--r-3);
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
  box-shadow: var(--shadow-3);
  animation: toast-in 280ms var(--ease-out);
}
@keyframes toast-in {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--ink-100), var(--ink-150), var(--ink-100));
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 0 0; }
  to   { background-position: -200% 0; }
}

/* ============================================================
   Marketplace card variants
   ============================================================ */
.thumb {
  background: var(--ink-100);
  position: relative;
  overflow: hidden;
  border-radius: var(--r-3);
}
.thumb__pattern {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg,
      transparent 0 8px,
      rgba(0,0,0,0.035) 8px 9px),
    linear-gradient(135deg, var(--ink-100), var(--ink-150));
}
.thumb__label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  text-transform: uppercase;
}

.countdown {
  font-family: var(--font-mono);
  font-feature-settings: "tnum";
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Snipe pulse */
.snipe { animation: snipe-pulse 1s var(--ease-out) infinite alternate; }
@keyframes snipe-pulse {
  from { background: var(--err-bg); }
  to   { background: oklch(0.93 0.08 25); }
}

/* ============================================================
   Custom scrollbars
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-200);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
.dark ::-webkit-scrollbar-thumb { background: var(--ink-700); }
.dark ::-webkit-scrollbar-thumb:hover { background: var(--ink-600); }

/* Focus rings */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* HTMX */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* Mobile sidebar overlay */
@media (max-width: 767px) {
  .dt-side.mobile-overlay {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.24s var(--ease-out);
  }
  .dt-side.mobile-overlay.open { transform: translateX(0); }
  .mobile-backdrop {
    position: fixed; inset: 0;
    background: rgba(20, 14, 14, 0.5);
    z-index: 49;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
  }
  .mobile-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* Misc helpers */
.muted { color: var(--text-mute); }
.dim   { color: var(--text-dim); }
.divider { height: 1px; background: var(--border); margin: 0; border: 0; }
