/* ========================================
   TrafficAI - Modern Light Theme CSS
   Clean, Professional UI inspired by Google Maps
   ======================================== */

/* CSS Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #0ea5e9 100%);
  --primary-color: #0f766e;
  --primary-hover: #0d9488;
  --secondary-color: #0ea5e9;

  --bg-color: #edf8ff;
  --card-bg: rgba(255, 255, 255, 0.92);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border-color: #d5e5f2;
  --input-bg: #eff8ff;
  --input-focus: #ddf3ff;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
  
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Manrope', 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(820px 420px at 6% 6%, rgba(14, 165, 233, 0.17), transparent 68%),
    radial-gradient(760px 420px at 96% 8%, rgba(20, 184, 166, 0.14), transparent 66%),
    linear-gradient(180deg, #f7fcff 0%, var(--bg-color) 52%, #e7f4ff 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  backdrop-filter: blur(10px);
}

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

.logo-icon {
  font-size: 28px;
}

.logo h1 {
  font-family: 'Sora', 'Manrope', sans-serif;
  font-size: 25px;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  background: rgba(219, 234, 254, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.34);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background: rgba(15, 118, 110, 0.17);
  transform: translateY(-1px);
}

#status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  background: #ECFDF5;
}

#status-indicator.connected {
  color: var(--success);
}

#status-indicator.disconnected {
  color: var(--danger);
  background: #FEF2F2;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Container Layout */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px 0 40px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(520px, 92%);
  max-width: 520px;
  margin: 0 auto;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Search Card */
.search-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.search-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Input Groups */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
}

input[type="text"] {
  width: 100%;
  padding: 14px 14px 14px 44px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

input[type="text"]:hover {
  border-color: #CBD5E1;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--input-focus);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.location-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.location-btn {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: #dff7f4;
}

.location-btn.secondary {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.location-btn.secondary.active {
  color: #ffffff;
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

/* Select Wrapper */
.select-wrapper {
  position: relative;
}

select {
  width: 100%;
  padding: 14px 40px 14px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

select:hover {
  border-color: #CBD5E1;
}

select:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--input-focus);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.select-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Voice Button */
.voice-btn {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-btn:hover {
  background: var(--input-focus);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.voice-btn:active {
  transform: scale(0.98);
}

.voice-icon {
  font-size: 18px;
  animation: voicePulse 2s infinite;
}

@keyframes voicePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Primary Button */
.primary-btn {
  width: 100%;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: white;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.28);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(14, 116, 144, 0.3);
}

.primary-btn:active {
  transform: translateY(0);
}

/* Route Options */
.route-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-btn span {
  font-size: 20px;
}

.option-btn:hover {
  background: var(--input-focus);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.option-btn:active {
  transform: scale(0.97);
}

/* Info Cards */
.info-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.info-card.hidden {
  display: none;
}

.hidden {
  display: none;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-icon {
  font-size: 20px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.info-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-card ul {
  list-style: none;
}

.info-card ul li {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.info-card ul li:last-child {
  border-bottom: none;
}

.info-card ul li:hover {
  color: var(--primary-color);
  padding-left: 8px;
}

/* Congestion Badge */
#congestion-badge {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

#congestion-badge.low {
  background: #ECFDF5;
  color: var(--success);
}

#congestion-badge.medium {
  background: #FFFBEB;
  color: var(--warning);
}

#congestion-badge.high {
  background: #FEF2F2;
  color: var(--danger);
}

/* Progress Bar */
#progress-bar {
  height: 8px;
  background: var(--input-bg);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
  transition: width 0.8s ease;
}

/* Route Details */
#route-details {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
}

/* Advice Box */
#advice-box {
  padding: 14px;
  background: linear-gradient(135deg, #ecfeff 0%, #dff7ff 100%);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary-color);
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.analysis-section {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.analysis-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.analysis-section p {
  font-size: 13px;
  color: var(--text-secondary);
}

#route-compare-list,
#incident-list {
  list-style: none;
  padding-left: 0;
}

#route-compare-list li,
#incident-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

#route-compare-list li:last-child,
#incident-list li:last-child {
  border-bottom: none;
}

.smart-alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 13px;
}

.emergency-priority-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
}

.emergency-priority-modal.hidden {
  display: none;
}

.emergency-priority-modal-card {
  width: min(560px, 96%);
  border-radius: 14px;
  border: 2px solid #fecaca;
  background: linear-gradient(160deg, #fff1f2 0%, #fee2e2 100%);
  box-shadow: 0 20px 45px rgba(127, 29, 29, 0.32);
  padding: 22px;
  color: #7f1d1d;
}

.emergency-priority-modal-card h2 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.2;
}

.emergency-priority-modal-card p {
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
  color: #991b1b;
}

.emergency-priority-modal-card button {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  cursor: pointer;
}

.emergency-priority-modal-card button:hover {
  filter: brightness(0.95);
}

/* Traffic Graph Canvas */
#traffic-graph {
  width: 100%;
  height: 160px;
  min-height: 140px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
}

