/*
 * Tahoe Theme Bridge
 *
 * Layers the Serve Menu "Tahoe" aesthetic onto the existing dashboard.
 * Two jobs:
 *   1. Override --ds-* tokens with Tahoe values (softer, warmer)
 *   2. Map existing -- vars to draw from --ds-* tokens
 *
 * Load AFTER vendor/design-system/index.css and BEFORE the inline <style>.
 */

/* ═══════════════════════════════════════════════════════════════
   1. TAHOE OVERRIDES — softer, warmer, pillowy
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Warmer surfaces */
  --ds-color-bg:              #fcfbf7;
  --ds-color-surface:         #ffffff;
  --ds-color-surface-raised:  #f7f6f1;

  /* Softer borders */
  --ds-color-border:          #ece9e1;
  --ds-color-border-light:    #f5f3ee;

  /* Pillowy radii */
  --ds-radius-sm:   10px;
  --ds-radius-md:   14px;
  --ds-radius-lg:   20px;
  --ds-radius-xl:   26px;

  /* Diffuse, layered shadows */
  --ds-shadow-sm:   0 1px 2px rgba(17,24,39,0.04), 0 1px 1px rgba(17,24,39,0.03);
  --ds-shadow-md:   0 4px 14px rgba(17,24,39,0.06), 0 1px 3px rgba(17,24,39,0.04);
  --ds-shadow-lg:   0 12px 28px rgba(17,24,39,0.08), 0 2px 6px rgba(17,24,39,0.04);
  --ds-shadow-xl:   0 24px 60px rgba(17,24,39,0.12), 0 4px 12px rgba(17,24,39,0.05);

  /* Frost backgrounds for chrome panels */
  --tahoe-frost:        rgba(255, 255, 255, 0.72);
  --tahoe-frost-raised: rgba(255, 255, 255, 0.86);
  --tahoe-frost-sheet:  rgba(255, 255, 255, 0.9);
}


/* ═══════════════════════════════════════════════════════════════
   2. TOKEN BRIDGE — map existing vars ← ds tokens
   Existing CSS references --bg-primary etc.; this makes them
   resolve to the Tahoe-overridden --ds-* values.
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces */
  --bg-primary:    var(--ds-color-bg);
  --bg-secondary:  var(--ds-color-surface);
  --bg-card:       var(--ds-color-surface);
  --bg-elevated:   var(--ds-color-surface-raised);

  /* Text */
  --text-primary:    var(--ds-color-text);
  --text-secondary:  var(--ds-color-text-secondary);
  --text-muted:      var(--ds-color-text-muted);

  /* Brand */
  --accent:           var(--ds-color-accent);
  --accent-secondary: var(--ds-color-accent-secondary);
  --accent-hover:     var(--ds-color-accent-hover);
  --accent-gradient:  var(--ds-color-accent-gradient);
  --accent-muted:     var(--ds-color-accent-muted);

  /* Semantic */
  --success: var(--ds-color-success);
  --warning: var(--ds-color-warning);
  --error:   var(--ds-color-error);

  /* Borders */
  --border:       var(--ds-color-border);
  --border-light: var(--ds-color-border-light);
  --border-color: var(--ds-color-border);  /* alias — was undefined */

  /* Shadows */
  --shadow-sm: var(--ds-shadow-sm);
  --shadow-md: var(--ds-shadow-md);
  --shadow-lg: var(--ds-shadow-lg);

  /* Radii */
  --radius-sm: var(--ds-radius-sm);
  --radius-md: var(--ds-radius-md);
  --radius-lg: var(--ds-radius-lg);

  /* Transitions */
  --transition-fast:   var(--ds-duration-fast) var(--ds-ease-standard);
  --transition-normal: var(--ds-duration-normal) var(--ds-ease-standard);

  /* Previously undefined — now resolved */
  --bg-hover:     var(--ds-color-surface-raised);
  --bg-tertiary:  var(--ds-color-surface-raised);
  --font-mono:    var(--ds-font-mono);
}


/* ═══════════════════════════════════════════════════════════════
   3. GLOBAL VISUAL TREATMENT
   ═══════════════════════════════════════════════════════════════ */

/* Antialiased text everywhere */
body,
body * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Apple-like tracking */
body {
  letter-spacing: -0.005em;
}

h1, h2, h3,
.section-title,
.section-subtitle,
.modal-header h2 {
  letter-spacing: -0.022em;
}

/* ── Header frost ───────────────────────────────────────────── */
.header {
  background: var(--tahoe-frost-raised) !important;
  backdrop-filter: saturate(1.5) blur(20px);
  -webkit-backdrop-filter: saturate(1.5) blur(20px);
  border-bottom-color: rgba(17,24,39,0.06) !important;
}

/* Selection bar frost */
.selection-bar {
  background: var(--tahoe-frost-raised) !important;
  backdrop-filter: saturate(1.5) blur(16px);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom-color: rgba(17,24,39,0.06) !important;
}

/* ── Cards — pillowy corners + softer shadow ────────────────── */
.advertiser-card,
.card,
.modal,
.helper-modal,
.settings-dropdown,
.profile-section,
.segments-visual,
.discovery-insight,
.engagement-insight {
  border-radius: var(--ds-radius-lg) !important;
  box-shadow: var(--ds-shadow-md);
  border-color: var(--ds-color-border);
}

