:root {
  --primary: #f37021;
  --secondary: #00aeef;
  --surface: rgba(255, 255, 255, 0.85);
  --text: #1a1a1a;
  --text-muted: #555;
  --radius: 20px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  /* More subtle shadow */
  --glass-border: rgba(255, 255, 255, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #eaddd7;
}

/* Loader Overlay */
#loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out, visibility 0.3s;
  opacity: 1;
  visibility: visible;
}

#loader-overlay.hidden-loader {
  opacity: 0;
  visibility: hidden;
}


#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.top-ui {
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.glass {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

.search-container {
  margin: 0 14px;
  border-radius: 30px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.search-container.active {
  border-radius: 20px;
}

#search-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: transparent;
  font-size: 16px;
  outline: none;
  border-radius: 30px;
  color: var(--text);
  font-weight: 500;
}

#search-input::placeholder {
  color: #888;
}

#search-results {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--surface);
  border-radius: 0 0 20px 20px;
}

#search-results.active {
  display: block;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  max-height: 250px;
  overflow-y: auto;
}

#search-results li {
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 15px;
  font-weight: 500;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  text-align: left;
}

#search-results li:last-child {
  border-bottom: none;
}

#search-results li:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chips-container {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 0 14px 5px 14px;
  scrollbar-width: none;
  width: 100%;
}

.chips-container::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  /* Subtler chip shadow */
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.chip-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-color: #1e1e1e;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  margin-right: 6px;
}

.chip:hover {
  background: white;
}

.chip.active {
  background: #dbf1ff;
  border: 1px solid var(--secondary);
  color: var(--text);
}

.result-badge {
  background: var(--secondary);
  color: white;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.location-btn {
  position: absolute;
  right: 16px;
  bottom: 120px;
  /* Initial fallback, will be JS-controlled */
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #007b8b;
  transition: transform 0.2s, background 0.2s;
}

.location-btn:active {
  transform: scale(0.95);
  background: #f0f0f0;
}

.location-btn svg {
  width: 24px;
  height: 24px;
}

.bottom-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  border-radius: 28px 28px 0 0;
  z-index: 20;
  transition: transform 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
  padding: 12px 24px 34px 24px;
  transform: translateY(calc(100vh - 100px));
  /* Rest state */
  will-change: transform;
}

.bottom-sheet.expanded {
  border-radius: 0;
}

.sheet-handle {
  width: 32px;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  margin: 0 auto 16px auto;
}

.hidden {
  display: none !important;
}

.sheet-content h2 {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 700;
}

.sheet-content p {
  font-size: 15px;
  font-weight: 500;
}

.sheet-content strong {
  color: #333;
}

/* Elevated Reference Markers */
.reference-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  z-index: 100 !important;
}

.marker-bubble {
  background: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  white-space: nowrap;
  border: 2.5px solid var(--primary);
  transform-origin: bottom center;
  transition: transform 0.2s;
}

.reference-marker:hover .marker-bubble {
  transform: translateY(-5px) scale(1.05);
  background: #fff8f4;
}

.marker-stalk {
  width: 3px;
  height: 60px; /* Fixed height for elevation effect over buildings */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background: linear-gradient(to top, rgba(243, 112, 33, 0), rgba(243, 112, 33, 1));
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px;
  width: 100%;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary-btn:hover {
  background: #d9621b;
}

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

/* Mapbox specific overrides for better look */
.mapboxgl-ctrl-geolocate {
  display: none !important; /* Hide default Mapbox geolocate button */
}

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
  bottom: 10px;
}

@media (min-width: 768px) {
  .bottom-sheet {
    bottom: 20px;
    left: 20px;
    width: 380px;
    border-radius: var(--radius);
    padding: 24px;
  }

  .bottom-sheet.hidden {
    transform: translateX(-120%);
  }

  .sheet-handle {
    display: none;
  }

  .top-ui {
    left: 20px;
    width: 380px;
  }
}

/* Compass position offset & Styling */
.mapboxgl-ctrl-top-right {
  top: 120px !important;
  right: 14px !important;
}

.mapboxgl-ctrl-top-right .mapboxgl-ctrl-group {
  border-radius: 50% !important;
  box-shadow: var(--shadow) !important;
  border: 1px solid var(--glass-border) !important;
  overflow: hidden;
}


/* Static HTML Markers */
.metro-marker {
  width: 24px;
  height: 24px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
  background-image: url('../assets/svg/MetroLogo.svg');
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

/* Close/Cancel button for route */
.close-btn {
  width: 32px;
  height: 32px;
  background-color: #f0f0f0;
  /* Blanco oscuro / humo */
  color: #000;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  padding: 0;
  line-height: normal;
}

.close-btn:hover {
  background-color: #e0e0e0;
}

.close-btn:active {
  transform: scale(0.9);
}

#route-sheet-content h2 {
  font-size: 20px;
  /* Adjusting for 10 min (700 m) format */
  color: #333;
}
/* --- Optimized / Consolidated Styles --- */

.toast {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  z-index: 1000;
  transition: opacity 0.5s, transform 0.5s;
  font-weight: 500;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toast.error {
  background: rgba(200, 50, 50, 0.95);
}

.custom-marker {
  width: 24px;
  height: 24px;
  background-color: var(--primary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

.active-pointer {
  width: 32px;
  height: 42px;
  background-image: url('../assets/icons/pointer.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 10;
}

.weather-pill {
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-links {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.quick-links::-webkit-scrollbar {
  display: none;
}

.quick-link-item {
  padding: 15px;
  border-radius: 12px;
  min-width: 120px;
  text-align: center;
  transition: transform 0.2s, background 0.2s;
  cursor: pointer;
}

.quick-link-item:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

.quick-link-icon {
  font-size: 20px;
  margin-bottom: 5px;
}

.quick-link-label {
  font-size: 12px;
  font-weight: 600;
}

/* POI Sheet Header with Close Button */
.poi-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.poi-sheet-header h2 {
  margin-bottom: 0;
  flex: 1;
}

.poi-close-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background-color: #f2f2f2;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
}

.poi-close-btn:hover {
  background-color: #e0e0e0;
}

.poi-close-btn:active {
  transform: scale(0.9);
}

/* Search Sheet Styles */
.search-sheet-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.back-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.search-inputs-group {
  flex: 1;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.input-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
}

.input-row input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  color: var(--text);
}

.input-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin-left: 40px;
}

.dot-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-icon.origin {
  border: 2px solid #5f6368;
}

.dot-icon.destination {
  background: var(--primary);
  border: 2px solid var(--primary);
}

.search-sheet-body {
  margin-top: 10px;
}

.quick-actions-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.action-chip {
  background: #dbecff;
  color: #1a73e8;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-chip:hover {
  background: #c2e0ff;
}

.history-section h3 {
  font-size: 13px;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  transition: background 0.2s;
  border-radius: 8px;
}

.history-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.history-icon {
  width: 40px;
  height: 40px;
  background: #f1f3f4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  flex-shrink: 0;
}

.history-info {
  display: flex;
  flex-direction: column;
}

.history-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.history-details {
  font-size: 12px;
  color: #5f6368;
}

#sheet-search-results {
  position: absolute;
  top: 180px;
  left: 24px;
  right: 24px;
  background: white;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 12px;
  max-height: 400px;
  overflow-y: auto;
}
