/* ══════════════════════════════════════════
   VARIABLES & RESET
══════════════════════════════════════════ */
:root {
  /* Colores — existentes */
  --primary: #ff6b35;
  --primary-dark: #e85a28;
  --verified: #ff9500;
  --event1: #00b4d8;
  --event2: #9b5de5;
  --gray: #6b7280;
  --gray-light: #e5e7eb;
  --gray-dark: #374151;
  --white: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.2);

  /* Colores — nuevos tokens para valores hardcodeados */
  --winner-gold: #efb810;
  --location-blue: #007aff;
  --link-blue: #1a73e8;
  --gray-hover: #dfe1e6;
  --gray-btn-hover: #d1d5db;
  --bg-light: #f9fafb;

  /* Tipografía */
  --font-family: 'Montserrat', sans-serif;

  /* Z-index */
  --z-map: 1;
  --z-controls: 999;
  --z-overlay: 1000;
  --z-top: 1001;
  --z-modal: 2000;
  --z-max: 9999;

  /* Bordes */
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 35px;
  --radius-full: 50%;

  /* Transición */
  --transition: all 0.2s ease;
  --transition-slow: all 0.3s ease;

  /* Botones de acción */
  --btn-size: 48px;
  --btn-size-mobile: 44px;
}

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

body {
  font-family: var(--font-family);
  overflow: hidden;
  height: 100vh;
  background: var(--bg-light);
}

/* ══════════════════════════════════════════
   HOME BUTTON
══════════════════════════════════════════ */
.home-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: var(--z-top);
  width: var(--btn-size);
  height: var(--btn-size);
  background: var(--gray-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  text-decoration: none;
  box-shadow: 0 4px 12px var(--shadow-lg);
  transition: var(--transition);
}

.home-button:hover {
  background: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-lg);
}

.home-button svg {
  width: 24px;
  height: 24px;
}

/* ══════════════════════════════════════════
   LANGUAGE SWITCHER
══════════════════════════════════════════ */
.lang-switcher {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  color: var(--gray-dark);
  cursor: pointer;
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  appearance: none;
  padding: 0;
  pointer-events: auto !important;
  text-align: center;
  line-height: 1;
}

.lang-switcher:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.lang-switcher:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.lang-switcher:active {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.lang-switcher option {
  background: var(--white);
  color: var(--gray-dark);
  font-weight: 600;
  padding: 8px;
}

/* Desktop: lang-switcher en vertical con top-bar */
@media (min-width: 769px) {
  .top-bar {
    display: flex;
    flex-direction: column;
    pointer-events: none;
  }

  .top-btn {
    pointer-events: auto;
  }

  .lang-switcher {
    order: 4; /* Al final después de los botones */
  }
}

/* Mobile: lang-switcher en la derecha */
@media (max-width: 768px) {
  .lang-switcher {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    z-index: var(--z-overlay);
  }

  .top-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* ══════════════════════════════════════════
   LEGEND TOGGLE BUTTON (mobile only)
══════════════════════════════════════════ */
.legend-toggle {
  display: none; /* Hidden on desktop */
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: var(--z-controls);
  width: var(--btn-size);
  height: var(--btn-size);
  background: var(--primary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--white);
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-lg);
  transition: var(--transition);
}

.legend-toggle:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.legend-toggle svg {
  width: 24px;
  height: 24px;
}

/* ══════════════════════════════════════════
   LEGEND PANEL
══════════════════════════════════════════ */
.legend-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-overlay);
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 280px;
  max-width: 320px;
  box-shadow: 0 4px 20px var(--shadow-lg);
}

.legend-close {
  display: none; /* Hidden on desktop */
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: var(--gray-light);
  border: none;
  border-radius: var(--radius-full);
  color: var(--gray-dark);
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
}

.legend-close:hover {
  background: var(--gray);
  color: var(--white);
}

.legend-close svg {
  width: 18px;
  height: 18px;
}