/* ── Buttons — pill shape + softer shadow ───────────────────── */
button,
.nav-btn,
.selection-bar-item,
.target-segment-chip,
.legend-item {
  border-radius: 999px !important;
}

button.primary,
.nav-btn.active {
  box-shadow: 0 1px 2px rgba(17,24,39,0.05), inset 0 0 0 1px rgba(17,24,39,0.04) !important;
}

button.primary:hover:not(:disabled),
.nav-btn.active:hover {
  box-shadow: var(--ds-shadow-md) !important;
}

/* Keep secondary + ghost buttons softer */
button.btn-secondary {
  box-shadow: 0 1px 2px rgba(17,24,39,0.04), inset 0 0 0 1px rgba(17,24,39,0.04);
}

/* ── Inputs — softer radius + hairline border ───────────────── */
select,
input,
textarea,
.show-list-search input {
  border-radius: 12px !important;
  border-color: rgba(17,24,39,0.08) !important;
}

select:focus,
input:focus,
textarea:focus {
  box-shadow: 0 0 0 4px rgba(180, 83, 28, 0.12) !important;
  border-color: var(--ds-color-accent) !important;
}

/* ── Modals — pillowy + stronger backdrop ───────────────────── */
.modal {
  border-radius: var(--ds-radius-lg) !important;
  box-shadow: var(--ds-shadow-xl), 0 0 60px rgba(0,0,0,0.2) !important;
}

.modal-header {
  background: var(--tahoe-frost-raised) !important;
  backdrop-filter: saturate(1.5) blur(16px);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  border-bottom-color: rgba(17,24,39,0.06) !important;
}

.modal-footer {
  background: var(--ds-color-surface-raised);
  border-top-color: rgba(17,24,39,0.06);
}

/* ── Badges — pill shape ────────────────────────────────────── */
.badge,
.section-title .badge,
.show-item-ended-badge,
.category-badge,
.helper-status,
.discovery-badge,
.filter-count-badge {
  border-radius: var(--ds-radius-pill) !important;
}

/* ── Stats — big numbers get tight tracking ─────────────────── */
.big-number,
.hours-big-number,
.reach-value,
.breakdown-value,
.stat-value {
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
}

/* ── Table rows — Finder-like hover ─────────────────────────── */
.show-item:hover,
.stat-row:hover,
tbody tr:hover {
  background: rgba(0, 0, 0, 0.025) !important;
}

/* ── Nav pill container — softer ────────────────────────────── */
.main-nav {
  background: var(--ds-color-surface-raised);
  border-color: var(--ds-color-border);
  border-radius: 999px;
}

.nav-btn:first-child {
  border-radius: 999px 12px 12px 999px !important;
}

.nav-btn:last-child {
  border-radius: 12px 999px 999px 12px !important;
}

.nav-btn:not(.active):not(:first-child):not(:last-child) {
  border-radius: 12px !important;
}

/* ── Scrollbar — warmer ─────────────────────────────────────── */
::-webkit-scrollbar-track {
  background: var(--ds-color-surface-raised);
}

::-webkit-scrollbar-thumb {
  background: var(--ds-color-border);
  border-radius: var(--ds-radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ds-color-text-muted);
}

/* ── Show cards — softer treatment ──────────────────────────── */
.show-item {
  border-radius: var(--ds-radius-md) !important;
  transition: all 0.15s var(--ds-ease-standard);
}

.show-item:hover {
  box-shadow: var(--ds-shadow-md);
}

/* ── Settings dropdown frost ────────────────────────────────── */
.settings-dropdown {
  background: var(--tahoe-frost-sheet) !important;
  backdrop-filter: saturate(1.6) blur(24px);
  -webkit-backdrop-filter: saturate(1.6) blur(24px);
  box-shadow: var(--ds-shadow-lg) !important;
  border-color: rgba(17,24,39,0.06) !important;
}

.settings-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* ── Profile bars + discovery bars — softer radius ──────────── */
.profile-bar-container,
.discovery-bar-container,
.audience-bar-track {
  border-radius: var(--ds-radius-sm) !important;
}

.profile-bar,
.discovery-bar,
.audience-bar-fill {
  border-radius: var(--ds-radius-sm) !important;
}

/* ── Segments bar — pillow shape ────────────────────────────── */
.segments-bar {
  border-radius: var(--ds-radius-md) !important;
  box-shadow: none !important;
}

/* ── Donut chart — no visual change needed, just noting ─────── */

/* ── Toast / status notifications — pill + softer ───────────── */
.status-bar {
  border-radius: var(--ds-radius-md) !important;
}

/* ── Data health indicator — pill ───────────────────────────── */
.data-health-indicator {
  border-radius: 999px !important;
  background: var(--tahoe-frost) !important;
}

/* ── Guest logout + settings buttons — softer ───────────────── */
.guest-logout-btn,
.settings-btn {
  border-radius: var(--ds-radius-md) !important;
}

/* ── Filter checkboxes — accent color inherits ──────────────── */
input[type="checkbox"] {
  accent-color: var(--ds-color-accent);
}

/* ── Proposal creator wizard — softer treatment ─────────────── */
.wizard-step-content,
.wizard-sidebar {
  border-radius: var(--ds-radius-lg) !important;
}

/* ── Loading/spinner — keep accent ──────────────────────────── */

/* ── Subtle animation smoothing ─────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
