@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

:root {
  --bg-primary: #080B10;
  --bg-panel: rgba(13, 17, 23, 0.94); /* Increased opacity for readability without blur */
  --border-glass: rgba(255, 255, 255, 0.08);
  --color-accent: #00F0FF;
  --color-accent-dim: rgba(0, 240, 255, 0.2);
  --color-target: #FF3366;
  --color-target-dim: rgba(255, 51, 102, 0.2);
  --color-text: #E4E7EB;
  --color-text-muted: #8B949E;
  --color-success: #39D353;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --glow-accent: 0 0 15px rgba(0, 240, 255, 0.4);
  --glow-target: 0 0 15px rgba(255, 51, 102, 0.4);
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--color-text);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Optimized Panel Base (Removed expensive backdrop-filters for performance on Pi 3B+) */
.glass-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Head Unit Kiosk Layout */
#kiosk-container {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Top Bar HUD */
.hud-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
}

.hud-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.hud-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #FFFFFF, var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hud-time {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--color-accent);
  text-shadow: var(--glow-accent);
}

.hud-header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-text-muted);
}

.status-dot.active {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.status-dot.searching {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
  animation: pulse 1.5s infinite;
}

.status-dot.error {
  background-color: var(--color-danger);
  box-shadow: 0 0 8px var(--color-danger);
}

.pair-btn {
  background: var(--color-accent-dim);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.pair-btn:hover {
  background: var(--color-accent);
  color: var(--bg-primary);
  box-shadow: var(--glow-accent);
}
/* Floating HUD Widgets */
.hud-widget {
  position: absolute;
  z-index: 10;
  padding: 16px;
}

/* Bottom Left Speedometer */
.hud-widget-bottom-left {
  bottom: 12px;
  left: 12px;
  width: 170px;
}

.speedo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.speedo-value {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  color: #FFFFFF;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.speedo-unit {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-top: 2px;
  text-shadow: var(--glow-accent);
}

/* Compass Widget (Top Center) */
.hud-widget-top-center {
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.compass-tape-container {
  position: relative;
  width: 100%;
  height: 24px;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.2);
}

.compass-tape {
  position: absolute;
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  width: 3600px; /* Repeating tape width */
  transition: transform 0.1s linear;
}

.compass-marker-center {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--color-accent);
  z-index: 2;
  filter: drop-shadow(0 0 4px var(--color-accent));
}

.compass-heading-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: #FFFFFF;
}

/* Bottom Right Destination Widget */
.hud-widget-bottom-right {
  bottom: 130px; /* Shifted up to stack above the music player */
  right: 12px;
  width: 280px;
  display: none; /* Shown dynamically */
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Embedded Music Player HUD Widget */
.music-player-widget {
  bottom: 12px;
  right: 12px;
  width: 280px;
  height: 105px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px;
  z-index: 10;
}

.music-info-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.music-note-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid rgba(0, 210, 255, 0.25);
  animation: rotateNote 6s linear infinite paused;
}

@keyframes rotateNote {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.music-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0; /* Prevents flex items containing text from expanding layout */
}

.music-title-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FFFFFF;
  text-overflow: ellipsis;
  overflow: hidden;
}

.music-artist-text {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-overflow: ellipsis;
  overflow: hidden;
  margin-top: 1px;
}

.music-controls-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 12px;
}

.music-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-ctrl-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-ctrl-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: rgba(0, 210, 255, 0.1);
  box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
}

.play-pause-btn {
  width: 32px;
  height: 32px;
  color: #FFFFFF;
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--color-accent);
}

.play-pause-btn:hover {
  color: #FFFFFF;
  background: var(--color-accent);
  box-shadow: var(--glow-accent);
}

.music-volume-box {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  flex: 1;
  max-width: 90px; /* Reduced to fit box boundaries */
  min-width: 0;
}

.volume-slider {
  width: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  cursor: pointer;
}

/* Spotify Logout Button Style */
.spotify-logout-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.spotify-logout-btn:hover {
  color: var(--color-target);
  background: rgba(255, 51, 102, 0.1);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 5px var(--color-accent);
  transition: transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* Spotify Connect Layout Styles */
.spotify-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.2);
  border-radius: 12px;
  z-index: 5;
}

.spotify-connect-btn {
  background: #1DB954;
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(29, 185, 84, 0.4);
}

.spotify-connect-btn:hover {
  background: #1ed760;
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(29, 185, 84, 0.6);
}

.spotify-connect-btn svg {
  fill: currentColor;
}

.spotify-album-art-container {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#spotify-album-art {
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
}

.dest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.dest-title {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--color-target);
  text-transform: uppercase;
}

.dest-close-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.dest-close-btn:hover {
  color: var(--color-danger);
}

