/* ===== GLOBAL STYLES – Apple Maps–inspired, scalable ===== */

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
}

/* Design tokens – Apple Maps style (dark), scalable */
:root {
  /* Safe areas for notched devices / PWA */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* Colors */
  --bg-color: #1a1a1a;
  --panel-bg: rgba(44, 44, 46, 0.85);
  --panel-bg-solid: #2c2c2e;
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #ffffff;
  --text-secondary: #ebebf5;
  --text-muted: #8e8e93;
  --accent-color: #0a84ff;
  --accent-hover: #409cff;
  --panel-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --marker-color: #ff453a;
  --route-color: #0a84ff;
  --category-bg: rgba(44, 44, 46, 0.85);
  --category-border: rgba(255, 255, 255, 0.08);
  --category-text: #ffffff;
  --category-hover: rgba(255, 255, 255, 0.06);
  --direction-bg: rgba(44, 44, 46, 0.85);
  --direction-border: rgba(255, 255, 255, 0.08);
  --direction-text: #ffffff;
  --direction-hover: rgba(255, 255, 255, 0.06);
  --direction-active: #0a84ff;
  /* Scalable spacing & typography */
  --radius-sm: clamp(6px, 1.5vw, 8px);
  --radius-md: clamp(10px, 2vw, 12px);
  --radius-lg: clamp(12px, 2.5vw, 14px);
  --radius-xl: clamp(14px, 3vw, 18px);
  --space-xs: clamp(4px, 1vw, 6px);
  --space-sm: clamp(8px, 2vw, 12px);
  --space-md: clamp(12px, 2.5vw, 16px);
  --space-lg: clamp(16px, 3vw, 20px);
  --space-xl: clamp(20px, 4vw, 24px);
  --touch-min: 44px;
  --font-size-sm: clamp(12px, 2.5vw, 13px);
  --font-size-base: clamp(14px, 2.8vw, 15px);
  --font-size-lg: clamp(15px, 3vw, 17px);
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  /* Frosted glass */
  --glass-bg: rgba(44, 44, 46, 0.72);
  --glass-border: rgba(255, 255, 255, 0.1);
  --blur: 20px;
}

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

/* ===== GOOGLE MAPS-STYLE PANELS ===== */

/* Left Panel – Apple Maps style frosted card */
.left-panel {
  position: absolute;
  left: calc(20px + var(--safe-left));
  top: calc(20px + var(--safe-top));
  width: min(400px, calc(100vw - 40px - var(--safe-left) - var(--safe-right)));
  max-width: 100%;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: min(80vh, calc(100dvh - 40px - var(--safe-top) - var(--safe-bottom)));
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}


/* Categories Section */
.categories-section {
  padding: var(--space-md);
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.categories-section h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Right Panel – Apple Maps style frosted card */
.right-panel {
  position: absolute;
  right: calc(20px + var(--safe-right));
  top: calc(72px + var(--safe-top));
  width: min(350px, calc(100vw - 40px - var(--safe-left) - var(--safe-right)));
  max-width: 100%;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: min(80vh, calc(100dvh - 92px - var(--safe-top) - var(--safe-bottom)));
  animation: slideInRight 0.3s ease;
}

/* Transport Mode Controls */
.transport-section {
  padding: var(--space-md);
  border-bottom: 1px solid var(--direction-border);
}

.transport-section h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Route Information Panel */
.route-info-panel {
  padding: 16px;
  border-bottom: 1px solid var(--direction-border);
  display: none;
  /* Hidden by default, shown when route exists */
}

.route-info-panel h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--direction-text);
}

/* Controls Section */
.controls-section {
  padding: 16px;
  background: var(--direction-bg);
  border-top: 1px solid var(--direction-border);
}


/* Bottom Center Buttons Container – safe area & scalable */
.bottom-buttons-container {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0 var(--safe-left) var(--safe-bottom) var(--safe-right);
  z-index: 1000;
  max-width: min(100vw, 520px);
}

/* Map Controls - Bottom Left */
.map-controls-bottom-left {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  display: none;
  /* Hide the container box */
}

/* Map Controls - Bottom Right */
.map-controls-bottom-right {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: none;
  /* Hide the container box */
}

/* Override Leaflet default positions – zoom bottom-right, layers above zoom */
.leaflet-control-zoom {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  right: calc(20px + var(--safe-right));
  left: auto;
  z-index: 1000;
}

