@import "tailwindcss";
/* Fonts are loaded via <link rel="stylesheet"> in index.html <head> so they
   resolve before first paint (no FOUT). Don't re-import via @import here. */

@theme {
  /* v2 — AZAION design system. v1 az-* names below are aliases so legacy
     pages still render until they're migrated to v2 utilities. */
  --color-surface-0:     #0A0D10;
  --color-surface-1:     #13171C;
  --color-surface-2:     #1A1F26;
  --color-surface-input: #0A0D10;
  --color-border-hair:   #252B34;
  --color-border-raised: #3B4451;
  --color-text-primary:   #E8ECF1;
  --color-text-secondary: #9AA4B2;
  --color-text-muted:     #5B6573;
  --color-accent-amber: #FF9D3D;
  --color-accent-cyan:  #36D6C5;
  --color-accent-red:   #FF4756;
  --color-accent-green: #3DDC84;
  --color-accent-blue:  #4E9EFF;

  /* legacy v1 aliases — mapped to v2 vars so unmigrated pages stay readable. */
  --color-az-bg:     #0A0D10;
  --color-az-panel:  #13171C;
  --color-az-header: #13171C;
  --color-az-border: #252B34;
  --color-az-muted:  #5B6573;
  --color-az-text:   #E8ECF1;
  --color-az-orange: #FF9D3D;
  --color-az-blue:   #4E9EFF;
  --color-az-red:    #FF4756;
  --color-az-green:  #3DDC84;
}

:root {
  --surface-0:     #0A0D10;
  --surface-1:     #13171C;
  --surface-2:     #1A1F26;
  --surface-input: #0A0D10;
  --border-hair:   #252B34;
  --border-raised: #3B4451;
  --text-primary:   #E8ECF1;
  --text-secondary: #9AA4B2;
  --text-muted:     #5B6573;
  --accent-amber: #FF9D3D;
  --accent-cyan:  #36D6C5;
  --accent-red:   #FF4756;
  --accent-green: #3DDC84;
  --accent-blue:  #4E9EFF;
}

html, body {
  background: var(--surface-0);
  color: var(--text-primary);
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
}

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }

.micro {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.sect-head {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-amber);
}

.hint { font-size: 11px; color: var(--text-muted); line-height: 1.45; }

/* Corner brackets */
.bracket { position: relative; }
.bracket::before, .bracket::after,
.bracket > .br::before, .bracket > .br::after {
  content: ''; position: absolute; width: 8px; height: 8px;
  border-color: var(--accent-amber); border-style: solid; border-width: 0;
  pointer-events: none;
}
.bracket::before  { top: -1px; left:  -1px; border-top-width: 1px;    border-left-width: 1px;  }
.bracket::after   { top: -1px; right: -1px; border-top-width: 1px;    border-right-width: 1px; }
.bracket > .br::before { bottom: -1px; left:  -1px; border-bottom-width: 1px; border-left-width: 1px;  }
.bracket > .br::after  { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

/* Subtle grid backdrop */
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Inputs */
.inp {
  background: var(--surface-input);
  border: 1px solid var(--border-hair);
  border-radius: 2px;
  height: 32px;
  padding: 6px 10px;
  font: 12px 'IBM Plex Sans', system-ui, sans-serif;
  color: var(--text-primary);
  outline: none;
  width: 100%;
}
.inp:focus { border-color: var(--accent-amber); box-shadow: 0 0 0 1px var(--accent-amber); }
.inp::placeholder { color: var(--text-muted); }
.inp-mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

/* Hide native number-input spinner arrows — custom ▲▼ steppers replace them. */
.inp[type="number"]::-webkit-inner-spin-button,
.inp[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.inp[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Checkbox — v2 dark theme, amber check.
   Layout-stable: flex (not inline-flex) so the baseline of the wrapping
   label doesn't shift when the input gains focus or toggles. The checkmark
   is a background-image SVG so there is no pseudo-element being added /
   removed (which can briefly affect intrinsic size in some browsers). */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  flex: none;
  margin: 0;
  padding: 0;
  background: var(--surface-input) no-repeat center center;
  background-size: 10px 10px;
  border: 1px solid var(--border-raised);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color .1s, background-color .1s, box-shadow .1s;
  outline: none;
}
.checkbox:hover { border-color: var(--accent-amber); }
.checkbox:focus-visible {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 1px var(--accent-amber);
}
.checkbox:checked {
  background-color: var(--accent-amber);
  border-color: var(--accent-amber);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230A0D10' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 8.5 7 12 13 4.5'/></svg>");
}
.checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  font: 600 11px 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent-amber);
  color: #0A0D10;
  border-color: var(--accent-amber);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary {
  background: transparent;
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,157,61,.12); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-hair);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); border-color: var(--border-raised); }
.btn-danger-ghost {
  background: transparent;
  color: var(--accent-red);
  border-color: rgba(255,71,86,0.5);
}
.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(255,71,86,0.08);
  border-color: var(--accent-red);
}
.btn-danger {
  background: var(--accent-red);
  color: #0A0D10;
  border-color: var(--accent-red);
}

