/* ==========================================================================
   THERAPY ON WHEELS — SLINGSHOT CRUISE CONSOLE (COCKPIT MUSIC PLAYER)
   Theme: Polaris Slingshot Night Cockpit / Black Glass & Gold Illumination
   ========================================================================== */

:root {
  --tow-gold: #dfbc70;
  --tow-gold-bright: #ffe599;
  --tow-gold-glow: rgba(223, 188, 112, 0.4);
  --tow-gold-dim: rgba(223, 188, 112, 0.15);
  --tow-amber: #e69138;
  --tow-amber-glow: rgba(230, 145, 56, 0.45);
  --tow-cockpit-bg: #090908;
  --tow-console-panel: linear-gradient(180deg, #181714 0%, #0d0c0a 45%, #070706 100%);
  --tow-bezel-border: #383020;
  --tow-bezel-highlight: #705828;
  --tow-text-bright: #fff9ed;
  --tow-text-muted: #8e8574;
  --tow-led-off: #201c14;
  --tow-console-height: 86px;
}

html, body {
  overflow-x: hidden;
}

body.has-tow-player {
  padding-bottom: calc(var(--tow-console-height) + 20px) !important;
}

/* --------------------------------------------------------------------------
   Console Outer Shell & Bezel
   -------------------------------------------------------------------------- */
.tow-player-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
  background: var(--tow-console-panel);
  border-top: 1px solid var(--tow-bezel-highlight);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 225, 150, 0.12);
  color: var(--tow-text-bright);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  user-select: none;
  box-sizing: border-box;
}

/* Subtle carbon / metallic console texture overlay */
.tow-player-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(223, 188, 112, 0.08) 0%, transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0, rgba(255, 255, 255, 0.015) 1px, transparent 0, transparent 4px);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Night Cruise Road & Progress Track
   -------------------------------------------------------------------------- */
.tow-road-track-wrap {
  position: absolute;
  top: -7px;
  left: 0;
  right: 0;
  width: 100%;
  height: 12px;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
}

.tow-road-surface {
  position: relative;
  width: 100%;
  height: 5px;
  background: #141310;
  border-top: 1px solid #332b1d;
  border-bottom: 1px solid #241e14;
  overflow: hidden;
  transition: height 0.2s ease;
}

.tow-road-track-wrap:hover .tow-road-surface {
  height: 7px;
}

/* Animated highway lane markers */
.tow-road-lane-markers {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  transform: translateY(-50%);
  background-image: repeating-linear-gradient(90deg, var(--tow-gold-dim) 0, var(--tow-gold-dim) 10px, transparent 10px, transparent 22px);
  background-size: 32px 100%;
  opacity: 0.6;
}

.tow-player-container.is-cruising .tow-road-lane-markers {
  animation: towRoadMove 0.8s linear infinite;
}

@keyframes towRoadMove {
  from { background-position: 0 0; }
  to { background-position: -32px 0; }
}

/* Illuminated asphalt progress */
.tow-road-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #6e501a, var(--tow-gold), var(--tow-gold-bright));
  box-shadow: 0 0 12px var(--tow-gold-glow);
  transition: width 0.1s linear;
}

/* Slingshot Roadster Icon Tracker */
.tow-slingshot-tracer {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 18px;
  pointer-events: none;
  transition: left 0.1s linear;
  filter: drop-shadow(0 0 6px var(--tow-gold-glow));
}

.tow-slingshot-tracer svg {
  width: 100%;
  height: 100%;
  fill: var(--tow-gold);
}

.tow-player-container.is-cruising .tow-slingshot-tracer {
  animation: towCruisingIdle 1.8s ease-in-out infinite alternate;
}

@keyframes towCruisingIdle {
  0% { transform: translate(-50%, -52%) rotate(-0.5deg); }
  100% { transform: translate(-50%, -48%) rotate(0.5deg); }
}

/* --------------------------------------------------------------------------
   Console Dashboard Grid Layout
   -------------------------------------------------------------------------- */
