/**
 * Trovv Design System
 * Tokens, spacing, typography, color system, and core component styles.
 * Based on the existing landing page aesthetic: dark, lowercase, modern mobility-tech.
 *
 * Usage: @import url('/design-system.css') or <link rel="stylesheet" href="/design-system.css">
 * All classes prefixed with .tv- to avoid conflicts.
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   TOKENS — Design primitives
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Colors ─────────────────────────────────────────────────── */
  --tv-dark:          #0a0a0f;
  --tv-surface:       #111118;
  --tv-card:          #18181f;
  --tv-elevated:      #1f1f28;
  --tv-border:        #2a2a35;
  --tv-border-subtle: #1e1e28;

  --tv-accent:        #00d4aa;
  --tv-accent-dim:    #00d4aa22;
  --tv-accent-glow:   #00d4aa44;
  --tv-accent-hover:  #00e8bb;
  --tv-accent-pressed:#00b898;

  --tv-blue:          #4488ff;
  --tv-blue-dim:      #4488ff22;
  --tv-purple:        #8866ff;
  --tv-purple-dim:    #8866ff22;
  --tv-orange:        #ff8844;
  --tv-orange-dim:    #ff884422;
  --tv-red:           #ff4444;
  --tv-red-dim:       #ff444420;
  --tv-yellow:        #ffcc44;
  --tv-yellow-dim:    #ffcc4422;
  --tv-green:         #44cc88;
  --tv-green-dim:     #44cc8822;

  --tv-text:          #e8e8ec;
  --tv-text-secondary:#b0b0c0;
  --tv-muted:         #8888a0;
  --tv-faint:         #555566;
  --tv-ghost:         #333344;

  /* ── Typography ─────────────────────────────────────────────── */
  --tv-font-display:  'Space Grotesk', system-ui, -apple-system, sans-serif;
  --tv-font-body:     'DM Sans', system-ui, -apple-system, sans-serif;
  --tv-font-mono:     'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --tv-text-xs:       0.6875rem;   /* 11px */
  --tv-text-sm:       0.8125rem;   /* 13px */
  --tv-text-base:     0.9375rem;   /* 15px */
  --tv-text-md:       1.0625rem;   /* 17px */
  --tv-text-lg:       1.25rem;     /* 20px */
  --tv-text-xl:       1.5rem;      /* 24px */
  --tv-text-2xl:      2rem;        /* 32px */
  --tv-text-3xl:      2.5rem;      /* 40px */
  --tv-text-4xl:      3.5rem;      /* 56px */

  --tv-leading-tight: 1.1;
  --tv-leading-snug:  1.25;
  --tv-leading-normal:1.5;
  --tv-leading-relaxed:1.65;

  --tv-tracking-tight:-0.04em;
  --tv-tracking-snug: -0.02em;
  --tv-tracking-normal:0;
  --tv-tracking-wide: 0.08em;
  --tv-tracking-wider:0.12em;

  --tv-weight-regular:400;
  --tv-weight-medium: 500;
  --tv-weight-semibold:600;
  --tv-weight-bold:   700;

  /* ── Spacing ────────────────────────────────────────────────── */
  --tv-space-0:   0;
  --tv-space-1:   0.25rem;   /* 4px */
  --tv-space-2:   0.5rem;    /* 8px */
  --tv-space-3:   0.75rem;   /* 12px */
  --tv-space-4:   1rem;      /* 16px */
  --tv-space-5:   1.25rem;   /* 20px */
  --tv-space-6:   1.5rem;    /* 24px */
  --tv-space-8:   2rem;      /* 32px */
  --tv-space-10:  2.5rem;    /* 40px */
  --tv-space-12:  3rem;      /* 48px */
  --tv-space-16:  4rem;      /* 64px */
  --tv-space-20:  5rem;      /* 80px */
  --tv-space-24:  6rem;      /* 96px */

  /* ── Radii ──────────────────────────────────────────────────── */
  --tv-radius-sm:   6px;
  --tv-radius-md:   8px;
  --tv-radius-lg:   12px;
  --tv-radius-xl:   16px;
  --tv-radius-2xl:  24px;
  --tv-radius-full: 100px;

  /* ── Shadows ────────────────────────────────────────────────── */
  --tv-shadow-sm:   0 1px 2px rgba(0,0,0,0.3);
  --tv-shadow-md:   0 4px 12px rgba(0,0,0,0.4);
  --tv-shadow-lg:   0 8px 32px rgba(0,0,0,0.5);
  --tv-shadow-glow: 0 0 20px var(--tv-accent-glow);

  /* ── Transitions ────────────────────────────────────────────── */
  --tv-transition-fast:   0.15s ease;
  --tv-transition-normal: 0.25s ease;
  --tv-transition-slow:   0.4s ease;

  /* ── Z-Index ────────────────────────────────────────────────── */
  --tv-z-base:      0;
  --tv-z-dropdown:  10;
  --tv-z-sticky:    20;
  --tv-z-fixed:     30;
  --tv-z-overlay:   40;
  --tv-z-modal:     50;
  --tv-z-toast:     60;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   BASE RESET
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-reset, .tv-reset * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.tv-body {
  font-family: var(--tv-font-body);
  background: var(--tv-dark);
  color: var(--tv-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: var(--tv-leading-normal);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-h1, .tv-h2, .tv-h3, .tv-h4 {
  font-family: var(--tv-font-display);
  font-weight: var(--tv-weight-bold);
  letter-spacing: var(--tv-tracking-tight);
  line-height: var(--tv-leading-tight);
  color: var(--tv-text);
}

.tv-h1 { font-size: var(--tv-text-4xl); }
.tv-h2 { font-size: var(--tv-text-2xl); }
.tv-h3 { font-size: var(--tv-text-lg); }
.tv-h4 { font-size: var(--tv-text-md); font-weight: var(--tv-weight-semibold); }

.tv-body-lg  { font-size: var(--tv-text-md); line-height: var(--tv-leading-relaxed); }
.tv-body-md  { font-size: var(--tv-text-base); line-height: var(--tv-leading-normal); }
.tv-body-sm  { font-size: var(--tv-text-sm); line-height: var(--tv-leading-normal); }
.tv-body-xs  { font-size: var(--tv-text-xs); line-height: var(--tv-leading-normal); }

.tv-label {
  font-size: var(--tv-text-xs);
  font-weight: var(--tv-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tv-tracking-wider);
  color: var(--tv-accent);
}

.tv-caption {
  font-size: var(--tv-text-xs);
  color: var(--tv-faint);
  letter-spacing: var(--tv-tracking-wide);
  text-transform: uppercase;
}

.tv-muted { color: var(--tv-muted); }
.tv-faint { color: var(--tv-faint); }
.tv-accent { color: var(--tv-accent); }

.tv-gradient-text {
  background: linear-gradient(135deg, var(--tv-accent), var(--tv-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tv-space-2);
  padding: var(--tv-space-3) var(--tv-space-4);
  border-radius: var(--tv-radius-md);
  font-family: var(--tv-font-body);
  font-size: var(--tv-text-sm);
  font-weight: var(--tv-weight-medium);
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: all var(--tv-transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.tv-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary - teal filled */
.tv-btn-primary {
  background: var(--tv-accent);
  color: var(--tv-dark);
}
.tv-btn-primary:hover:not(:disabled) {
  background: var(--tv-accent-hover);
  box-shadow: var(--tv-shadow-glow);
}
.tv-btn-primary:active:not(:disabled) {
  background: var(--tv-accent-pressed);
}

/* Ghost - outlined */
.tv-btn-ghost {
  background: var(--tv-card);
  color: var(--tv-muted);
  border: 1px solid var(--tv-border);
}
.tv-btn-ghost:hover:not(:disabled) {
  border-color: var(--tv-accent);
  color: var(--tv-text);
}

/* Danger - red */
.tv-btn-danger {
  background: var(--tv-red-dim);
  color: var(--tv-red);
  border: 1px solid rgba(255, 68, 68, 0.25);
}
.tv-btn-danger:hover:not(:disabled) {
  background: rgba(255, 68, 68, 0.15);
  border-color: var(--tv-red);
}

/* Sizes */
.tv-btn-sm {
  padding: var(--tv-space-2) var(--tv-space-3);
  font-size: var(--tv-text-xs);
}
.tv-btn-lg {
  padding: var(--tv-space-4) var(--tv-space-6);
  font-size: var(--tv-text-base);
  border-radius: var(--tv-radius-lg);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-card {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-lg);
  padding: var(--tv-space-5);
}

.tv-card-elevated {
  background: var(--tv-card);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-lg);
  padding: var(--tv-space-5);
  box-shadow: var(--tv-shadow-md);
}

.tv-card-interactive {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-xl);
  padding: var(--tv-space-6);
  transition: border-color var(--tv-transition-normal);
  cursor: pointer;
}
.tv-card-interactive:hover {
  border-color: var(--tv-accent);
}

.tv-card-glow {
  background: linear-gradient(135deg, var(--tv-surface), rgba(0, 212, 170, 0.03));
  border: 1px solid var(--tv-accent);
  border-radius: var(--tv-radius-xl);
  padding: var(--tv-space-6);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-input {
  width: 100%;
  padding: var(--tv-space-3) var(--tv-space-4);
  background: var(--tv-card);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-md);
  color: var(--tv-text);
  font-family: var(--tv-font-body);
  font-size: var(--tv-text-sm);
  outline: none;
  transition: border-color var(--tv-transition-fast);
}
.tv-input:focus {
  border-color: var(--tv-accent);
  box-shadow: 0 0 0 3px var(--tv-accent-dim);
}
.tv-input::placeholder {
  color: var(--tv-faint);
}

.tv-input-lg {
  padding: var(--tv-space-4) var(--tv-space-5);
  font-size: var(--tv-text-base);
  border-radius: var(--tv-radius-lg);
}

.tv-textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--tv-space-3) var(--tv-space-4);
  background: var(--tv-card);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-md);
  color: var(--tv-text);
  font-family: var(--tv-font-body);
  font-size: var(--tv-text-sm);
  outline: none;
  resize: vertical;
  transition: border-color var(--tv-transition-fast);
}
.tv-textarea:focus {
  border-color: var(--tv-accent);
  box-shadow: 0 0 0 3px var(--tv-accent-dim);
}