/* Icon button */
.ibtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color .1s, background .1s, border-color .1s;
}
.ibtn:hover { color: var(--text-primary); background: var(--surface-2); border-color: var(--border-hair); }
.ibtn:disabled { opacity: 0.4; cursor: not-allowed; }
.ibtn.danger:hover { color: var(--accent-red); border-color: var(--accent-red); background: rgba(255,71,86,.08); }
.ibtn.edit:hover  { color: var(--accent-amber); border-color: var(--accent-amber); background: rgba(255,157,61,.08); }
.ibtn.cyan:hover  { color: var(--accent-cyan); border-color: var(--accent-cyan); background: rgba(54,214,197,.08); }

/* Header-scoped icon buttons override the smaller in-table variant */
header .ibtn {
  width: 28px; height: 28px;
  border: 1px solid var(--border-hair);
  color: var(--text-secondary);
}
header .ibtn:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-raised); }
header .ibtn.active { color: var(--accent-amber); border-color: var(--accent-amber); background: rgba(255,157,61,0.08); }
header .ibtn.danger:hover { color: var(--accent-red); border-color: var(--accent-red); background: rgba(255,71,86,0.08); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 18px; padding: 0 8px;
  font: 600 10px 'JetBrains Mono', monospace;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { color: var(--accent-green); }
.pill-red   { color: var(--accent-red); }
.pill-cyan  { color: var(--accent-cyan); }
.pill-amber { color: var(--accent-amber); }
.pill-blue  { color: var(--accent-blue); }
.pill-muted { color: var(--text-muted); }

/* Chip (role chips, type chips — solid filled, denser) */
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; min-width: 60px; padding: 0 8px;
  font: 600 10px 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
}
.chip-admin    { background: rgba(255,157,61,.16); color: var(--accent-amber); border: 1px solid rgba(255,157,61,.35); }
.chip-operator { background: rgba(78,158,255,.14); color: var(--accent-blue);  border: 1px solid rgba(78,158,255,.35); }
.chip-viewer   { background: rgba(154,164,178,.10); color: var(--text-secondary); border: 1px solid var(--border-hair); }

/* Type squares (P / C / F) */
.type-sq {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 2px;
  font: 700 9px 'JetBrains Mono', monospace;
  color: #0A0D10;
  flex: none;
}

/* Color swatch */
.swatch {
  display: inline-block; width: 12px; height: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 1px;
  flex: none;
}

/* Segmented control */
.seg { display: inline-flex; border: 1px solid var(--border-hair); border-radius: 2px; overflow: hidden; }
.seg-btn {
  height: 30px; padding: 0 14px;
  font: 600 10px 'JetBrains Mono', monospace;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-input);
  border-right: 1px solid var(--border-hair);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.active {
  background: var(--accent-amber);
  color: #0A0D10;
}

/* Header bar tabs */
.tab {
  display: inline-flex; align-items: center;
  height: 48px; padding: 0 14px;
  font: 500 12px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent-amber); font-weight: 500; }