.legend-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-light);
}

.legend-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-dark);
  margin-bottom: 8px;
}

.legend-total {
  font-size: 0.875rem;
  color: var(--gray);
  font-weight: 500;
}

/* Island Buttons */
.legend-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray);
  margin-top: 16px;
  margin-bottom: 8px;
}

.legend-section-title:first-of-type {
  margin-top: 0;
}

.legend-islands,
.legend-contests {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.island-btn,
.contest-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--gray-light);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-dark);
  cursor: pointer;
  transition: var(--transition);
}

.island-btn:hover {
  background: var(--gray-hover);
  transform: translateX(2px);
}

.island-btn.active,
.contest-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary-dark);
}

.island-count,
.contest-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  min-width: 28px;
  text-align: center;
}

.island-btn.active .island-count,
.contest-btn.active .contest-count {
  background: rgba(255, 255, 255, 0.3);
}

/* Winners Only Button */
.winners-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--gray-light);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-dark);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  pointer-events: auto;
}

.winners-btn:hover {
  background: var(--gray-hover);
  transform: translateX(2px);
}

.winners-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary-dark);
}

.winners-btn .winners-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.winners-count {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  min-width: 28px;
  text-align: center;
}

.winners-btn.active .winners-count {
  background: rgba(255, 255, 255, 0.3);
}

#btnWinnersOnly i {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  color: var(--gray-dark);
  flex-shrink: 0;
}

#btnWinnersOnly.active i {
  color: var(--white);
}

#btnWinnersOnly:active {
  transform: scale(0.98);
}

/* Clear Filters Button */
.btn-clear-filters {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--gray-light);
  border: 2px solid var(--gray);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-dark);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-clear-filters:hover {
  background: var(--gray);
  color: var(--white);
  border-color: var(--gray-dark);
}

.btn-clear-filters svg {
  width: 18px;
  height: 18px;
}

/* Legend Icons */
.legend-icons {
  padding-top: 16px;
  border-top: 2px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-icon-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--gray);
  font-weight: 500;
}

/* ══════════════════════════════════════════
   My Location button
══════════════════════════════════════════ */
.locate-btn {
  position: fixed;
  top: 20px;
  left: 75px;
  z-index: var(--z-top);
  width: var(--btn-size);
  height: var(--btn-size);
  background: var(--gray-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  text-decoration: none;
  box-shadow: 0 4px 12px var(--shadow-lg);
  transition: var(--transition);
  border: 0;
  cursor: pointer;
}

@media (max-width: 768px) {
  .locate-btn {
    top: 12px;
    left: 62px;
    width: 44px;
    height: 44px;
  }
}

.locate-btn:hover {
  box-shadow: 0 6px 16px var(--shadow-lg);
}

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

.locate-btn.pulsing {
  animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4); }
}

/* ══════════════════════════════════════════
   MAP
══════════════════════════════════════════ */
#map {
  width: 100%;
  height: 100vh;
  position: relative;
}

/* Custom Leaflet Markers with Emojis */
.custom-marker-icon {
  background: transparent !important;
  border: none !important;
}

.marker-lucide {
  width: 32px;
  height: 32px;
  background: var(--white);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.marker-lucide svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  stroke-width: 2.5;
}

.marker-lucide:hover {
  transform: scale(1.15);
}