.tow-console-grid {
  position: relative;
  max-width: 1320px;
  margin: 0 auto;
  height: var(--tow-console-height);
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(180px, 250px) 1fr auto auto;
  align-items: center;
  gap: 20px;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   1. Brand & Cockpit Plate (Left)
   -------------------------------------------------------------------------- */
.tow-cockpit-plate {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tow-cockpit-emblem {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a2211, #0d0c0a 75%);
  border: 1px solid var(--tow-bezel-highlight);
  box-shadow: inset 0 0 10px #000, 0 0 12px rgba(223, 188, 112, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.tow-cockpit-emblem svg {
  width: 24px;
  height: 24px;
  fill: var(--tow-gold);
}

.tow-cockpit-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tow-cockpit-brand {
  font-family: 'Barlow Condensed', Impact, sans-serif;
  font-size: 15px;
  letter-spacing: 1.8px;
  color: var(--tow-gold);
  text-transform: uppercase;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.tow-cockpit-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--tow-text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   2. Center Infotainment Screen (Now Cruising / Session)
   -------------------------------------------------------------------------- */
.tow-infotainment-bezel {
  background: #080807;
  border: 1px solid #3d3321;
  border-radius: 6px;
  padding: 8px 18px;
  box-shadow: inset 0 0 20px #000, 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

/* Subtle digital screen scanline effect */
.tow-infotainment-bezel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 11, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 3px;
  pointer-events: none;
  opacity: 0.45;
}

.tow-screen-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tow-screen-mode-tag {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--tow-gold);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tow-screen-mode-tag .tow-status-pulse {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tow-gold);
}

.tow-player-container.is-cruising .tow-screen-mode-tag .tow-status-pulse {
  box-shadow: 0 0 8px var(--tow-gold);
  animation: towPulseLed 1.4s ease-in-out infinite alternate;
}

.tow-player-container.is-session-active .tow-screen-mode-tag {
  color: var(--tow-amber);
}

.tow-player-container.is-session-active .tow-screen-mode-tag .tow-status-pulse {
  background: var(--tow-amber);
  box-shadow: 0 0 8px var(--tow-amber);
}

@keyframes towPulseLed {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.tow-screen-track-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tow-text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  letter-spacing: 0.3px;
}

.tow-screen-telemetry {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.tow-hud-state {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: 'Barlow Condensed', Impact, sans-serif;
  line-height: 1;
}

.tow-hud-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--tow-text-muted);
}

.tow-hud-value {
  font-size: 14px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--tow-gold);
  margin-top: 3px;
}

.tow-player-container.is-session-active .tow-hud-value {
  color: var(--tow-amber);
}

.tow-screen-time {
  font-family: 'Barlow Condensed', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--tow-text-muted);
  font-variant-numeric: tabular-nums;
  background: #11100d;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #282215;
}

.tow-screen-time span {
  color: var(--tow-gold-bright);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   3. Push-to-Start Button (Engine Start / Cruise Control)
   -------------------------------------------------------------------------- */
.tow-ignite-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tow-push-start-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--tow-bezel-border);
  background: radial-gradient(circle at 35% 35%, #2d2616, #12100b 65%, #050504);
  color: var(--tow-gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 
    0 0 0 2px #100f0d,
    0 0 14px rgba(0, 0, 0, 0.8),
    inset 0 1px 1px rgba(255, 230, 160, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.8);
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  outline: none;
  padding: 0;
}

.tow-push-start-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  pointer-events: none;
}

.tow-push-start-btn:hover {
  transform: scale(1.05);
  border-color: var(--tow-gold);
  box-shadow: 
    0 0 0 2px #100f0d,
    0 0 20px var(--tow-gold-glow),
    inset 0 1px 2px rgba(255, 230, 160, 0.5);
}

.tow-push-start-btn:focus-visible {
  outline: 2px solid var(--tow-gold-bright);
  outline-offset: 4px;
}

.tow-push-start-btn.is-ignited {
  border-color: var(--tow-gold);
  box-shadow: 
    0 0 0 2px #100f0d,
    0 0 22px var(--tow-gold-glow),
    inset 0 0 12px rgba(223, 188, 112, 0.3);
}

.tow-push-start-btn.is-ignited::before {
  border-color: var(--tow-gold-bright);
  box-shadow: 0 0 16px var(--tow-gold-glow);
  animation: towHaloPulse 2s ease-in-out infinite alternate;
}

@keyframes towHaloPulse {
  0% { opacity: 0.4; transform: scale(1); }
  100% { opacity: 0.9; transform: scale(1.03); }
}

.tow-start-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 8px;
  letter-spacing: 1.2px;
  color: var(--tow-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.tow-push-start-btn.is-ignited .tow-start-label {
  color: var(--tow-gold-bright);
}

.tow-push-start-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--tow-gold);
  transition: transform 0.15s ease, fill 0.2s ease;
}

.tow-push-start-btn.is-ignited svg {
  fill: var(--tow-gold-bright);
}

/* --------------------------------------------------------------------------
   4. Audio Instrument Gauge & Status LEDs (Right)
   -------------------------------------------------------------------------- */
.tow-telemetry-cluster {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Three Pilot Status LEDs */
.tow-pilot-leds {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 10px;
  background: #090908;
  border: 1px solid #292316;
  border-radius: 4px;
}

.tow-led-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: 'Barlow Condensed', monospace;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--tow-text-muted);
  font-weight: 700;
}