.tv-field {
  margin-bottom: var(--tv-space-4);
}
.tv-field-label {
  display: block;
  margin-bottom: var(--tv-space-2);
  font-size: var(--tv-text-xs);
  font-weight: var(--tv-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--tv-muted);
}
.tv-field-hint {
  margin-top: var(--tv-space-1);
  font-size: var(--tv-text-xs);
  color: var(--tv-faint);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   TOGGLE
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-toggle {
  display: flex;
  align-items: center;
  gap: var(--tv-space-3);
  cursor: pointer;
}

.tv-toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--tv-border);
  position: relative;
  transition: background var(--tv-transition-fast);
  flex-shrink: 0;
}
.tv-toggle-track.active {
  background: var(--tv-accent);
}

.tv-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left var(--tv-transition-fast);
}
.tv-toggle-track.active .tv-toggle-thumb {
  left: 21px;
}

.tv-toggle-label {
  font-size: var(--tv-text-sm);
  color: var(--tv-muted);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-tabs {
  display: flex;
  gap: var(--tv-space-1);
  background: var(--tv-dark);
  border-radius: var(--tv-radius-md);
  padding: var(--tv-space-1);
}

.tv-tab {
  flex: 1;
  padding: var(--tv-space-3) var(--tv-space-4);
  border-radius: var(--tv-radius-sm);
  font-family: var(--tv-font-body);
  font-size: var(--tv-text-sm);
  font-weight: var(--tv-weight-medium);
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all var(--tv-transition-fast);
  background: transparent;
  color: var(--tv-muted);
}
.tv-tab:hover {
  color: var(--tv-text);
}
.tv-tab.active {
  background: var(--tv-accent);
  color: var(--tv-dark);
}

/* Pill tabs (for mode selector) */
.tv-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--tv-space-2);
}

