/* ============================================
   ADS-B Flight Tracker - Professional Dark Theme
   ============================================ */

:root {
  --bg-primary: #0a0e14;
  --bg-secondary: #1a1f2e;
  --bg-tertiary: #252b3b;
  --text-primary: #e6e6e6;
  --text-secondary: #8b9cb5;
  --text-muted: #5c6a7d;
  --accent-blue: #00d4ff;
  --accent-green: #00ff88;
  --accent-orange: #ff9500;
  --accent-red: #ff3b5c;
  --accent-yellow: #ffdd00;
  --glass-bg: rgba(26, 31, 46, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

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

/* Status Bar */
#status-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 100;
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.status-label {
  color: var(--text-secondary);
}

.status-connected {
  color: var(--accent-green);
  font-weight: 600;
}

.status-disconnected {
  color: var(--accent-red);
  font-weight: 600;
}

/* Info Panel */
#info-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: 360px;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

#info-panel.collapsed {
  width: 48px;
}

.panel-toggle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.panel-toggle:hover {
  color: var(--accent-blue);
}

#info-panel.collapsed .panel-toggle svg {
  transform: rotate(180deg);
}

.panel-content {
  padding: 20px;
  padding-left: 48px;
  height: 100%;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.2s ease;
}

#info-panel.collapsed .panel-content {
  opacity: 0;
  pointer-events: none;
}

/* Panel Empty State */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}

.panel-empty svg {
  opacity: 0.5;
  margin-bottom: 16px;
}

.panel-empty p {
  font-size: 14px;
}

/* Aircraft Header */
.aircraft-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.aircraft-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 1px;
}

.hex-code {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Flight Route Display */
.flight-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.route-airport {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.route-arrow {
  color: var(--accent-green);
  flex-shrink: 0;
}

/* Hex/Decoded values */
.hex-value {
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--accent-blue);
}

.decoded-value {
  color: var(--text-secondary);
  font-style: italic;
}

.emergency-value {
  color: var(--accent-red) !important;
  font-weight: 700;
  font-style: normal !important;
}

/* Last seen section */
.last-seen-section {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
  margin-top: 12px;
}

/* Airport Info Panel */
.airport-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.airport-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-yellow);
  margin-bottom: 8px;
  line-height: 1.3;
}

.airport-codes {
  display: flex;
  gap: 8px;
}

.airport-code {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
}

.airport-code.icao {
  background: var(--bg-tertiary);
  color: var(--accent-yellow);
}

.airport-code.iata {
  background: var(--accent-yellow);
  color: var(--bg-primary);
}

/* Runway list */
.runway-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.runway-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border-left: 3px solid var(--accent-yellow);
}

.runway-id {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.runway-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.runway-detail {
  display: flex;
  gap: 4px;
}

.runway-detail-label {
  color: var(--text-muted);
}

.runway-lighted {
  color: var(--accent-yellow);
}

.no-runways {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

/* Info Sections */
.info-section {
  margin-bottom: 20px;
}

.info-section h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-item.full-width {
  grid-column: span 2;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
}

.info-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

/* External Info Loading */
.external-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Status Flags */
.status-flags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.status-flag {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--accent-orange);
  color: var(--bg-primary);
}

.status-flag.emergency {
  background: var(--accent-red);
  animation: pulse 1s ease-in-out infinite;
}

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

.last-seen {
  font-size: 12px;
  color: var(--text-muted);
}

/* Legend */
#legend {
  position: absolute;
  bottom: 160px;
  left: 16px;
  z-index: 100;
  padding: 12px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

#legend h4 {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Mapbox overrides */
.mapboxgl-ctrl-logo {
  opacity: 0.5;
}

.mapboxgl-ctrl-attrib {
  opacity: 0.5;
  font-size: 10px;
}

.mapboxgl-popup {
  z-index: 200;
}

.mapboxgl-popup-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.mapboxgl-popup-close-button {
  color: var(--text-secondary);
  font-size: 16px;
  padding: 4px 8px;
}

.mapboxgl-popup-tip {
  border-top-color: var(--glass-bg);
}

/* Aircraft markers */
.aircraft-marker {
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.aircraft-marker:hover {
  transform: scale(1.2);
}

.aircraft-marker.selected {
  filter: drop-shadow(0 0 8px var(--accent-blue));
}

/* Map control buttons */
#map-controls {
  position: absolute;
  top: 16px;
  right: 400px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-control-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.map-control-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.map-control-btn:active {
  transform: scale(0.95);
}

.map-control-btn.active {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.1);
}

.map-control-btn.locating {
  color: var(--accent-blue);
  animation: pulse 1s ease-in-out infinite;
}

/* Legacy locate button class for compatibility */
.locate-btn {
  width: 44px;
  height: 44px;
}

@media (max-width: 768px) {
  #map-controls {
    top: auto;
    bottom: 50%;
    right: 8px;
    flex-direction: column;
  }

  .map-control-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  #map-controls {
    bottom: 55%;
    right: 4px;
  }

  .map-control-btn {
    width: 36px;
    height: 36px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  #map-controls {
    top: 16px;
    right: 340px;
    bottom: auto;
    flex-direction: row;
  }
}