.leaflet-control-layers {
  position: absolute;
  bottom: calc(92px + var(--safe-bottom));
  right: calc(20px + var(--safe-right));
  z-index: 1000;
}

/* Apple Maps–style pill buttons – touch-friendly */
.gm-button {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  color: var(--direction-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 999px;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  box-shadow: var(--panel-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-width: max(120px, 44px);
  min-height: var(--touch-min);
}

.gm-button:hover {
  background: var(--direction-hover);
  border-color: var(--direction-border);
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.1);
}

.gm-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gm-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--direction-hover);
  border-color: var(--direction-border);
  color: var(--text-muted);
}

.gm-button.primary {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

.gm-button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.gm-button.secondary {
  background: var(--direction-bg);
  border-color: var(--direction-border);
  color: var(--direction-text);
}

.gm-button.danger {
  background: #ea4335;
  border-color: #ea4335;
  color: #fff;
}

.gm-button.danger:hover:not(:disabled) {
  background: #d3302f;
  border-color: #d3302f;
}

/* Hidden original panels */
.list-panel,
.control-panel {
  display: none;
}

/* ===== TRANSPORT BUTTONS – uniform size ===== */

.transport-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  align-items: stretch;
}

.transport-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--direction-text);
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  height: 48px;
  width: 100%;
  text-align: center;
  margin: 0;
  box-sizing: border-box;
}

.transport-btn:last-child {
  margin-bottom: 0;
}

.transport-btn:hover {
  background: var(--panel-hover);
  border-color: var(--glass-border);
}

.transport-btn.active {
  background: rgba(10, 132, 255, 0.2);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.transport-btn.driving.active {
  background: rgba(10, 132, 255, 0.2);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.transport-btn.walking.active {
  background: rgba(48, 209, 88, 0.2);
  border-color: #30d158;
  color: #30d158;
}

.transport-btn.cycling.active {
  background: rgba(255, 159, 10, 0.2);
  border-color: #ff9f0a;
  color: #ff9f0a;
}

.btn-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.btn-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  line-height: 1.2;
  text-align: center;
}

/* ===== RESPONSIVE DESIGN – mobile, tablet, desktop ===== */

@media (max-width: 1024px) {
  .left-panel {
    left: calc(10px + var(--safe-left));
    width: min(350px, calc(100vw - 20px - var(--safe-left) - var(--safe-right)));
  }

  .right-panel {
    right: calc(10px + var(--safe-right));
    width: min(300px, calc(100vw - 20px - var(--safe-left) - var(--safe-right)));
  }

  .bottom-buttons-container {
    bottom: calc(16px + var(--safe-bottom));
    gap: var(--space-xs);
  }
}

@media (max-width: 768px) {
  .left-panel {
    left: calc(10px + var(--safe-left));
    top: calc(10px + var(--safe-top));
    width: calc(100vw - 20px - var(--safe-left) - var(--safe-right));
    max-width: none;
    max-height: min(45vh, 50dvh);
  }

  .right-panel {
    right: calc(10px + var(--safe-right));
    top: calc(10px + var(--safe-top));
    width: calc(100vw - 20px - var(--safe-left) - var(--safe-right));
    max-width: none;
    max-height: min(50vh, 55dvh);
  }

  .bottom-buttons-container {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-xs);
    padding-left: calc(10px + var(--safe-left));
    padding-right: calc(10px + var(--safe-right));
  }

  .gm-button {
    min-width: 0;
    flex: 1 1 auto;
    padding: var(--space-sm);
    font-size: var(--font-size-sm);
  }
}

@media (max-width: 480px) {
  .left-panel {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-height: min(38vh, 42dvh);
    padding-top: var(--safe-top);
  }

  .right-panel {
    top: min(38vh, 42dvh);
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    max-height: min(50vh, 55dvh);
  }

  .bottom-buttons-container {
    bottom: calc(12px + var(--safe-bottom));
    left: calc(12px + var(--safe-left));
    right: calc(12px + var(--safe-right));
    transform: none;
    max-width: none;
  }

  .gm-button {
    flex: 1 1 0;
    min-width: 0;
  }

  /* Keep transport buttons uniform on small screens; allow label wrap if needed */
  .transport-btn {
    height: 48px;
    min-height: 48px;
  }

  .btn-label {
    white-space: normal;
    line-height: 1.15;
  }
}