.tv-pill {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-full);
  padding: var(--tv-space-2) var(--tv-space-4);
  font-family: var(--tv-font-body);
  font-size: var(--tv-text-sm);
  font-weight: var(--tv-weight-medium);
  color: var(--tv-muted);
  cursor: pointer;
  transition: all var(--tv-transition-normal);
  white-space: nowrap;
}
.tv-pill:hover {
  border-color: var(--tv-accent);
  color: var(--tv-text);
}
.tv-pill.active {
  background: var(--tv-accent-dim);
  border-color: var(--tv-accent);
  color: var(--tv-accent);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--tv-z-modal);
  padding: var(--tv-space-5);
  animation: tv-fade-in 0.2s ease;
}

.tv-modal {
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-xl);
  padding: var(--tv-space-8);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  animation: tv-slide-up 0.25s ease;
}
.tv-modal-wide {
  max-width: 640px;
}

.tv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--tv-space-6);
}

.tv-modal-title {
  font-family: var(--tv-font-display);
  font-size: var(--tv-text-md);
  font-weight: var(--tv-weight-semibold);
  color: var(--tv-text);
}

.tv-modal-close {
  background: none;
  border: none;
  color: var(--tv-faint);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: var(--tv-space-2);
  border-radius: var(--tv-radius-sm);
  transition: color var(--tv-transition-fast);
}
.tv-modal-close:hover {
  color: var(--tv-text);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--tv-space-1);
  padding: 2px 8px;
  border-radius: var(--tv-radius-full);
  font-size: var(--tv-text-xs);
  font-weight: var(--tv-weight-medium);
}