.marker-lucide.marker-selected {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px var(--primary), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.marker-lucide.marker-winner {
  background: var(--winner-gold); /* Dorado para ganadora */
  animation: bounce 2s infinite;
}

.marker-lucide .lucide-trophy {
  color: var(--white);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Legend emoji preview */
.legend-icon-item .marker-emoji {
  font-size: 20px;
  text-shadow: none;
}

.badge-winner {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffb74d;
}

.badge-price {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
}

.badge-km0 {
  background: #f1f8e9;
  color: #558b2f;
  border: 1px solid #aed581;
}

.popup-restaurant {
  font-size: 0.9rem;
  color: var(--gray);
  font-weight: 600;
  margin-bottom: 8px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  padding: 0 !important;
  box-shadow: 0 8px 24px var(--shadow-lg) !important;
  font-family: var(--font-family) !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  min-width: 260px;
  max-width: 320px;
}

.leaflet-popup-content p {
  margin: 0 0 10px 0;
}

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

.leaflet-container a {
    color: var(--gray-dark);
}

.leaflet-container a.leaflet-popup-close-button{
  font: 23px/30px Tahoma, Verdana, sans-serif;
  right: 5px;
  font-weight: 600;
  top: 9px;
  right: 9px;
  width: 32px;
  height: 32px;
  background: var(--gray-light);
  border: none;
  border-radius: var(--radius-full);
  color: #4e4e4e;
}

/* Clusters personalizados */
.marker-cluster-winner {
  margin-left: -20px !important;
  margin-top: -20px !important;
  width: 40px !important;
  height: 40px !important;
  background-color: rgba(255, 107, 53, 0.6);
  transform: translate3d(194px, 503px, 0px);
  z-index: 503;
  opacity: 1;
}

.marker-cluster-small {
  background-color: rgba(255, 107, 53, 0.6);
}

.marker-cluster-winner div,
.marker-cluster-small div {
  background-color: rgba(255, 107, 53, 0.8);
  color: white;
  font-weight: 700;
  font-family: var(--font-family);
}

.marker-cluster-medium {
  background-color: rgba(255, 107, 53, 0.7);
}

.marker-cluster-medium div {
  background-color: rgba(255, 107, 53, 0.9);
  color: white;
  font-weight: 700;
}

.marker-cluster-large {
  background-color: rgba(255, 107, 53, 0.8);
}

.marker-cluster-large div {
  background-color: rgb(255, 107, 53);
  color: white;
  font-weight: 700;
}

/* ══════════════════════════════════════════
   User Dot for Location
══════════════════════════════════════════ */
.user-dot {
  width: 14px;
  height: 14px;
  background: var(--location-blue);
  border-radius: var(--radius-full);
  border: 3px solid white;
  box-shadow: 0 0 0 6px rgba(0, 122, 255, 0.3);
}

/* ══════════════════════════════════════════
   NEAREST BURGER CARD
══════════════════════════════════════════ */
.nearest-burger-card {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: var(--z-overlay);
  width: 280px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nearest-burger-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.nearest-burger-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
  margin-bottom: 6px;
}

.nearest-burger-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.nearest-burger-restaurant {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 6px;
}

.nearest-burger-distance {
  font-size: 14px;
  font-weight: 700;
  color: var(--link-blue);
}

.nearest-burger-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--gray);
  color: var(--white);
  cursor: pointer;
  opacity: 0.6;
  z-index: var(--z-max);
  cursor: pointer;
  transition: var(--transition);
  width: 32px;
  height: 32px;
}

.nearest-burger-close:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .nearest-burger-card {
    left: 12px;
    right: 12px;
    bottom: 25px;
    width: 80%;
  }
  .nearest-burger-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ══════════════════════════════════════════
   MODAL (for mobile/detailed view)
══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-modal);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 12px 40px var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-dark);
  transition: var(--transition);
  z-index: 10;
}

.modal-close:hover {
  background: var(--gray);
  color: var(--white);
}

/* ══════════════════════════════════════════
   POPUP / MODAL CONTENT
══════════════════════════════════════════ */

/* Imagen de la burger en popup */
.popup-image {
  width: 100%;
  height: 130px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popup-header {
  width: calc(100% + 32px);
  margin: -16px -16px 12px -16px;
  height: 120px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md) 12px 0 0;
  position: relative;
}

.popup-header-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.popup-header-overlay .popup-title {
  color: white;
  margin: 0;
  font-size: 1.2rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.popup-header-overlay .popup-restaurant {
  color: rgba(255,255,255,0.9);
  margin: 2px 0 0 0;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
  .popup-header {
    height: 200px;
  }
}

/* Ajustar el popup para la imagen */
.custom-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
}