/* Large screens – keep panels from getting too wide */
@media (min-width: 1400px) {
  .left-panel {
    width: 380px;
  }

  .right-panel {
    width: 340px;
  }
}

/* ===== CATEGORY LIST ITEMS ===== */

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm);
  margin-bottom: var(--space-xs);
  border-radius: var(--radius-sm);
  background: var(--panel-hover);
  transition: background 0.15s ease;
  min-height: var(--touch-min);
  box-sizing: border-box;
}

.list-item:hover {
  background: var(--category-hover);
}

.list-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.list-item label {
  cursor: pointer;
  flex: 1;
  font-size: 14px;
  color: var(--category-text);
  user-select: none;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
  padding: 8px;
  text-align: center;
}

/* ===== BUTTONS ===== */

.btn {
  width: 100%;
  padding: 10px 16px;
  margin-bottom: 8px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.btn:last-child {
  margin-bottom: 0;
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary {
  background: var(--direction-active);
  color: white;
}

.btn-primary:hover {
  background: #1557b0;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}

.btn-secondary {
  background: var(--direction-hover);
  color: var(--direction-text);
}

.btn-secondary:hover {
  background: #545b62;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
  background: var(--direction-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover:not(:disabled) {
  background: #138496;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(23, 162, 184, 0.3);
}

/* ===== MODAL ===== */

.custom-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s;
}

.custom-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  min-width: min(300px, calc(100vw - 40px));
  max-width: 500px;
  animation: slideIn 0.3s;
  border: 1px solid var(--glass-border);
}

.modal-content h3 {
  margin: 0 0 20px;
  color: var(--category-text);
  font-size: 20px;
  font-weight: 600;
}

.modal-content input {
  width: 100%;
  padding: 10px;
  margin-bottom: 20px;
  border: 2px solid var(--category-border);
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
  background: var(--category-bg);
  color: var(--category-text);
}

.modal-content input:focus {
  outline: none;
  border-color: var(--direction-active);
  background: var(--category-bg);
}

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

.modal-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.modal-buttons .btn-primary {
  background-color: var(--direction-active);
  color: white;
  width: auto;
}

.modal-buttons .btn-primary:hover {
  background-color: #1557b0;
  transform: none;
  box-shadow: none;
}

.modal-buttons .btn-secondary {
  background-color: var(--category-hover);
  color: var(--category-text);
  width: auto;
}

.modal-buttons .btn-secondary:hover {
  background-color: var(--category-hover);
  transform: none;
  box-shadow: none;
}

/* ===== ROUTING PANEL ===== */

.leaflet-routing-container-custom {
  position: absolute;
  right: 10px;
  top: 120px;
  left: auto;
  bottom: auto;
  width: 340px;
  max-height: calc(100vh - 160px);
  background: var(--direction-bg);
  border-radius: 8px;
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  font-family: inherit;
  z-index: 999;
  transition: transform 0.3s ease;
}

.leaflet-routing-container-custom.collapsed {
  transform: translateX(calc(100% + 50px));
}

.route-panel-toggle {
  position: absolute;
  left: -40px;
  top: 10px;
  width: 40px;
  height: 60px;
  background: var(--direction-bg);
  border: none;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font-size: 18px;
  color: var(--direction-text);
  transition: background 0.2s;
  z-index: 1;
}

.route-panel-toggle:hover {
  background: var(--direction-hover);
}

.transport-mode-toggle {
  display: flex;
  gap: 0;
  background: var(--direction-bg);
  border-bottom: 1px solid var(--direction-border);
  padding: 8px;
}

.transport-mode-toggle .mode-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--direction-border);
  background: var(--direction-bg);
  color: var(--direction-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  position: relative;
}

.transport-mode-toggle .mode-btn:first-child {
  border-radius: 4px 0 0 4px;
  border-right: none;
}

.transport-mode-toggle .mode-btn:last-child {
  border-radius: 0 4px 4px 0;
}

.transport-mode-toggle .mode-btn:hover {
  background: var(--direction-hover);
}

.transport-mode-toggle .mode-btn.active {
  background: rgba(10, 132, 255, 0.2);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.transport-mode-toggle .mode-btn.driving.active {
  background: rgba(10, 132, 255, 0.2);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.transport-mode-toggle .mode-btn.walking.active {
  background: rgba(48, 209, 88, 0.2);
  color: #30d158;
  border-color: #30d158;
}

.transport-mode-toggle .mode-btn.cycling.active {
  background: rgba(255, 159, 10, 0.2);
  color: #ff9f0a;
  border-color: #ff9f0a;
}

.leaflet-routing-container-custom h2,
.leaflet-routing-container-custom h3 {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--direction-text);
  background: var(--direction-bg);
  border-bottom: 1px solid var(--direction-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leaflet-routing-container-custom h3 {
  font-size: 15px;
  font-weight: 400;
  color: var(--direction-text);
  text-transform: none;
  letter-spacing: normal;
  padding: 12px 16px;
  border-bottom: none;
}

.leaflet-routing-container-custom table {
  width: 100%;
  border-collapse: collapse;
}

.leaflet-routing-container-custom tr {
  border-bottom: 1px solid var(--direction-border);
  transition: background 0.15s;
  cursor: pointer;
}

.leaflet-routing-container-custom tr:hover {
  background: var(--direction-hover);
}

.leaflet-routing-container-custom td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--direction-text);
  line-height: 1.6;
}

.leaflet-routing-container-custom .leaflet-routing-alt {
  padding: 16px;
  background: var(--direction-bg);
  border-bottom: 1px solid var(--direction-border);
  font-size: 13px;
  color: var(--direction-text);
}

.leaflet-routing-container-custom .leaflet-routing-alt h3 {
  padding: 0;
  margin-bottom: 4px;
  border: none;
  background: transparent;
  color: var(--direction-text);
  font-size: 24px;
  font-weight: 400;
}

.leaflet-routing-alternatives-container {
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  overflow-x: hidden;
}

.leaflet-routing-alternatives-container::-webkit-scrollbar {
  width: 8px;
}

.leaflet-routing-alternatives-container::-webkit-scrollbar-track {
  background: transparent;
}

.leaflet-routing-alternatives-container::-webkit-scrollbar-thumb {
  background: var(--direction-border);
  border-radius: 4px;
}

.leaflet-routing-alternatives-container::-webkit-scrollbar-thumb:hover {
  background: var(--direction-hover);
}

.leaflet-routing-container-custom .leaflet-routing-collapse-btn {
  display: none;
}

.leaflet-routing-container-custom .leaflet-routing-instruction {
  font-weight: 400;
  color: var(--direction-text);
}

.leaflet-routing-container-custom .leaflet-routing-distance {
  color: var(--direction-text);
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

/* ===== ENHANCED ROUTE PANEL ===== */

.enhanced-route-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 300px;
  background: var(--direction-bg);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
  border: 1px solid var(--direction-border);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.route-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--direction-border);
  background: var(--direction-bg);
  border-radius: 12px 12px 0 0;
}

.route-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--direction-text);
  font-weight: 600;
}