/* Table rows */
.row-hover:hover { background: var(--surface-2); }

/* Card panel base */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border-hair);
  border-radius: 2px;
}

/* Settings v2 — settings.html mock specs larger buttons than admin.html mock.
   Scope to the Settings page only so Admin keeps its tighter spec.
   line-height: 1.5 matches the mock's body inheritance (its .btn doesn't use
   the font shorthand, so it inherits body's line-height instead of "normal"). */
.settings-page .btn {
  height: auto;
  padding: 7px 14px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.10em;
  gap: 8px;
}
.settings-page .seg-btn {
  height: auto;
  padding: 7px 18px;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.14em;
  font-weight: 400;
}
.settings-page .seg-btn.active { font-weight: 600; border-right: 0; }
.settings-page .seg-btn + .seg-btn { border-left: 1px solid var(--border-hair); }
.settings-page .btn-primary:hover:not(:disabled) { filter: brightness(1.05); }

/* Star button */
.star {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  transition: color .12s, transform .12s;
}
.star:hover { color: var(--accent-amber); }
.star.active { color: var(--accent-amber); }
.star-off { color: var(--text-muted); }

/* Path input with Browse button (Settings v2 directories panel). */
.path-wrap { position: relative; display: flex; align-items: center; }
.path-wrap .path-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.path-wrap .browse {
  position: absolute;
  right: 4px;
  top: 4px;
  height: 24px;
  padding: 0 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-hair);
  border-radius: 2px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.path-wrap .browse:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  background: rgba(255,157,61,0.06);
}
.path-wrap > input.inp { padding-left: 30px; padding-right: 70px; }

/* Pulse for live dot */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.live { animation: pulse 1.6s ease-in-out infinite; }

/* Reveal-on-hover */
.row-hover .reveal { opacity: 0; transition: opacity .12s; }
.row-hover:hover .reveal { opacity: 1; }

/* select matching inp */
select.inp {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-0); }
::-webkit-scrollbar-thumb { background: #1f2630; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #2a323e; }

/* =========================================================================
   ANNOTATIONS PAGE — v2 surfaces
   ========================================================================= */

/* Splitter affordance between resizable panes */
.split { width: 4px; cursor: col-resize; background: transparent; position: relative; }
.split::after {
  content: ''; position: absolute; left: 1px; top: 0; bottom: 0; width: 1px;
  background: var(--border-hair);
}
.split:hover::after { background: var(--accent-amber); }

/* Media list row (264px left aside) */
.media-row {
  position: relative;
  display: grid; grid-template-columns: 44px 1fr auto; gap: 8px;
  align-items: center;
  height: 32px; padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--border-hair);
  cursor: pointer; user-select: none;
}
.media-row:hover { background: var(--surface-2); }
.media-row.active { background: var(--surface-2); }
.media-row.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--accent-amber);
}

/* Type chips inside media rows */
.chip-photo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 16px; border-radius: 2px;
  font: 600 9px/1 'JetBrains Mono', monospace; letter-spacing: 0.1em;
  color: var(--accent-cyan); border: 1px solid rgba(54,214,197,0.45);
  background: rgba(54,214,197,0.06);
}
.chip-video {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 16px; border-radius: 2px;
  font: 600 9px/1 'JetBrains Mono', monospace; letter-spacing: 0.1em;
  color: var(--accent-amber); border: 1px solid rgba(255,157,61,0.45);
  background: rgba(255,157,61,0.06);
}

/* Detection class row */
.class-row {
  display: grid; grid-template-columns: 16px 1fr auto; gap: 10px;
  align-items: center; height: 28px; padding: 0 12px;
  border-bottom: 1px solid var(--border-hair);
  cursor: pointer;
}
.class-row:hover { background: var(--surface-2); }
.class-row.active { background: var(--surface-2); }
.class-row.active .kbd { color: var(--accent-amber); border-color: var(--accent-amber); }

/* Keycap chip */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 16px; padding: 0;
  font: 600 10px/1 'JetBrains Mono', monospace;
  color: var(--text-muted); border: 1px solid var(--border-hair); border-radius: 2px;
  background: var(--surface-0);
}