.popup-inner {
  padding: 16px;
}

.popup-title {
  margin-top: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-dark);
  line-height: 1.3;
  padding-right: 30px;
}

.popup-address {
  font-size: 0.85rem;
  color: var(--gray);
  margin-bottom: 12px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.popup-address svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--primary);
}

.popup-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-verified {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffb74d;
}

.badge-contest {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #81c784;
}

.popup-divider {
  height: 1px;
  background: var(--gray-light);
  margin: 14px 0;
}

.popup-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.popup-btn svg {
  width: 18px;
  height: 18px;
}

.popup-btn-primary {
  background: var(--primary);
  color: var(--white) !important;
}

.popup-btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.popup-btn-secondary {
  background: var(--gray-light);
  color: var(--gray-dark);
}

.popup-btn-secondary:hover {
  background: var(--gray-btn-hover);
}

.popup-btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

/* ══════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .home-button {
    top: 12px;
    left: 12px;
    width: 44px;
    height: 44px;
  }

  /* Show toggle button on mobile */
  .legend-toggle {
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Legend panel - hidden by default on mobile */
  .legend-panel {
    top: 0;
    right: -100%;
    bottom: 0;
    left: auto;
    width: 85%;
    max-width: 320px;
    min-width: 0;
    border-radius: 0;
    padding: 20px;
    transition: right var(--transition-slow);
    overflow-y: auto;
    box-shadow: -4px 0 20px var(--shadow-lg);
    z-index: var(--z-max);
  }

  /* Show legend when active */
  .legend-panel.active {
    right: 0;
  }

  /* Show close button on mobile */
  .legend-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .legend-header h2 {
    font-size: 1.1rem;
  }

  .island-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* Move zoom controls to bottom-right on mobile */
  .leaflet-control-zoom {
    margin-bottom: 45px !important;
    margin-right: 10px !important;
  }
}

/* Desktop - move zoom controls away from home button */
@media (min-width: 769px) {
  .leaflet-control-zoom {
    margin-top: 80px !important; /* Below home button */
  }
}

/* ══════════════════════════════════════════
   ACCESSIBILITY
══════════════════════════════════════════ */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════
   MEJORA 5: LEYENDA PERMANENTE
══════════════════════════════════════════ */

.legend-permanent {
  position: fixed;
  z-index: var(--z-controls);  
  border-radius: var(--radius-xl);
  padding: 8px 12px;
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-dark);
  text-shadow: 
    0 0 3px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 255, 255, 0.7);
}

/* Móvil: abajo izquierda */
@media (max-width: 768px) {
  .legend-permanent {
    left: 0px;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
  }
}

/* Desktop: abajo derecha */
@media (min-width: 769px) {
  .legend-permanent {
    bottom: 24px;
    right: 10px;
    flex-direction: column;
    align-items: self-end;
    gap: 5px;
  }

  .legend-perm-item {
    flex-direction: row-reverse;
  }
}

.legend-perm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-perm-item svg {
    stroke-width: 2.5;
    background: var(--white);
    height: 25px;
    width: 25px;
    border-radius: 25px;
    padding: 4px;
}

.legend-perm-item:first-child svg {
  color: var(--primary);
}

.legend-perm-item:last-child svg {
  color: #fbbf24;
}

/* ══════════════════════════════════════════
   NEAREST BURGER COMPACTO
══════════════════════════════════════════ */
.nearest-burger-compact {
  position: fixed;
  z-index: var(--z-controls);
  color: var(--gray-dark);
  display: flex;
  align-items: baseline;  
  gap: 8px; 
  cursor: pointer;
  transition: var(--transition-slow);
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 90vw;
  text-shadow: 
    0 0 3px rgba(255, 255, 255, 0.9),
    0 0 8px rgba(255, 255, 255, 0.7);
}