/* User location marker */
.user-marker {
  width: 20px;
  height: 20px;
  background: var(--accent-blue);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(0, 212, 255, 0.3);
  animation: user-pulse 2s ease-in-out infinite;
}

@keyframes user-pulse {
  0%, 100% {
    box-shadow: 0 0 0 8px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 0 16px rgba(0, 212, 255, 0.1);
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

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

/* Responsive adjustments for tablets */
@media (max-width: 768px) {
  #status-bar {
    left: 8px;
    top: 8px;
    padding: 8px 12px;
    gap: 12px;
  }

  .status-item {
    font-size: 11px;
  }

  #info-panel {
    width: 100%;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    border-radius: 16px 16px 0 0;
  }

  #info-panel.collapsed {
    height: 48px;
    width: 100%;
  }

  .panel-toggle {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 48px;
  }

  .panel-toggle svg {
    transform: rotate(90deg);
  }

  #info-panel.collapsed .panel-toggle svg {
    transform: rotate(-90deg);
  }

  .panel-content {
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 48px;
  }

  #legend {
    bottom: auto;
    top: 60px;
    left: 8px;
    padding: 8px 10px;
  }

  #legend h4 {
    font-size: 9px;
  }

  .legend-item {
    font-size: 9px;
  }
}

/* Responsive adjustments for phones */
@media (max-width: 480px) {
  #status-bar {
    left: 4px;
    right: 4px;
    top: 4px;
    padding: 6px 10px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .status-item {
    font-size: 10px;
    gap: 4px;
  }

  .status-label {
    display: none;
  }

  #info-panel {
    height: 50%;
    border-radius: 12px 12px 0 0;
  }

  #info-panel.collapsed {
    height: 40px;
  }

  .panel-toggle {
    height: 40px;
  }

  .panel-content {
    padding: 44px 12px 12px 12px;
  }

  .aircraft-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
  }

  .aircraft-header h2 {
    font-size: 20px;
  }

  .info-section {
    margin-bottom: 14px;
  }

  .info-section h3 {
    font-size: 10px;
    margin-bottom: 8px;
  }

  .info-grid {
    gap: 8px;
  }

  .info-label {
    font-size: 10px;
  }

  .info-value {
    font-size: 13px;
  }

  #legend {
    top: 50px;
    left: 4px;
    padding: 6px 8px;
    border-radius: 8px;
  }

  #legend h4 {
    font-size: 8px;
    margin-bottom: 4px;
  }

  .legend-item {
    font-size: 8px;
    gap: 4px;
    margin-bottom: 2px;
  }

  .legend-color {
    width: 8px;
    height: 8px;
  }

  /* Hide some legend items on very small screens */
  .legend-item:nth-child(odd):not(:first-child):not(:last-child) {
    display: none;
  }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
  .panel-toggle {
    min-height: 44px;
  }

  .aircraft-marker {
    min-width: 44px;
    min-height: 44px;
  }

  /* Larger touch targets */
  .status-flag {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* ============================================
   Timeline
   ============================================ */

.timeline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: rgba(26, 31, 46, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
}

.timeline-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.timeline-ticks {
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
}

.timeline-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Consolas', monospace;
  white-space: nowrap;
}