/* Annotation row in right sidebar (gradient stripe via --row-grad) */
.ann-row {
  position: relative;
  display: grid; grid-template-columns: 44px 1fr auto; gap: 8px;
  align-items: center;
  height: 36px; padding: 0 12px;
  border-bottom: 1px solid var(--border-hair);
  cursor: pointer;
  background-color: var(--surface-1);
}
.ann-row::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background-image: var(--row-grad, none);
  pointer-events: none;
}
.ann-row > * { position: relative; z-index: 1; }
.ann-row:hover { background-color: var(--surface-2); }
.ann-row.active { background-color: var(--surface-2); }

/* Faux terrain wash behind canvas */
.terrain {
  background-color: #11181B;
  background-image:
    radial-gradient(900px 500px at 30% 40%, rgba(48,72,60,0.45), transparent 60%),
    radial-gradient(700px 400px at 75% 65%, rgba(40,52,68,0.35), transparent 65%),
    radial-gradient(400px 300px at 60% 30%, rgba(82,64,40,0.18), transparent 70%),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: auto, auto, auto, 48px 48px, 48px 48px;
}

/* Floating AI Detection banner over canvas */
.ai-banner {
  backdrop-filter: blur(6px);
  background: rgba(10,13,16,0.78);
  border: 1px solid rgba(54,214,197,0.4);
  border-radius: 2px;
}

/* Bounding-box label chip (DOM overlay on canvas) */
.bbox-label {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  font: 600 10px/1 'JetBrains Mono', monospace; letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  background: rgba(10,13,16,0.92);
  color: var(--text-primary);
  border: 1px solid var(--border-hair);
  white-space: nowrap;
}
.bbox-label .conf { color: var(--text-secondary); font-weight: 500; }

/* Selection handles on bounding boxes */
.handle {
  position: absolute; width: 6px; height: 6px;
  background: var(--accent-amber); border: 1px solid #0A0D10;
  pointer-events: none;
}

/* Scrubber (timeline with annotation marks) */
.scrub {
  height: 4px; background: var(--surface-2); border: 1px solid var(--border-hair);
  border-radius: 2px; position: relative; cursor: pointer;
}
.scrub .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-amber); pointer-events: none; }
.scrub .head {
  position: absolute; top: 50%; width: 2px; height: 10px; background: var(--accent-amber);
  transform: translate(-50%, -50%); pointer-events: none;
}
.scrub .head-knob {
  position: absolute; top: 50%; width: 12px; height: 12px;
  background: var(--accent-amber);
  border: 2px solid var(--surface-1);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px var(--accent-amber), 0 0 8px rgba(255,157,61,0.45);
  z-index: 2;
  cursor: grab;
}
.scrub .head-knob:active { cursor: grabbing; }
.scrub .tick {
  position: absolute; top: 50%; width: 1px; height: 6px; background: var(--text-muted);
  transform: translateY(-50%); pointer-events: none;
}
.scrub .mark {
  position: absolute; top: -3px; width: 2px; height: 10px; pointer-events: none;
}

/* Volume slider (range input next to mute) */
.vol {
  appearance: none; -webkit-appearance: none;
  height: 2px; width: 72px; background: var(--border-hair); outline: none; border-radius: 2px;
}
.vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 10px; height: 10px; background: var(--accent-amber); border-radius: 0; cursor: pointer;
}
.vol::-moz-range-thumb {
  width: 10px; height: 10px; background: var(--accent-amber); border-radius: 0; cursor: pointer; border: 0;
}

/* Live pulse dot (cyan glow) — annotations LIVE indicators */
.live-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent-cyan);
  box-shadow: 0 0 0 0 rgba(54,214,197,0.5);
  animation: live-pulse 1.6s ease-in-out infinite;
  display: inline-block; flex: none;
}
@keyframes live-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(54,214,197,0.5); }
  50%     { box-shadow: 0 0 0 6px rgba(54,214,197,0); }
}