.nearest-burger-compact:hover {
  transform: scale(1.02);
  text-decoration: underline;
}

.nearest-title {
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  
}

.nearest-restaurant {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-dark);
}

.nearest-burger {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
}

.nearest-distance {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Móvil: abajo izquierda, encima de leyenda */
@media (max-width: 768px) {
  .nearest-burger-compact {
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: calc(100vw - 70px);
  }
  /* Ajustar leyenda para que no se solape */
  .legend-permanent {
    top: 60px;
  }
}

/* Desktop: abajo izquierda */
@media (min-width: 769px) {
  .nearest-burger-compact {
    bottom: 15px;
    left: 60px;
    max-width: 400px;
  }
}

/* ══════════════════════════════════════════
   USER LOCATION ARROW
══════════════════════════════════════════ */

.user-location-arrow {
  background: transparent !important;
  border: none !important;
}

.user-location-arrow div {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-location-arrow svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Ocultar botón de locate cuando hay tracking activo (opcional) */
.locate-btn.tracking {
  background: var(--primary);
  color: white;
}


/* ══════════════════════════════════════════
   V2.0 - NEW COMPONENTS
══════════════════════════════════════════ */

/* ─── Top Bar ─── */
.top-bar {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.top-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  pointer-events: auto;
  transition: var(--transition);
}

.top-btn:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.05);
}

.top-btn svg {
  width: 24px;
  height: 24px;
  color: var(--gray-dark);
}

.top-btn:first-child {
  background: var(--primary);
}

.top-btn:first-child svg {
  color: white;
}

/* Mobile: top-bar horizontal */
@media (max-width: 768px) {
  .top-bar {
    flex-direction: row;
    left: 10px;
    right: 16px;
    width: auto;
  }

  .top-btn {
    width: 44px;
    height: 44px;
  }

  .top-btn svg {
    width: 22px;
    height: 22px;
  }
}

/* ─── Search Panel ─── */
.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: var(--z-modal);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  display: none;  /* Oculto por defecto */
}

.search-panel.active {
  transform: translateY(0);
  display: block;  /* Visible cuando active */
}

.search-header {
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--gray-light);
}

.search-close {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.search-close svg {
  width: 24px;
  height: 24px;
  color: var(--gray);
}

.search-input {
  flex: 1;
  height: 40px;
  border: none;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-dark);
  background: transparent;
  outline: none;
}

.search-input::placeholder {
  color: var(--gray);
}

.search-results {
  overflow-y: auto;
  max-height: calc(100vh - 73px);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-light);
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: rgba(255, 107, 53, 0.05);
}

.search-result-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--primary);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-burger {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--gray-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-burger strong,
.search-result-restaurant strong {
  font-weight: 800;
  color: var(--primary);
}

.search-result-restaurant {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--gray);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--gray);
  font-weight: 500;
}

/* ─── Nearest Burger con Degradado ─── */
.nearest-burger-compact {
  position: fixed;
  z-index: var(--z-controls);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-slow);
  font-size: 0.85rem;
  max-width: 90vw;
}

.nearest-gradient {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 75%;
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(255, 255, 255, 0) 100%);
  backdrop-filter: blur(8px);
  z-index: -1;
  border-radius: 8px 0 0 8px;
}

.nearest-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  position: relative;
}

.nearest-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray);
  white-space: nowrap;
}

.nearest-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.3;
}

.nearest-restaurant {
  font-weight: 700;
  color: var(--gray-dark);
}

.nearest-burger {
  font-weight: 600;
  color: var(--gray);
}

.nearest-distance {
  font-weight: 700;
  color: #ff6b35;
}

.nearest-separator {
  color: var(--gray);
  font-weight: 400;
}

.nearest-burger-compact:hover {
  transform: scale(1.02);
}

