/* ==========================================================================
   BlindWalk Design System & Aesthetic Styling
   Theme: AMOLED Dark, Emerald Forest Accents, Glassmorphism & High-Contrast
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-darkest: #070a11;
  --bg-darker: #0d121f;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --bg-glass: rgba(15, 23, 42, 0.7);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.4);

  /* Brand Accents */
  --emerald-primary: #10b981;
  --emerald-hover: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --cyan-accent: #06b6d4;
  --amber-dirt: #f59e0b;
  --amber-glow: rgba(245, 158, 11, 0.2);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverse: #020617;

  /* Elevation & Shadows */
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.35);

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 440px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-darkest);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 40%),
              var(--bg-darkest);
}

/* ==========================================================================
   Header Styling
   ========================================================================== */
.app-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 12px var(--emerald-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-beta {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-primary);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.airgap-active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--emerald-primary);
  box-shadow: 0 0 8px var(--emerald-primary);
  animation: pulse-green 2s infinite ease-in-out;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Button System
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-primary) 0%, var(--emerald-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 8px var(--emerald-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

.btn-secondary {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-accent);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.btn-secondary:hover {
  background: rgba(6, 182, 212, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-zero-screen {
  background: rgba(244, 63, 94, 0.1);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-zero-screen:hover {
  background: rgba(244, 63, 94, 0.2);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.3);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Workspace Grid (Left Sidebar + Right Map Area)
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* Control Panel */
.control-panel {
  background: var(--bg-darker);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Custom Scrollbar */
.control-panel::-webkit-scrollbar {
  width: 6px;
}
.control-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

/* Cards */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  transition: border-color 0.2s ease;
}

.panel-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Query Input Group */
.query-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(7, 10, 17, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
}

.query-input-group:focus-within {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-glow);
}

#promptInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  resize: none;
  line-height: 1.4;
}

#promptInput::placeholder {
  color: var(--text-dim);
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 8px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  color: var(--emerald-primary);
  background: rgba(16, 185, 129, 0.1);
}

/* Preset Chips */
.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.preset-chip {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--emerald-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   Metrics Card
   ========================================================================== */
.metrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.badge-accent {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-accent);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.metric-box {
  background: rgba(7, 10, 17, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 2px 0;
}

.highlight-green {
  color: var(--emerald-primary);
}

.metric-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Surface Breakdown */
.surface-breakdown {
  margin-bottom: 14px;
}

.breakdown-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.breakdown-bar {
  display: flex;
  height: 6px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.bar-dirt {
  background: var(--amber-dirt);
}
.bar-paved {
  background: var(--cyan-accent);
}

.sim-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* ==========================================================================
   Turn-by-Turn Instructions List
   ========================================================================== */
.instructions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.badge-steps {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(7, 10, 17, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.step-card.active-step {
  background: rgba(16, 185, 129, 0.1);
  border-color: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-glow);
}

.step-icon-box {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--emerald-primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.step-body {
  flex: 1;
}

.step-instruction {
  font-size: 0.8rem;
  color: var(--text-main);
  line-height: 1.35;
}

.step-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.step-tag {
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.step-dist {
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   Map Container
   ========================================================================== */
.map-container {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--bg-darkest);
}

#campusMap {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Floating HUDs on Map */
.map-floating-overlay {
  position: absolute;
  z-index: 400;
  pointer-events: none;
}

.map-floating-overlay > * {
  pointer-events: auto;
}

.map-floating-overlay.top-left {
  top: 16px;
  left: 16px;
}

.map-floating-overlay.top-right {
  top: 16px;
  right: 16px;
}

.map-floating-overlay.bottom-center {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
}

.map-floating-overlay.bottom-left {
  bottom: 24px;
  left: 20px;
}

.map-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}

/* Location Selector & Global Search */
.location-search-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 310px;
}

.location-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.location-preset-dropdown {
  background: rgba(7, 10, 17, 0.7);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  outline: none;
  width: 100%;
  cursor: pointer;
}

.location-preset-dropdown:focus {
  border-color: var(--emerald-primary);
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(7, 10, 17, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}

.search-input-wrap:focus-within {
  border-color: var(--cyan-accent);
}

.search-input-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.76rem;
  width: 100%;
  font-family: var(--font-sans);
}

.search-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  color: var(--cyan-accent);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan-accent);
  box-shadow: 0 0 8px var(--cyan-accent);
}

.layer-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.layer-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.layer-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Live Step HUD */
.hud-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-active);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg), 0 0 20px var(--emerald-glow);
  min-width: 380px;
  max-width: 540px;
  transition: all 0.3s ease;
}

.hud-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--emerald-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hud-details {
  flex: 1;
}

.hud-step-num {
  font-size: 0.68rem;
  color: var(--emerald-primary);
  font-weight: 700;
  text-transform: uppercase;
}

.hud-instruction {
  font-size: 0.86rem;
  font-weight: 500;
  color: #fff;
}

.hud-distance {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

/* Oscilloscope Container */
.oscilloscope-container {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.oscillo-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.sound-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-primary);
}

/* ==========================================================================
   Zero-Screen Sensory AMOLED Modal
   ========================================================================== */
.zero-screen-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.zero-screen-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.zero-screen-backdrop {
  position: absolute;
  inset: 0;
  background-color: #000000;
}

.zero-screen-content {
  position: relative;
  z-index: 2001;
  width: 90%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 32px;
}

.zero-screen-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zero-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fb7185;
}

.pulse-dot.red {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f43f5e;
  box-shadow: 0 0 10px #f43f5e;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.btn-close-zero {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 600;
}

.btn-close-zero:hover {
  background: rgba(255, 255, 255, 0.15);
}

.radar-box {
  position: relative;
  width: 480px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sensory-cue-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sensory-step-index {
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--emerald-primary);
}

.sensory-cue-text {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffffff;
  max-width: 720px;
}

.sensory-telemetry {
  display: flex;
  justify-content: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.sensory-controls {
  display: flex;
  gap: 16px;
}

.sensory-btn {
  padding: 14px 24px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: var(--radius-md);
}

.sensory-btn.primary {
  background: var(--emerald-primary);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 25px var(--emerald-glow);
}

.sensory-btn:hover {
  transform: scale(1.03);
}

.sensory-footer {
  font-size: 0.75rem;
  color: #475569;
}

/* ==========================================================================
   Audio Settings Dialog
   ========================================================================== */
.settings-modal {
  margin: auto;
  border: none;
  background: transparent;
  padding: 0;
  outline: none;
}

.settings-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.modal-card {
  background: var(--bg-darker);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 440px;
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
}

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

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

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-item label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.setting-item input[type="range"] {
  accent-color: var(--emerald-primary);
}

.form-select {
  background: var(--bg-darkest);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 960px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }
  .control-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .map-container {
    height: 480px;
  }
}
