/* ==========================================================================
   MODEL PICKER - EDITORIAL DESIGN SYSTEM
   Instrument Serif Headings | Inter Body | Asymmetrical Layout
   Bold Saturated Accents | Intentional Spacing Hierarchy
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface & Canvas */
  --bg-app: #08090c;
  --bg-surface: #0f1117;
  --bg-surface-elevated: #151821;
  --bg-card: #12141c;
  --bg-card-hover: #191c28;
  --bg-input: #0b0d13;
  --bg-subtle: #1e2230;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: #3b82f6;

  /* Bold Saturated Personality Colors */
  --accent-cobalt: #2563eb;
  --accent-cobalt-light: #3b82f6;
  --accent-emerald: #059669;
  --accent-coral: #ea580c;
  --accent-amber: #d97706;
  --accent-crimson: #dc2626;
  --accent-violet: #7c3aed;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Typography */
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing Scale */
  --space-tight: 6px;
  --space-sm: 10px;
  --space-md: 18px;
  --space-lg: 28px;
  --space-xl: 44px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: #232838;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cobalt);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 9, 12, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-cobalt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
}

.pulse-dot.locked {
  background-color: var(--accent-crimson);
}

.user-capsule {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-capsule:hover {
  border-color: var(--border-medium);
  background: var(--bg-surface-elevated);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-cobalt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: #ffffff;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.admin-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.4);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ==========================================================================
   EDITORIAL HERO SECTION (ASYMMETRICAL: TEXT LEFT, CTA & STATS RIGHT)
   ========================================================================== */
.hero-section {
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 32px 24px 32px;
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  align-items: flex-end;
  gap: 36px;
}

@media (max-width: 960px) {
  .hero-section {
    grid-template-columns: 1fr;
    padding: 24px 18px 16px 18px;
    gap: 20px;
  }
}

.hero-text-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Largest text element per visual hierarchy */
.hero-headline {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 4.8vw, 3.8rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: #ffffff;
}

.hero-headline em {
  font-style: italic;
  color: #93c5fd;
}

/* Medium-sized scannable description */
.hero-description {
  font-size: 1.02rem;
  color: var(--text-secondary);
  line-height: 1.58;
  max-width: 640px;
}

.hero-cta-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.hero-active-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-cta-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Generous spacing around main CTA */
.btn-hero-cta {
  background: var(--accent-cobalt);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-fast);
}

.btn-hero-cta:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

/* ==========================================================================
   ASYMMETRICAL MAIN LAYOUT: TEXT ON LEFT, VISUAL ON RIGHT
   ========================================================================== */
.app-container {
  max-width: 1540px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 32px 48px 32px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  flex: 1;
}

@media (max-width: 1100px) {
  .app-container {
    grid-template-columns: 1fr;
    padding: 12px 18px 36px 18px;
    gap: 22px;
  }
}

/* ==========================================================================
   LEFT COLUMN: EDITORIAL MODEL EXPLORER
   ========================================================================== */
.catalog-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.section-label {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input-box {
  position: relative;
  width: 100%;
}

.search-input-box input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-input-box input:focus {
  border-color: var(--accent-cobalt-light);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Category Filter Tabs with tight spacing */
.category-scroll-strip {
  display: flex;
  gap: var(--space-tight);
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-tab {
  white-space: nowrap;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.category-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.category-tab.active {
  background: var(--accent-cobalt);
  color: #ffffff;
  border-color: var(--accent-cobalt);
}

/* Model Cards Grid */
.models-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 760px;
  overflow-y: auto;
  padding-right: 4px;
}

.model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.model-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.model-card.active-card {
  border-color: var(--accent-cobalt);
  background: #151825;
}

.model-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Editorial Serif Card Title */
.model-card-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.2;
  color: #ffffff;
}

.model-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.48;
}

.model-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* Bold Saturated Badges */
.badge-format {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-arch {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--accent-amber);
  font-size: 0.85rem;
}

.rating-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ==========================================================================
   RIGHT COLUMN: VISUAL CAMERA VIEWFINDER & TELEMETRY
   ========================================================================== */
.hud-viewfinder-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hud-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-primary);
}

.active-model-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #020204;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

video#webcamVideo, img#displayImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

canvas#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.telemetry-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
}

.telemetry-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  background: rgba(8, 9, 12, 0.88);
  backdrop-filter: blur(8px);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  width: fit-content;
}

.camera-controls-bar {
  padding: 14px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--accent-cobalt);
  color: #ffffff;
  font-weight: 600;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover {
  background: #202434;
  border-color: var(--border-medium);
}

.btn-outline-cyan {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-medium);
}
.btn-outline-cyan:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border-color: rgba(220, 38, 38, 0.35);
}
.btn-danger:hover {
  background: rgba(220, 38, 38, 0.25);
}

.slider-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.slider-control input[type="range"] {
  width: 95px;
  accent-color: var(--accent-cobalt-light);
  cursor: pointer;
}

/* Detection Detections List Pill Box */
.live-detections-feed {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.detections-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.detections-header span {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detection-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 30px;
}

.detection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-primary);
}

.detection-chip .score {
  color: #34d399;
  font-weight: 600;
}

/* ==========================================================================
   CONCURRENCY LOCK OVERLAY (EDITORIAL)
   ========================================================================== */
.lock-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 5, 8, 0.92);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lock-modal-panel {
  max-width: 460px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 34px 28px;
  text-align: center;
}

.lock-radar-circle {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
}

.lock-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 400;
  margin-bottom: 6px;
  color: #ffffff;
}

.lock-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
  line-height: 1.5;
}

.lock-lease-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 20px;
}

.lock-lease-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
}
.lock-lease-row:last-child {
  margin-bottom: 0;
}
.lock-lease-row .label {
  color: var(--text-muted);
}
.lock-lease-row .val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 500;
}

/* ==========================================================================
   AUTH MODAL WITH TIGHT FIELD SPACING
   ========================================================================== */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-panel {
  max-width: 400px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 400;
  margin-bottom: 4px;
  color: #ffffff;
}

.auth-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.45;
}

/* Tight spacing between related form fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-tight);
  margin-bottom: 12px;
}

.form-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition-fast);
}

.form-input:focus {
  border-color: var(--accent-cobalt-light);
}

.auth-toggle-link {
  font-size: 0.8rem;
  color: var(--accent-cobalt-light);
  cursor: pointer;
  margin-top: 16px;
  display: block;
  text-align: center;
}
.auth-toggle-link:hover {
  color: #93c5fd;
}

/* ==========================================================================
   MODEL DETAILS MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 850;
  background: rgba(4, 5, 8, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-panel {
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}
.modal-close:hover {
  color: var(--text-primary);
}

.review-form-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-top: 18px;
}

.star-rating-select {
  display: flex;
  gap: 7px;
  margin: 6px 0 12px;
  font-size: 1.4rem;
  cursor: pointer;
}

.star-btn {
  color: #334155;
  transition: var(--transition-fast);
}
.star-btn.active, .star-btn:hover {
  color: var(--accent-amber);
}

/* ==========================================================================
   ADMIN INTELLIGENCE HUB
   ========================================================================== */
.admin-hub-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.admin-table tr:hover td {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ==========================================================================
   SMALL & SUBTLE FOOTER
   ========================================================================== */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px 32px;
  background: rgba(8, 9, 12, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-link {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-secondary);
}