.close-route-panel {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--direction-text);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-route-panel:hover {
  background: var(--direction-hover);
}

.route-details {
  padding: 16px;
}

.route-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--direction-bg);
  border-radius: 8px;
}

.mode-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mode-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--direction-text);
}

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

.stat-item {
  background: var(--direction-bg);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--direction-border);
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--direction-text);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--direction-text);
}

/* ===== ROUTE ERROR ALERTS ===== */

.route-error-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 2px solid #dc3545;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.2);
  z-index: 2000;
  animation: slideDown 0.3s ease;
  max-width: 500px;
  width: 100%;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

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

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

.alert-message {
  flex: 1;
  font-size: 14px;
  color: #721c24;
  font-weight: 500;
}

.alert-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #dc3545;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.alert-close:hover {
  background: rgba(220, 53, 69, 0.1);
}

/* ===== ROUTE MARKERS ===== */

.route-marker-start,
.route-marker-end {
  z-index: 1000 !important;
}

/* ===== INLINE DIRECTIONS STYLES ===== */

.enhanced-transport-controls .directions-section {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--direction-border);
}

.enhanced-transport-controls .directions-header-inline {
  margin-bottom: 8px;
}

.enhanced-transport-controls .directions-header-inline h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--direction-text);
  cursor: pointer;
  transition: color 0.2s;
}

.enhanced-transport-controls .directions-header-inline h4:hover {
  color: var(--direction-active);
}

.enhanced-transport-controls .directions-list-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.enhanced-transport-controls .directions-list-inline .direction-step {
  background: var(--direction-bg);
  border: 1px solid var(--direction-border);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  transition: background 0.2s;
}