.timeline-track {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.timeline-progress {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 3px;
  width: 100%;
  pointer-events: none;
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 100%;
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: box-shadow 0.2s ease;
  z-index: 2;
}

.timeline-thumb:hover,
.timeline.dragging .timeline-thumb {
  box-shadow: 0 0 0 6px rgba(0, 212, 255, 0.3);
  cursor: grabbing;
}

.timeline-time {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

.timeline-speed-group {
  display: flex;
  gap: 2px;
  margin-right: 4px;
}

.timeline-speed-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'SF Mono', 'Consolas', monospace;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.timeline-speed-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.timeline-speed-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: var(--bg-primary);
}

.timeline-live-btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid var(--text-muted);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.timeline-live-btn.live-active {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: white;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255, 59, 92, 0); }
}

/* ============================================
   Type Filter Panel
   ============================================ */

.type-filter-panel {
  position: fixed;
  z-index: 200;
  width: 260px;
  max-height: 480px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.type-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-filter-actions {
  display: flex;
  gap: 6px;
}

.type-filter-action {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.type-filter-action:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.type-filter-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}

.type-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.type-filter-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.type-filter-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-green);
  flex-shrink: 0;
}

.type-filter-label {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.type-filter-count {
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
}

/* ============================================
   Emergency Panel
   ============================================ */

.emergency-panel {
  position: fixed;
  z-index: 200;
  width: 320px;
  max-height: 500px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.emergency-panel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.emergency-panel-list {
  max-height: 440px;
  overflow-y: auto;
  padding: 4px 0;
}

.emergency-panel-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.emergency-event-item {
  padding: 10px 14px;
  border-left: 3px solid var(--accent-red);
  margin: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 59, 92, 0.05);
  cursor: pointer;
  transition: background 0.15s ease;
}

.emergency-event-item:hover {
  background: rgba(255, 59, 92, 0.12);
}

.emergency-event-item.active {
  background: rgba(255, 59, 92, 0.15);
  border-left-color: var(--accent-red);
}

.emergency-event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.emergency-event-callsign {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Consolas', monospace;
}

.emergency-event-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 59, 92, 0.2);
  color: var(--accent-red);
}

.emergency-event-type.emergency-active {
  background: var(--accent-red);
  color: white;
  animation: pulse 1s ease-in-out infinite;
}

.emergency-event-details {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.emergency-event-hex {
  font-family: 'SF Mono', 'Consolas', monospace;
}

.emergency-event-model {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Emergency badge on button */
.emergency-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  background: var(--accent-red);
  color: white;
  border-radius: 8px;
}

/* Make emergency button relative for badge positioning */
#emergency-btn {
  position: relative;
}

/* ============================================
   Responsive: Timeline
   ============================================ */

@media (max-width: 768px) {
  .timeline {
    height: 40px;
    padding: 0 8px;
  }

  .timeline-ticks {
    display: none;
  }

  .timeline-time {
    font-size: 10px;
    min-width: 50px;
  }

  .timeline-speed-btn {
    padding: 3px 6px;
    font-size: 10px;
  }

  .timeline-live-btn {
    padding: 3px 8px;
    font-size: 10px;
  }

  /* Adjust legend to not overlap timeline */
  #legend {
    bottom: auto;
  }
}

@media (max-width: 480px) {
  .timeline {
    height: 36px;
    padding: 0 6px;
  }

  .timeline-time {
    display: none;
  }

  .type-filter-panel,
  .emergency-panel {
    width: calc(100vw - 16px);
    left: 8px;
    right: 8px;
    top: auto !important;
    bottom: 48px !important;
    max-height: 50vh;
  }
}

/* Landscape mode on phones */
@media (max-height: 500px) and (orientation: landscape) {
  #info-panel {
    width: 320px;
    height: 100%;
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    border-radius: 0;
  }

  #info-panel.collapsed {
    width: 40px;
    height: 100%;
  }

  .panel-toggle {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 40px;
    height: 60px;
  }

  .panel-toggle svg {
    transform: rotate(0deg);
  }

  #info-panel.collapsed .panel-toggle svg {
    transform: rotate(180deg);
  }

  .panel-content {
    padding-left: 44px;
    padding-top: 12px;
  }

  #legend {
    top: auto;
    bottom: 8px;
    left: 8px;
  }

  #status-bar {
    max-width: calc(100% - 340px);
  }
}