/* Map Section */
.map-section {
  position: relative;
  width: min(1200px, 92%);
  margin: 4px auto 40px;
  scroll-margin-top: 96px;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

#map {
  height: 70vh;
  min-height: 420px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.map-section.map-highlight #map {
  animation: mapHighlightPulse 1.1s ease;
}

.live-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 520;
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  opacity: 0.45;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.live-badge.active {
  opacity: 1;
}

.map-tools {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 520;
  min-width: 220px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(4px);
}

.map-tool-btn {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.map-tool-btn.active {
  border-color: #0f766e;
  color: #0f766e;
  background: #dff7f4;
}

.poi-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.poi-toggles label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
}

.poi-toggles input {
  accent-color: #0f766e;
}

@keyframes mapHighlightPulse {
  0% {
    box-shadow: var(--shadow-xl);
    border-color: var(--border-color);
  }
  35% {
    box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.18), var(--shadow-xl);
    border-color: rgba(15, 118, 110, 0.45);
  }
  100% {
    box-shadow: var(--shadow-xl);
    border-color: var(--border-color);
  }
}

/* Floating Action Button */
.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  background: var(--primary-gradient);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  z-index: 500;
}

.fab:hover {
  transform: scale(1.1) rotate(180deg);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.33);
}

.fab:active {
  transform: scale(1);
}

.locate-fab {
  right: 92px;
  font-size: 14px;
  font-weight: 600;
}

.locate-fab:hover {
  transform: scale(1.08);
}

.locate-fab.active {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
}

.future-traffic-box {
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
}

.future-traffic-box label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

#future-traffic-slider {
  width: 100%;
  accent-color: #0f766e;
}

#future-traffic-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.calendar-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.calendar-btn {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-secondary);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-btn:hover {
  border-color: #0f766e;
  color: #0f766e;
  background: #dff7f4;
}

.fatigue-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.fatigue-badge {
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid transparent;
}

.fatigue-badge.off {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.fatigue-badge.low {
  color: #065f46;
  background: #d1fae5;
  border-color: #6ee7b7;
}

.fatigue-badge.medium {
  color: #92400e;
  background: #fef3c7;
  border-color: #fbbf24;
}

.fatigue-badge.high {
  color: #991b1b;
  background: #fee2e2;
  border-color: #f87171;
}

#fatigue-risk {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.fatigue-meter {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  margin-bottom: 10px;
}

.fatigue-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10B981, #F59E0B, #EF4444);
  transition: width 0.35s ease;
}

.fatigue-actions {
  display: flex;
  gap: 10px;
  margin: 10px 0;
}

#fatigue-video {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #0f172a;
  display: none;
}

#fatigue-video.active {
  display: block;
}

#fatigue-alert-log {
  margin-top: 10px;
  font-size: 12px;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

@keyframes speakPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(15, 118, 110, 0.14);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(15, 118, 110, 0);
  }
}

.pulse {
  animation: speakPulse 0.9s infinite;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-secondary);
}

footer p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    gap: 20px;
    padding: 20px 0 32px;
  }

  .sidebar {
    width: min(560px, 92%);
    max-width: 560px;
  }

  .map-section {
    width: min(1200px, 94%);
  }

  #map {
    height: 62vh;
    min-height: 380px;
  }
}

@media (max-width: 768px) {
  header {
    padding: 14px 20px;
  }

  .header-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .logo h1 {
    font-size: 20px;
  }

  .container {
    padding: 16px 0 28px;
  }

  .sidebar {
    width: 94%;
    max-width: 94%;
  }

  .map-section {
    width: 94%;
    margin-bottom: 28px;
  }

  #map {
    height: 52vh;
    min-height: 320px;
  }

  .search-card {
    padding: 20px;
  }

  .route-options {
    grid-template-columns: repeat(3, 1fr);
  }

  .fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .locate-fab {
    right: 74px;
    font-size: 12px;
  }

  .map-tools {
    min-width: 200px;
    padding: 8px;
  }

  .poi-toggles {
    grid-template-columns: 1fr;
  }

  .live-badge {
    top: 12px;
    right: 12px;
  }

  .calendar-actions {
    flex-direction: column;
  }

  .fatigue-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  header {
    flex-direction: column;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  #status-indicator {
    font-size: 12px;
    padding: 6px 12px;
  }

  .user-pill {
    max-width: 170px;
    font-size: 11px;
  }

  .search-card h2 {
    font-size: 18px;
  }

  input[type="text"],
  select {
    padding: 12px 12px 12px 40px;
    font-size: 14px;
  }

  .primary-btn {
    padding: 14px;
    font-size: 15px;
  }

  .location-btn {
    width: 100%;
    text-align: center;
  }

  .option-btn {
    padding: 10px 6px;
    font-size: 12px;
  }

  .option-btn span {
    font-size: 18px;
  }

  .sidebar,
  .map-section {
    width: 94%;
    max-width: 94%;
  }

  #map {
    height: 48vh;
    min-height: 280px;
  }
}