.enhanced-transport-controls .directions-list-inline .direction-step:hover {
  background: var(--direction-hover);
}

.enhanced-transport-controls .directions-list-inline .step-number {
  background: var(--accent-color);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.enhanced-transport-controls .directions-list-inline .step-content {
  flex: 1;
}

.enhanced-transport-controls .directions-list-inline .step-instruction {
  font-size: 13px;
  color: var(--direction-text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.enhanced-transport-controls .directions-list-inline .step-details {
  font-size: 11px;
  color: var(--direction-text);
}

.enhanced-transport-controls .directions-list-inline .step-distance {
  font-weight: var(--font-weight-semibold);
  color: var(--accent-color);
}

.enhanced-transport-controls .directions-list-inline .step-time {
  color: var(--direction-text);
}

.enhanced-transport-controls .directions-list-inline .no-directions {
  text-align: center;
  padding: 12px;
  color: var(--direction-text);
  font-size: 12px;
}

.enhanced-transport-controls .directions-list-inline .no-directions p {
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.enhanced-transport-controls .directions-list-inline .no-directions .note {
  font-style: italic;
  color: var(--text-muted);
  font-size: 11px;
}

/* ===== ENHANCED TRANSPORT CONTROLS ===== */

.enhanced-transport-controls {
  margin-top: 16px;
  padding: 16px;
  background: var(--direction-bg);
  border-radius: 12px;
  border: 1px solid var(--direction-border);
  box-shadow: var(--panel-shadow);
}

.transport-header {
  font-size: 12px;
  color: var(--direction-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transport-header::before {
  content: none;
}

.enhanced-transport-controls .transport-buttons {
  margin-bottom: 16px;
}

.enhanced-transport-controls .transport-btn {
  position: relative;
  overflow: hidden;
}

.enhanced-transport-controls .transport-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) to rgba(255, 255, 255, 0.3));
  transition: left 0.3s;
}

.enhanced-transport-controls .transport-btn:hover::before {
  left: 100%;
}

/* ===== INTEGRATED DIRECTIONS STYLES ===== */

.directions-section {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--direction-border);
  width: 100%;
}

.directions-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--direction-border), transparent);
  margin-bottom: 16px;
}

.directions-header-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
  background: var(--direction-bg);
  border-radius: 8px;
  border: 1px solid var(--direction-border);
  margin-bottom: 8px;
}

.directions-header-inline:hover {
  background: var(--direction-hover);
  border-color: var(--direction-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
}

.directions-header-inline h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--direction-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.directions-list-inline::-webkit-scrollbar {
  width: 6px;
}

.directions-list-inline::-webkit-scrollbar-track {
  background: var(--direction-hover);
  border-radius: 10px;
}

.directions-list-inline::-webkit-scrollbar-thumb {
  background: var(--direction-border);
  border-radius: 10px;
}

.directions-list-inline::-webkit-scrollbar-thumb:hover {
  background: var(--direction-hover);
}

.direction-step {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--direction-bg);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-color);
  transition: background 0.15s ease, box-shadow 0.15s ease;
  align-items: flex-start;
}

.direction-step:hover {
  background: var(--direction-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border-left-color: var(--direction-active);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--accent-color);
  color: #fff;
  border-radius: 50%;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  margin-top: 1px;
}

.step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-instruction {
  font-size: 13px;
  font-weight: 600;
  color: var(--direction-text);
  line-height: 1.4;
}

.step-details {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--direction-text);
  font-weight: 500;
}

.step-distance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.step-distance::before {
  content: none;
}

.step-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Marker proximity styling */
.marker-proximity {
  display: inline-block;
  background: var(--direction-bg);
  color: var(--direction-active);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--direction-border);
  margin-top: 4px;
}

.step-marker-info {
  margin-top: 4px;
}

.step-time::before {
  content: none;
}

.no-directions {
  padding: 16px;
  background: var(--direction-bg);
  border-radius: 8px;
  border: 1px solid var(--direction-border);
  text-align: center;
}

.no-directions p {
  margin: 8px 0;
  font-size: 12px;
  color: var(--direction-text);
  line-height: 1.4;
}

.no-directions p:first-child {
  margin-top: 0;
  font-weight: 600;
  color: var(--direction-text);
}