.tv-badge-accent {
  background: var(--tv-accent-dim);
  color: var(--tv-accent);
  border: 1px solid rgba(0, 212, 170, 0.25);
}
.tv-badge-blue {
  background: var(--tv-blue-dim);
  color: var(--tv-blue);
  border: 1px solid rgba(68, 136, 255, 0.25);
}
.tv-badge-purple {
  background: var(--tv-purple-dim);
  color: var(--tv-purple);
  border: 1px solid rgba(136, 102, 255, 0.25);
}
.tv-badge-orange {
  background: var(--tv-orange-dim);
  color: var(--tv-orange);
  border: 1px solid rgba(255, 136, 68, 0.25);
}
.tv-badge-red {
  background: var(--tv-red-dim);
  color: var(--tv-red);
  border: 1px solid rgba(255, 68, 68, 0.25);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NAV
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-nav {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: var(--tv-z-fixed);
  padding: var(--tv-space-4) var(--tv-space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--tv-border);
}

.tv-logo {
  font-family: var(--tv-font-display);
  font-size: 1.5rem;
  font-weight: var(--tv-weight-bold);
  letter-spacing: var(--tv-tracking-tight);
  color: var(--tv-text);
  text-decoration: none;
}
.tv-logo-dot {
  color: var(--tv-accent);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-empty {
  text-align: center;
  padding: var(--tv-space-16) var(--tv-space-5);
  background: var(--tv-surface);
  border: 1px solid var(--tv-border);
  border-radius: var(--tv-radius-xl);
}

.tv-empty-icon {
  margin-bottom: var(--tv-space-4);
  color: var(--tv-border);
}

.tv-empty-title {
  font-size: var(--tv-text-base);
  font-weight: var(--tv-weight-semibold);
  color: var(--tv-text);
  margin-bottom: var(--tv-space-2);
}

.tv-empty-desc {
  font-size: var(--tv-text-sm);
  color: var(--tv-faint);
  max-width: 340px;
  margin: 0 auto var(--tv-space-5);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   LAYOUT UTILITIES
   ═══════════════════════════════════════════════════════════════════════════════ */

.tv-flex         { display: flex; }
.tv-flex-col     { display: flex; flex-direction: column; }
.tv-flex-center  { display: flex; align-items: center; justify-content: center; }
.tv-flex-between { display: flex; align-items: center; justify-content: space-between; }
.tv-flex-wrap    { flex-wrap: wrap; }

.tv-gap-1  { gap: var(--tv-space-1); }
.tv-gap-2  { gap: var(--tv-space-2); }
.tv-gap-3  { gap: var(--tv-space-3); }
.tv-gap-4  { gap: var(--tv-space-4); }
.tv-gap-6  { gap: var(--tv-space-6); }
.tv-gap-8  { gap: var(--tv-space-8); }

.tv-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.tv-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.tv-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }

.tv-text-center { text-align: center; }
.tv-w-full      { width: 100%; }
.tv-mx-auto     { margin-left: auto; margin-right: auto; }

.tv-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--tv-space-5);
}

.tv-section {
  padding: var(--tv-space-24) var(--tv-space-5);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

@keyframes tv-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes tv-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tv-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

@keyframes tv-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.tv-animate-fade { animation: tv-fade-in 0.3s ease; }
.tv-animate-slide { animation: tv-slide-up 0.3s ease; }
.tv-animate-pulse { animation: tv-pulse 2s infinite; }
.tv-animate-spin  { animation: tv-spin 1s linear infinite; }


/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .tv-grid-2, .tv-grid-3, .tv-grid-4 {
    grid-template-columns: 1fr;
  }
  .tv-nav {
    padding: var(--tv-space-3) var(--tv-space-4);
  }
  .tv-section {
    padding: var(--tv-space-16) var(--tv-space-4);
  }
  .tv-h1 { font-size: var(--tv-text-3xl); }
  .tv-h2 { font-size: var(--tv-text-xl); }
  .tv-modal { padding: var(--tv-space-5); }
}

@media (max-width: 480px) {
  .tv-h1 { font-size: var(--tv-text-2xl); }
  .tv-pills { gap: var(--tv-space-2); }
  .tv-pill { font-size: var(--tv-text-xs); padding: var(--tv-space-2) var(--tv-space-3); }
}