.tow-led-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tow-led-off);
  border: 1px solid rgba(0, 0, 0, 0.6);
  transition: all 0.25s ease;
}

/* TOW LED: Always Active Power */
.tow-led-row[data-led="tow"] .tow-led-dot {
  background: var(--tow-gold);
  box-shadow: 0 0 6px var(--tow-gold);
}

/* SESSION LED: Active when YouTube playing */
.tow-player-container.is-session-active .tow-led-row[data-led="session"] .tow-led-dot {
  background: var(--tow-amber);
  box-shadow: 0 0 8px var(--tow-amber);
}

.tow-player-container.is-session-active .tow-led-row[data-led="session"] {
  color: var(--tow-amber);
}

/* CRUISE LED: Active when music playing */
.tow-player-container.is-cruising .tow-led-row[data-led="cruise"] .tow-led-dot {
  background: var(--tow-gold-bright);
  box-shadow: 0 0 8px var(--tow-gold-bright);
}

.tow-player-container.is-cruising .tow-led-row[data-led="cruise"] {
  color: var(--tow-gold);
}

/* Circular Automotive Audio Gauge */
.tow-audio-gauge {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.tow-audio-gauge svg.tow-gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tow-gauge-bg-arc {
  fill: none;
  stroke: #1e1a12;
  stroke-width: 4.5;
}

.tow-gauge-fill-arc {
  fill: none;
  stroke: var(--tow-gold);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-dasharray: 125.6; /* 2 * PI * 20 */
  stroke-dashoffset: 87.9; /* 30% default: 125.6 * (1 - 0.3) */
  transition: stroke-dashoffset 0.15s ease, stroke 0.2s ease;
  filter: drop-shadow(0 0 3px var(--tow-gold-glow));
}

.tow-gauge-center {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #1c180f, #0c0b09 80%);
  border: 1px solid #3d321d;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tow-gauge-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 7.5px;
  letter-spacing: 1px;
  color: var(--tow-text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.tow-gauge-readout {
  font-family: 'Barlow Condensed', monospace;
  font-size: 13px;
  font-weight: 800;
  color: var(--tow-gold-bright);
  margin-top: 1px;
}

/* Hidden Accessible Volume Input */
.tow-accessible-slider {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 10;
  margin: 0;
}

/* Quick Mute Indicator */
.tow-gauge-mute-btn {
  background: transparent;
  border: none;
  color: var(--tow-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.tow-gauge-mute-btn:hover {
  color: var(--tow-gold);
}

.tow-gauge-mute-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   Mobile Adaptation (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --tow-console-height: 68px;
  }

  .tow-console-grid {
    padding: 0 10px;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .tow-cockpit-plate {
    display: none; /* Hide decorative badge on mobile to give space to screen */
  }

  .tow-infotainment-bezel {
    padding: 5px 8px;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .tow-screen-meta {
    min-width: 0;
    flex: 1 1 auto;
  }

  .tow-screen-mode-tag {
    font-size: 8.5px;
    letter-spacing: 1px;
  }

  .tow-screen-track-title {
    font-size: 12px;
    max-width: 120px;
  }

  .tow-hud-state {
    display: none; /* Simplify telemetry on mobile */
  }

  .tow-screen-time {
    font-size: 11px;
    padding: 2px 4px;
    letter-spacing: 0.5px;
  }

  .tow-push-start-btn {
    width: 44px;
    height: 44px;
  }

  .tow-start-label {
    font-size: 7px;
    margin-bottom: 1px;
  }

  .tow-push-start-btn svg {
    width: 15px;
    height: 15px;
  }

  .tow-pilot-leds {
    display: none; /* Hide mini LEDs on mobile */
  }

  .tow-audio-gauge {
    width: 42px;
    height: 42px;
  }

  .tow-gauge-readout {
    font-size: 10px;
  }

  .tow-gauge-label {
    font-size: 6px;
  }

  .tow-gauge-mute-btn {
    display: none; /* Gauge center button toggles mute on mobile */
  }
}

@media (max-width: 380px) {
  .tow-screen-time {
    display: none;
  }

  .tow-screen-track-title {
    max-width: 95px;
  }
}

/* --------------------------------------------------------------------------
   Accessibility & Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .tow-player-container,
  .tow-player-container.is-cruising .tow-road-lane-markers,
  .tow-player-container.is-cruising .tow-slingshot-tracer,
  .tow-push-start-btn.is-ignited::before,
  .tow-status-pulse {
    animation: none !important;
    transition: none !important;
  }
}