.no-directions .note {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
  .transport-buttons {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-xs);
  }

  .transport-btn {
    height: 44px;
    min-height: 44px;
    padding: var(--space-xs) var(--space-sm);
  }

  .btn-label {
    font-size: var(--font-size-sm);
  }

  .enhanced-route-panel {
    right: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    top: 10px;
  }

  .route-stats {
    grid-template-columns: 1fr;
  }

  .route-mode {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-panel,
  .control-panel {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
  }

  .list-panel {
    max-height: 25vh;
  }

  .control-panel {
    bottom: 50px;
  }

  .directions-list-inline {
    max-height: 250px;
  }

  .enhanced-transport-controls {
    padding: 12px;
  }

  .transport-header {
    font-size: 11px;
    margin-bottom: 10px;
  }

  .direction-step {
    padding: 8px;
    gap: 10px;
  }

  .step-number {
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 10px;
  }

  .step-instruction {
    font-size: 12px;
  }

  .step-details {
    font-size: 10px;
  }

  .modal-content {
    min-width: 280px;
    max-width: calc(100% - 40px);
    padding: 20px;
  }

  .leaflet-routing-container-custom {
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
    max-height: 45vh;
    top: auto;
    bottom: 50px;
  }

  .leaflet-routing-container-custom.collapsed {
    transform: translateY(calc(100% + 60px));
  }

  .route-panel-toggle {
    left: 50%;
    transform: translateX(-50%);
    top: -40px;
    width: 60px;
    height: 40px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
  }

  .leaflet-routing-alternatives-container {
    max-height: calc(45vh - 200px);
  }

  .transport-mode-toggle .mode-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}


/* ===== DIRECTIONS PANEL ===== */

.directions-panel {
  position: fixed;
  top: 20px;
  right: 320px;
  width: 350px;
  max-height: 80vh;
  background: var(--direction-bg);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
  z-index: 1000;
  animation: slideInRight 0.3s ease;
  border: 1px solid var(--direction-border);
  display: flex;
  flex-direction: column;
}

.directions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--direction-border);
  background: var(--direction-bg);
  border-radius: 12px 12px 0 0;
}

.directions-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--direction-text);
  font-weight: 600;
}

.close-directions {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--direction-text);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-directions:hover {
  background: var(--direction-hover);
}

.directions-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.directions-summary {
  background: var(--direction-bg);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--direction-border);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

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

.summary-label {
  font-size: 12px;
  color: var(--direction-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--direction-text);
}

.directions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.direction-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px;
  background: var(--direction-bg);
  border: 1px solid var(--direction-border);
  border-radius: 8px;
  transition: background 0.2s;
}

.direction-step:hover {
  background: var(--direction-hover);
}

.step-number {
  background: var(--direction-active);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content {
  flex: 1;
}

.step-instruction {
  font-size: 14px;
  color: var(--direction-text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.step-details {
  font-size: 12px;
  color: var(--direction-text);
}

.step-distance {
  font-weight: var(--font-weight-semibold);
  color: var(--accent-color);
}

.step-time {
  color: var(--direction-text);
}

.no-directions {
  text-align: center;
  padding: 20px;
  color: var(--direction-text);
}

.no-directions p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.note {
  font-style: italic;
  color: var(--text-muted);
  font-size: 12px;
}


/* ===== UI OVERLAP FIXES ===== */

/* Adjust control panel positioning to prevent overlap */
.control-panel {
  bottom: 20px;
  right: 20px;
  left: auto;
  width: 280px;
}

/* Adjust list panel to prevent overlap with map controls */
.list-panel {
  top: 20px;
  left: 20px;
  width: 280px;
}

/* Adjust route panel positioning */
.enhanced-route-panel {
  top: 20px;
  right: 680px;
}

/* Adjust directions panel for smaller screens */
@media (max-width: 1024px) {
  .directions-panel {
    right: 20px;
    width: calc(100vw - 40px);
    max-width: 500px;
  }

  .enhanced-route-panel {
    right: 540px;
  }
}

@media (max-width: 768px) {
  .directions-panel {
    right: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    top: 10px;
  }

  .enhanced-route-panel {
    right: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    top: 380px;
  }

  .control-panel {
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  .list-panel {
    top: 10px;
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }

  /* Adjust styles dropdown for mobile */
  .styles-dropdown-menu {
    left: 0;
    transform: none;
    min-width: 100%;
  }
}

/* ===== LEAFLET POPUP (marker menu) ===== */

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
}

.leaflet-popup-content {
  margin: 0;
  min-width: 260px;
  max-width: min(320px, calc(100vw - 32px));
}

.leaflet-popup-tip {
  background: var(--glass-bg);
}

/* ===== MARKER POPUP STYLES ===== */

.marker-popup-container {
  width: 100%;
  min-width: 0;
  padding: var(--space-md);
  font-family: inherit;
  color: var(--text-primary);
  box-sizing: border-box;
}

.marker-popup-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--direction-border);
}

.marker-popup-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--direction-text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.marker-popup-category {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  background: var(--direction-hover);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid var(--direction-border);
}

.marker-popup-coords {
  margin-bottom: 12px;
  padding: 8px;
  background: var(--direction-hover);
  border-radius: 6px;
  border: 1px solid var(--direction-border);
}

.coord-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
}

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