/* Leaflet Map Customization */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  background: var(--card-bg) !important;
  color: var(--text-primary) !important;
  border: none !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--input-bg) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  box-shadow: none !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes formEntrance {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-card {
  animation: formEntrance 0.55s ease-out;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-card:hover {
  transform: translateY(-2px);
}

.info-card {
  animation: fadeIn 0.4s ease-out;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
  transform: translateY(-2px);
}

/* Loading State */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   Two-Panel Workspace Refactor
   ======================================== */

.offline-banner {
  margin: 12px 15px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  font-size: 13px;
  font-weight: 600;
}

.two-panel-layout {
  margin: 15px;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(320px, 34%) minmax(0, 66%);
  align-items: start;
  gap: 18px;
  padding: 0;
}

.control-sidebar {
  width: 100%;
  max-width: none;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  position: sticky;
  top: 86px;
}

.control-sidebar .search-card {
  padding: 20px;
  border-radius: 12px;
}

.workspace-panel {
  min-height: calc(100vh - 120px);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(239, 249, 255, 0.94) 100%);
  border: 1px solid rgba(148, 163, 184, 0.23);
  box-shadow: 0 12px 30px rgba(14, 116, 144, 0.16);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.workspace-splash,
.workspace-loader {
  min-height: 420px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 36px;
}

.workspace-splash h2 {
  font-size: 28px;
  margin-bottom: 8px;
  font-family: 'Sora', 'Manrope', sans-serif;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.workspace-splash p,
.workspace-loader p {
  color: var(--text-secondary);
  max-width: 520px;
}

.workspace-loader {
  gap: 10px;
}

.loader-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid #a7f3d0;
  border-top-color: #0f766e;
  animation: spin 0.8s linear infinite;
}

.workspace-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
}

.workspace-content.hidden,
.workspace-splash.hidden,
.workspace-loader.hidden {
  display: none !important;
}

.map-section {
  width: 100%;
  margin: 0;
  scroll-margin-top: 96px;
}

#map {
  min-height: 420px;
  height: 52vh;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 2px;
}

.features-grid .info-card {
  border-radius: 12px;
  border: none;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.ambulance-btn {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}

.ambulance-btn.active {
  border-color: #dc2626;
  color: #ffffff;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

#traffic-hotspot-list li,
#ev-list li,
#fuel-list li,
#police-list li,
#toll-list li {
  font-size: 13px;
  line-height: 1.45;
  border-bottom: 1px dashed #dbe4f0;
}

#traffic-hotspot-list li:last-child,
#ev-list li:last-child,
#fuel-list li:last-child,
#police-list li:last-child,
#toll-list li:last-child {
  border-bottom: none;
}

#toll-total {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
}

@media (max-width: 1180px) {
  .two-panel-layout {
    grid-template-columns: minmax(300px, 38%) minmax(0, 62%);
  }

  .features-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .two-panel-layout {
    grid-template-columns: 1fr;
    margin: 12px;
  }

  .control-sidebar {
    position: static;
    max-height: none;
  }

  .workspace-panel {
    min-height: 0;
  }

  .workspace-content {
    padding: 12px;
  }

  #map {
    height: 48vh;
    min-height: 320px;
  }

  .features-grid {
    max-height: none;
    overflow: visible;
  }
}

/* ========================================
   Accessibility + Theme + Autocomplete Enhancements
   ======================================== */

.theme-toggle-btn {
  border: 1px solid rgba(14, 116, 144, 0.25);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.09);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 12px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(14, 116, 144, 0.4);
  background: rgba(14, 165, 233, 0.16);
}

.theme-toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
}

.theme-icon {
  line-height: 1;
  font-size: 12px;
}

.input-group {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  z-index: 40;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  max-height: 248px;
  overflow-y: auto;
  padding: 6px;
}