@media (max-width: 768px) {
  .nearest-burger-compact {
    bottom: env(safe-area-inset-bottom, 0);
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    padding: 0;
  }

  .nearest-gradient {
    border-radius: 0;
  }

  .nearest-content {
    width: 100%;
    padding: 12px 16px;
  }

  /* Cuando el bottom sheet está activo, ocultar */
  body.bottom-sheet-active .nearest-burger-compact {
    display: none;
  }
}

@media (min-width: 769px) {
  .nearest-burger-compact {
    bottom: 24px;
    left: 60px;
    max-width: 400px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  }

  .nearest-burger-compact .nearest-gradient {
    display: none;
  }
}

/* ─── Bottom Sheet (Mobile) ─── */
.bottom-sheet {
  position: fixed;
  left: env(safe-area-inset-left, 0);
  right: env(safe-area-inset-right, 0);
  bottom: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1500;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: calc(90vh - env(safe-area-inset-top, 0px));
  display: none;
  will-change: transform;
  touch-action: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-sheet.active {
  display: block;
}

.bottom-sheet.peek {
  transform: translateY(calc(100% - 140px));
}

.bottom-sheet.half {
  transform: translateY(calc(100% - 65vh));
}

.bottom-sheet.full {
  transform: translateY(max(10px, env(safe-area-inset-top, 10px)));
}

.bottom-sheet-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: max(18px, env(safe-area-inset-top, 18px)) 0 12px;
  cursor: grab;
  touch-action: none;
}

.bottom-sheet-handle::after {
  content: '';
  display: block;
  width: 40px;
  height: 5px;
  background: var(--gray-btn-hover);
  border-radius: 3px;
  transition: background 0.15s;
}

.bottom-sheet-handle:active {
  cursor: grabbing;
}

.bottom-sheet-handle:active::after {
  background: #9ca3af;
}

.bottom-sheet-content {
  overflow-y: auto;
  max-height: calc(90vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 25px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.bs-hero {
  position: relative;
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center;
  border-radius: 20px 20px 0 0;
}

.bs-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 20px 16px;
  background: linear-gradient(to top, 
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.5) 60%,
    transparent 100%);
}

.bs-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  margin: 0 0 4px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
}

.bs-restaurant {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.bs-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}

.bs-action-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.bs-action-btn:active {
  transform: scale(0.95);
}

.bs-action-btn svg {
  width: 18px;
  height: 18px;
  color: var(--gray-dark);
}

.bs-body {
  padding: 20px;
}

.bs-address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 0;
}

.bs-address svg {
  width: 14px;
  height: 14px;
  color: var(--gray);
  flex-shrink: 0;
  margin-top: 2px;
}

.bs-address span {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--gray);
  line-height: 1.4;
}

.bs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.bs-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.bs-btn {
  padding: 11px 10px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.bs-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.bs-btn-primary:active {
  background: var(--primary-dark);
}

.bs-btn-secondary {
  background: var(--gray-light);
  color: var(--gray-dark);
}

.bs-btn-secondary:active {
  background: var(--gray);
  color: white;
}

/* Ocultar bottom sheet en desktop */
@media (min-width: 769px) {
  .bottom-sheet {
    display: none !important;
  }
}

/* ─── Desktop Popup con Hero Header ─── */
@media (min-width: 769px) {
  .popup-header {
    width: calc(100% + 32px);
    margin: -16px -16px 12px -16px;
    height: 140px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md) 12px 0 0;
    position: relative;
  }

  .popup-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  }

  .popup-header-overlay .popup-title {
    color: white;
    margin: 0;
    font-size: 1.2rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  .popup-header-overlay .popup-restaurant {
    color: rgba(255,255,255,0.9);
    margin: 2px 0 0 0;
    font-size: 0.85rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  .popup-expand-photo {
    position: absolute;
    top: 9px;
    left: 9px;
    width: 32px;
    height: 32px;
    background: var(--gray-light);
    border: none;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--z-overlay);
    transition: background 0.15s ease;
  }

  .popup-expand-photo:hover {
    background: #e0e0e0;
  }

  .popup-expand-photo svg {
    width: 15px;
    height: 15px;
    color: #4e4e4e;
  }
}