.coord-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.coord-value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--direction-active);
  background: var(--direction-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--direction-border);
}

.marker-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.popup-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-xs);
  border: 1px solid var(--glass-border);
  background: var(--panel-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--direction-text);
  text-align: center;
  min-height: var(--touch-min);
  box-sizing: border-box;
}

.popup-action-btn:hover {
  background: var(--direction-hover);
  border-color: var(--direction-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.popup-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.popup-action-btn .btn-text {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

/* Special styling for different action types */
.delete-btn:hover {
  background: rgba(235, 87, 87, 0.1);
  border-color: #eb5757;
  color: #ff9f9f;
}

.rename-btn:hover {
  background: rgba(10, 132, 255, 0.1);
  border-color: #0a84ff;
  color: #5ac8fa;
}

/* Saved POI popup wrapper — shown when clicking a saved marker that has POI data */
.saved-poi-popup-wrapper {
  display: flex;
  flex-direction: column;
}

.saved-poi-name-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(10, 132, 255, 0.08);
  border: 1px solid rgba(10, 132, 255, 0.25);
  border-radius: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.saved-poi-saved-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.saved-poi-saved-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.saved-poi-category-tag {
  font-size: 11px;
  background: rgba(10, 132, 255, 0.2);
  color: #5ac8fa;
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
}

.saved-poi-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--direction-border);
}


  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--direction-border);
}

.popup-close-btn {
  background: var(--direction-hover);
  border: 1px solid var(--direction-border);
  color: var(--direction-text);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-close-btn:hover {
  background: var(--direction-bg);
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-1px);
}