.autocomplete-item {
  width: 100%;
  border: none;
  text-align: left;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  padding: 10px 10px;
  cursor: pointer;
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.autocomplete-item small {
  display: block;
  color: var(--text-muted);
  margin-top: 4px;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: rgba(14, 165, 233, 0.14);
}

.workspace-loader-skeleton {
  width: min(360px, 92%);
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.workspace-loader-skeleton span {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.25), rgba(226, 232, 240, 0.62), rgba(148, 163, 184, 0.25));
  background-size: 180% 100%;
  animation: skeletonSweep 1.2s ease-in-out infinite;
}

.workspace-loader-skeleton span:nth-child(1) { width: 92%; }
.workspace-loader-skeleton span:nth-child(2) { width: 74%; }
.workspace-loader-skeleton span:nth-child(3) { width: 84%; }

@keyframes skeletonSweep {
  0% { background-position: 180% 0; }
  100% { background-position: -20% 0; }
}

body[data-theme="dark"] {
  --bg-color: #0f172a;
  --card-bg: rgba(15, 23, 42, 0.92);
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #2b3a54;
  --input-bg: #111f36;
  --input-focus: #0f2f42;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 36px rgba(2, 6, 23, 0.55);
  --shadow-xl: 0 24px 50px rgba(2, 6, 23, 0.65);

  background:
    radial-gradient(820px 420px at 8% 8%, rgba(14, 165, 233, 0.14), transparent 70%),
    radial-gradient(760px 420px at 96% 8%, rgba(20, 184, 166, 0.1), transparent 66%),
    linear-gradient(180deg, #0b1221 0%, #0f172a 52%, #111827 100%);
}

body[data-theme="dark"] header {
  background: rgba(15, 23, 42, 0.84);
  border-bottom-color: rgba(51, 65, 85, 0.68);
}

body[data-theme="dark"] .user-pill {
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.88);
  border-color: rgba(56, 189, 248, 0.42);
}

body[data-theme="dark"] .logout-btn {
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(15, 118, 110, 0.28);
}

body[data-theme="dark"] .logout-btn:hover {
  background: rgba(15, 118, 110, 0.42);
}

body[data-theme="dark"] .search-card,
body[data-theme="dark"] .features-grid .info-card,
body[data-theme="dark"] .workspace-panel {
  border-color: rgba(51, 65, 85, 0.65);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-primary);
}

body[data-theme="dark"] .workspace-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88) 0%, rgba(15, 23, 42, 0.96) 100%);
}

body[data-theme="dark"] .offline-banner {
  color: #fed7aa;
  background: rgba(124, 45, 18, 0.28);
  border-color: rgba(251, 146, 60, 0.52);
}

body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] select {
  color: var(--text-primary);
  border-color: var(--border-color);
  background: var(--input-bg);
}

body[data-theme="dark"] .location-btn {
  background: rgba(15, 23, 42, 0.74);
  color: #cbd5e1;
  border-color: rgba(100, 116, 139, 0.55);
}

body[data-theme="dark"] .location-btn:hover {
  color: #99f6e4;
  border-color: rgba(45, 212, 191, 0.55);
  background: rgba(20, 184, 166, 0.17);
}

body[data-theme="dark"] .location-btn.secondary {
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.56);
  background: rgba(30, 64, 175, 0.24);
}

body[data-theme="dark"] #status-indicator {
  background: rgba(15, 118, 110, 0.2);
}

body[data-theme="dark"] #status-indicator.disconnected {
  background: rgba(127, 29, 29, 0.32);
}

body[data-theme="dark"] #traffic-hotspot-list li,
body[data-theme="dark"] #ev-list li,
body[data-theme="dark"] #fuel-list li,
body[data-theme="dark"] #police-list li,
body[data-theme="dark"] #toll-list li {
  border-bottom-color: rgba(71, 85, 105, 0.5);
}

body[data-theme="dark"] #map {
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.55);
}

body[data-theme="dark"] .workspace-loader-skeleton span {
  background: linear-gradient(90deg, rgba(71, 85, 105, 0.45), rgba(148, 163, 184, 0.45), rgba(71, 85, 105, 0.45));
}

@media (max-width: 900px) {
  .header-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .theme-toggle-btn {
    padding: 7px 10px;
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10000;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary-color);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(14, 165, 233, 0.55);
  outline-offset: 2px;
}

.fab,
.location-btn,
.primary-btn,
.option-btn,
.voice-btn,
.logout-btn,
.map-tool-btn,
.calendar-btn {
  min-height: 44px;
  min-width: 44px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