/* Ajustar iconos más grandes en móvil */
@media (max-width: 768px) {
  .marker-lucide {
    width: 48px;
    height: 48px;
  }
  
  .marker-lucide svg {
    width: 30px;
    height: 30px;
  }
}


/* ══════════════════════════════════════════
   FIXES v2.1
══════════════════════════════════════════ */

/* Mobile-only elements */
.mobile-only {
  display: flex;
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* Desktop: Legend panel always visible on RIGHT */
@media (min-width: 769px) {
  .legend-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 320px;
    transform: translateX(0) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    overflow-y: auto;
    z-index: var(--z-controls);
    display: block !important;  /* Siempre visible en desktop */
    opacity: 1 !important;
  }
  
  /* Remove map margin adjustment */
  #map {
    margin-left: 0;
  }
}

/* Desktop: Search panel as dropdown - CLOSED by default */
@media (min-width: 769px) {
  .search-panel {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    right: auto;
    bottom: auto;
    width: 600px;
    max-width: 90vw;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    display: none;  /* OCULTO por defecto */
  }
  
  .search-panel.active {
    transform: translateX(-50%) translateY(0);
    display: block;  /* VISIBLE solo cuando active */
  }
  
  .search-results {
    max-height: 400px;
    border-radius: 0 0 16px 16px;
  }
}

/* Bottom Sheet: Image gallery at bottom */
.bs-body {
  padding: 20px;
}

.bs-image-gallery {
  margin: 20px -20px 0;
  padding: 16px 20px;
  background: white;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.bs-image-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 10px;
}

.bs-image-thumbnail {
  width: 100%;
  height: 250px;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bs-image-thumbnail:active {
  transform: scale(0.98);
}

/* Image fullscreen viewer */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.image-viewer.active {
  opacity: 1;
  visibility: visible;
}

.image-viewer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 16px;
  gap: 16px;
  transform: scale(0.88);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-viewer.active .image-viewer-inner {
  transform: scale(1);
}

.image-viewer img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.image-viewer-close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.image-viewer-close svg {
  width: 24px;
  height: 24px;
  color: white;
}

/* Remove dark hero, use light style */
.bs-hero {
  display: none;
}

.bs-title-section {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-light);
}

.bs-title-main {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gray-dark);
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.bs-restaurant-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bs-restaurant-name svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.bs-collapse-btn {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 8px));
  left: 12px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s ease;
}

.bs-collapse-btn:active {
  background: var(--gray-light);
}

.bs-collapse-btn svg {
  width: 20px;
  height: 20px;
  color: var(--gray-dark);
}

.bottom-sheet.half .bs-collapse-btn,
.bottom-sheet.full .bs-collapse-btn {
  display: flex;
}

.bs-actions-top {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 8px));
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.bs-action-btn-light {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease;
}

.bs-action-btn-light:active {
  background: var(--gray-light);
  transform: scale(0.95);
}

.bs-action-btn-light svg {
  width: 20px;
  height: 20px;
  color: var(--gray-dark);
}


/* Full width buttons */
.bs-btn-full {
  width: 100%;
  margin-bottom: 10px;
}


/* Closing animation for bottom sheet */
.bottom-sheet.closing {
  animation: slideDown 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes slideDown {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

.location-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 30, 0.92);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: var(--z-max);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  text-align: center;
  max-width: 80vw;
}

.location-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Locate Button Spinner ─── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.top-btn.loading {
  pointer-events: none;
}

.top-btn.loading svg,
.top-btn.loading i {
  display: none;
}

.top-btn.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(55, 65, 81, 0.25);
  border-top-color: var(--gray-dark);
  border-radius: var(--radius-full);
  animation: spin 0.75s linear infinite;
}