@media (max-width: 380px) {
  .marker-popup-actions,
  .saved-poi-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== MAP STYLES DROPDOWN ===== */
.map-styles-dropdown {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: calc(20px + var(--safe-left));
  z-index: 1000;
}

.map-styles-toggle {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  color: var(--direction-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: 999px;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  box-shadow: var(--panel-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 160px;
  min-height: var(--touch-min);
  justify-content: space-between;
}

.map-styles-toggle:hover {
  background: var(--direction-hover);
  border-color: var(--direction-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.map-styles-toggle:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.map-styles-toggle[aria-expanded="true"] {
  background: var(--panel-hover);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 2px 12px rgba(10, 132, 255, 0.25);
}

.map-styles-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.current-map-type {
  font-weight: 600;
  color: var(--direction-text);
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--direction-text);
}

.map-styles-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--panel-shadow);
  min-width: 180px;
  display: none;
  animation: slideUp 0.2s ease;
  z-index: 1001;
  max-height: min(300px, 50vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.map-styles-menu.open {
  display: block;
}

.map-type-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--direction-border);
}

.map-type-option:last-child {
  border-bottom: none;
}

.map-type-option:hover {
  background: var(--direction-hover);
}

.map-type-option.active,
.map-type-option[aria-selected="true"] {
  background: var(--panel-hover);
  color: var(--accent-color);
  font-weight: var(--font-weight-semibold);
}

.option-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.option-label {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

/* ===== POI POPUP STYLES ===== */

/* Override Leaflet popup to match app's frosted-glass dark theme */
.poi-popup .leaflet-popup-content-wrapper {
  background: rgba(30, 30, 32, 0.96);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  color: #ffffff;
  padding: 0;
  overflow: hidden;
}

.poi-popup .leaflet-popup-content {
  margin: 0;
  min-width: 260px;
  max-width: 400px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

.poi-popup .leaflet-popup-tip {
  background: rgba(30, 30, 32, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  border-left: none;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.poi-popup .leaflet-popup-close-button {
  color: var(--text-muted);
  font-size: 20px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  padding: 0;
  top: 8px;
  right: 8px;
  z-index: 10;
  transition: color 0.15s ease;
}

.poi-popup .leaflet-popup-close-button:hover {
  color: var(--text-primary);
}

/* POI Popup Container */
.poi-popup-container {
  padding: var(--space-md);
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.poi-popup-container::-webkit-scrollbar {
  width: 5px;
}

.poi-popup-container::-webkit-scrollbar-track {
  background: transparent;
}

.poi-popup-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* Header */
.poi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding-right: 24px;
}

.poi-name {
  font-size: clamp(16px, 3.5vw, 18px);
  font-weight: var(--font-weight-bold);
  color: #ffffff;
  line-height: 1.3;
  flex: 1;
}

.poi-category-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid;
  flex-shrink: 0;
  margin-top: 2px;
}

.poi-badge-other {
  background: rgba(142, 142, 147, 0.15);
  color: var(--text-muted);
  border-color: rgba(142, 142, 147, 0.3);
}

/* Coordinates */
.poi-coords {
  font-size: var(--font-size-sm);
  color: #a0a0a5;
  margin-bottom: var(--space-sm);
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  letter-spacing: 0.02em;
}

/* Rating */
.poi-rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.poi-stars {
  color: #ffcc00;
  font-size: 14px;
  letter-spacing: 1px;
}

.poi-rating-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: #ffffff;
}

.poi-review-count {
  font-size: var(--font-size-sm);
  color: #a0a0a5;
}

/* Tags */
.poi-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: var(--space-sm);
}

.poi-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 11px;
  color: #d0d0d5;
  white-space: nowrap;
  text-transform: capitalize;
  transition: background 0.15s ease;
}

.poi-tag:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Details */
.poi-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
  padding-top: var(--space-xs);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.poi-detail-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  line-height: 1.5;
}

.poi-detail-icon {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: 14px;
  padding-top: 1px;
}

.poi-detail-text {
  font-size: var(--font-size-sm);
  color: #e0e0e5;
  word-break: break-word;
}

.poi-detail-link {
  font-size: var(--font-size-sm);
  color: #409cff;
  text-decoration: none;
  word-break: break-all;
  transition: color 0.15s ease;
}

.poi-detail-link:hover {
  color: #6db6ff;
  text-decoration: underline;
}

/* Photos */
.poi-photos {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--space-xs);
  margin-bottom: var(--space-xs);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.poi-photos::-webkit-scrollbar {
  height: 4px;
}

.poi-photos::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.poi-photo {
  width: 100px;
  height: 75px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Loading State */
.poi-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
  font-size: var(--font-size-base);
  min-height: 80px;
}

.poi-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: poi-spin 0.8s linear infinite;
}

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

/* Fallback State */
.poi-fallback {
  text-align: center;
  padding: var(--space-lg);
}

.poi-fallback-icon {
  font-size: 32px;
  margin-bottom: var(--space-xs);
}

.poi-fallback-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.poi-fallback-message {
  font-size: var(--font-size-sm);
  color: #a0a0a5;
  margin-top: var(--space-xs);
}

/* Save Location Button */
.poi-save-section {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.poi-save-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.poi-category-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: var(--font-size-sm);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 38px;
  box-sizing: border-box;
}

.poi-category-input::placeholder {
  color: #6e6e73;
}

.poi-category-input:focus {
  border-color: rgba(10, 132, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.poi-save-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  background: rgba(10, 132, 255, 0.15);
  border: 1px solid rgba(10, 132, 255, 0.3);
  border-radius: 999px;
  color: #409cff;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
  white-space: nowrap;
}

.poi-save-btn:hover {
  background: rgba(10, 132, 255, 0.25);
  border-color: rgba(10, 132, 255, 0.5);
  color: #6db6ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(10, 132, 255, 0.2);
}

.poi-save-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.poi-save-icon {
  font-size: 16px;
}

/* Responsive adjustments for POI popup */
@media (max-width: 480px) {
  .poi-popup .leaflet-popup-content {
    min-width: 220px;
    max-width: calc(100vw - 60px);
  }

  .poi-popup-container {
    max-height: 340px;
  }

  .poi-name {
    font-size: 15px;
  }

  .poi-header {
    flex-direction: column;
    gap: var(--space-xs);
  }
}