.dest-body {
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.dest-stat {
  display: flex;
  flex-direction: column;
}

.dest-stat-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: #FFFFFF;
}

.dest-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* Sidebar Coordinates Widget */
.hud-widget-left-middle {
  top: 72px;
  left: 12px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coord-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.coord-val {
  color: #FFFFFF;
}

/* Pairing Overlay (QR Code Modal) */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 320px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #FFFFFF;
}

.qr-container {
  width: 180px;
  height: 180px;
  background: #FFFFFF;
  padding: 10px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,240,255,0.2);
}

.qr-container img {
  width: 100%;
  height: 100%;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.modal-close-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  color: #FFFFFF;
  padding: 8px 20px;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

/* Animations */
@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

@keyframes slideIn {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}

@keyframes scaleUp {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Map Dark Theme Override (Leaflet Stylesheet customizations) */
.leaflet-container {
  background: var(--bg-primary) !important;
}

.leaflet-bar {
  border: 1px solid var(--border-glass) !important;
  box-shadow: none !important;
  border-radius: 8px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: var(--bg-panel) !important;
  backdrop-filter: blur(10px) !important;
  color: var(--color-text) !important;
  border-bottom: 1px solid var(--border-glass) !important;
  transition: all 0.2s ease;
}

.leaflet-bar a:hover {
  background-color: var(--color-accent-dim) !important;
  color: var(--color-accent) !important;
}

/* Custom Marker Styling */
.current-pos-icon {
  width: 24px;
  height: 24px;
  background: var(--color-accent);
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: var(--glow-accent);
  position: relative;
  transition: transform 0.1s linear;
}

.current-pos-icon::after {
  content: '';
  position: absolute;
  top: -6px;
  left: 6px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid var(--color-accent);
}

.target-pos-icon {
  width: 32px;
  height: 32px;
  background: var(--color-target-dim);
  border: 2px solid var(--color-target);
  border-radius: 50%;
  box-shadow: var(--glow-target);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: pulse 1s infinite alternate;
}

.target-pos-icon::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--color-target);
  border-radius: 50%;
}


/* --- MOBILE CONTROLLER STYLING --- */
.mobile-body {
  overflow-y: auto;
  height: auto;
  padding: 16px;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mobile-card {
  padding: 20px;
}

.mobile-title {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: #FFFFFF;
}

.mobile-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 16px;
}

/* Search Bar styling */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: #FFFFFF;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(0,240,255,0.15);
}

.search-btn {
  background: var(--color-accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  width: 48px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.2s ease;
  font-size: 1.2rem;
}

.search-btn:hover {
  opacity: 0.9;
}

/* Search results dropdown */
.results-list {
  background: rgba(13, 17, 23, 0.9);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
  display: none;
  list-style: none;
}

.results-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.results-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-accent);
}

.results-item:last-child {
  border-bottom: none;
}

/* Map Preview (Phone) */
#phone-map {
  width: 100%;
  height: 250px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
}

/* Bottom Action Buttons */
.action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.action-btn-primary {
  background: var(--color-accent);
  color: var(--bg-primary);
  box-shadow: var(--glow-accent);
}

.action-btn-primary:disabled {
  background: var(--color-text-muted);
  color: var(--bg-primary);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.action-btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-glass);
  color: #FFFFFF;
}

.action-btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

.action-btn-danger {
  background: var(--color-target-dim);
  border: 1px solid var(--color-target);
  color: var(--color-target);
}

.action-btn-danger:hover {
  background: var(--color-target);
  color: #FFFFFF;
  box-shadow: var(--glow-target);
}

.coords-preview {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.2);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--border-glass);
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 10px;
}

/* Power Dropdown Menu */
.power-dropdown {
  position: relative;
  display: inline-block;
}

.power-btn {
  background: rgba(255, 51, 102, 0.1) !important;
  border-color: rgba(255, 51, 102, 0.4) !important;
  color: var(--color-target) !important;
}

.power-btn:hover {
  background: var(--color-target) !important;
  color: #FFFFFF !important;
  box-shadow: var(--glow-target) !important;
}

.power-menu {
  position: absolute;
  right: 0;
  top: 42px;
  width: 170px;
  display: none;
  flex-direction: column;
  padding: 8px;
  gap: 6px;
  z-index: 1000;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  background: rgba(13, 17, 23, 0.96) !important;
}

.power-menu.active {
  display: flex;
}

.menu-opt {
  background: transparent;
  border: none;
  color: var(--color-text);
  padding: 10px 14px;
  border-radius: 8px;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.menu-opt:hover {
  background: rgba(255, 255, 255, 0.06);
}

#shutdown-opt:hover {
  background: var(--color-target-dim) !important;
  color: var(--color-target) !important;
}
