/* =====================
   🌍 BASE
===================== */
html, body {
  margin: 0;
  padding: 0;
  position: fixed;
  height: 100%;
  width: 100%;
  font-family: system-ui;
  overflow: hidden;
  background: #f5f5f5;
  touch-action: pan-x pan-y;
}

#map {
  position: relative;
  height: 100dvh;
  width: 100%;
  touch-action: pan-x pan-y;
}

/* =====================
   🔎 BRAND
===================== */
#brand {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1500;
  background: #25D366;
  border: none;
  padding: 8px 10px;
  border-radius: 40px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  display: none;
  align-items: center;
  gap: 8px;
}

#brand img {
  vertical-align: middle;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

#brand a {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

#brand svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

#btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 12px;
  z-index: 1600;
  background: linear-gradient(#111, #111) padding-box,
  linear-gradient(90deg,
    #ff0000,
    #ff8000,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #ff00ff
  ) border-box;
  color:#fff;
  backdrop-filter: blur(2px);
  padding: 9px 14px;
  border-radius: 40px;
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 600;
  box-shadow:
  0 4px 14px rgba(0,0,0,0.15),
  0 0 8px rgba(0,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

/* =====================
   MOBILE
===================== */
@media (max-width: 768px) {
  #brand {
    top: 60px;
    left: 12px;
    padding: 6px 10px;
  }

  #brand img {
    height: 24px;
  }

  #btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin-top:10%;        
    display: none;
  }
}

/* =====================
   📱 SHEET
===================== */
#sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%,100%);
  width: 100%;
  max-width: 80%;
  height: 70vh;
  max-height: 30vh;

  backdrop-filter: blur(12px);

  border-top-left-radius: 40px;
  border-top-right-radius: 40px;
  border: 2px solid transparent;

  background:
    linear-gradient(rgba(20,20,20,0.85), rgba(20,20,20,0.85)) padding-box,
    linear-gradient(90deg,
      #ff0000,
      #ff8000,
      #ffff00,
      #00ff00,
      #00ffff,
      #0000ff,
      #ff00ff
    ) border-box;

  box-shadow: 0 -10px 30px rgba(0,0,0,0.12);
  transition: transform 0.35s cubic-bezier(.22,.9,.31,1);
  z-index: 2000;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  will-change: transform;
  touch-action: pan-y;
}

#sheet.open {
  transform: translate(-50%,0);
}

/* ➖ HANDLE */
#handle {
  width: 50px;
  height: 5px;
  background: #ccc;
  border-radius: 999px;
  margin: 10px auto;
}

/* =====================
   🔍 TOPBAR
===================== */
.topbar {
  padding: 10px;
  /* border-bottom: 1px solid #eee; */
}

.topbar input,
.topbar select,
#admin input,
#admin select,
#adminModal input,
#adminModal select,
.modal-content input,
.modal-content select {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px 30px 12px 12px; /* padding-right mayor para select */
  box-sizing: border-box;
  border-radius: 40px;
  border: 1px solid #ddd;
  outline: none;
  font-size: 14px;
}

.topbar input,
.topbar select {
  /* margin-top: 2px; */
  font-size: 16px;
}

.topbar input:focus,
.topbar select:focus,
#admin input:focus,
#admin select:focus,
#adminModal input:focus,
#adminModal select:focus,
.modal-content input:focus,
.modal-content select:focus {
  border-color: #ddd;
}

img.search-icon {
    padding-left: 28px;
    padding-top: 9px;
}

#closeSheet {
  width: 100%;
  padding: 12px;
  border-radius: 40px;
  border: 2px solid transparent;

  background:
    linear-gradient(#000, #000) padding-box,
    linear-gradient(90deg,
      #ff0000,
      #ff8000,
      #ffff00,
      #00ff00,
      #00ffff,
      #0000ff,
      #ff00ff
    ) border-box;

  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;

  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#closeSheet:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#closeSheet img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* =====================
   📦 ITEMS
===================== */
.item {
  margin: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #eee;
  background: white;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.item:hover {
  background: #fafafa;
  transform: translateX(4px);
}

.star {
  color: orange;
  font-weight: bold;
}


/* =====================
   🗺️ MAP TILES
===================== */

/* Default state */
.leaflet-tile {
  filter: brightness(1) saturate(0.2) contrast(1);
  transition: filter 0.5s ease; /* Smooth transition when darkening */
  outline: 1px solid transparent; 
}

/* Darkened state when searching */
.leaflet-tile {
  filter: brightness(0.4) saturate(0.2) contrast(1);
  transition: filter 0.6s ease;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =====================
   📍 POPUPS
===================== */
.leaflet-popup-content-wrapper {
  border-radius: 40px;
  max-width: 63vw;
  box-sizing: border-box;
}

.leaflet-popup-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: 10px;
}

.leaflet-popup-tip {
  background: white;
}

.leaflet-popup-content img {
  vertical-align: middle;
  max-height: 45vh; /* nunca más alto que el 45% de la pantalla */
  width: auto;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.leaflet-popup-content button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  box-sizing: border-box;
}

.leaflet-popup-content button.whatsapp {
  background-color: #25D366;
}

.leaflet-popup-content button.instagram {
  background-color: #E1306C;
  filter: invert(1);
}

.leaflet-popup-content button.maps {
  background-color: #4285F4;
  filter: brightness(0) invert(1);
}

/* MOBILE ADJUST */
@media (max-width: 480px) {
  .leaflet-popup-content button {
    font-size: 14px;
    padding: 6px 10px;
  }
  .leaflet-popup-content button img {
    width: 18px;
    height: 18px;
    margin-right: 10px;
  }
}

/* ➕ ZOOM */
.leaflet-control-zoom a {
  border-radius: 10px !important;
}



.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.modal-content {
  background: white;
  padding: 0px 40px 40px 40px;
  border-radius: 40px;
  width: 280px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: white;
  padding: 20px;
  border-radius: 16px;
  width: 280px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

/* =====================
   ✨ OPTIMIZED HERO GLOW
===================== */
/* Ensure the marker container doesn't clip the glow */
.glow-marker {
  background: transparent !important;
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
}

.glow-wrap {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Base Pseudo-element for Glow */
.glow-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.8) 0%, rgba(255,215,0,0) 70%);
  filter: blur(8px);
  z-index: 1;
  /* Use the translate defined in your keyframes */
  transform: translate(-50%, -50%) scale(0.9);
  animation: heroPulse 1.5s infinite alternate ease-in-out;
  will-change: transform, opacity;
}

/* GPU Accelerated Animation */
@keyframes heroPulse {
  from { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
  to { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

/* Selected State: cyan glow + faster animation */
.glow-wrap.selected::before {
  background: radial-gradient(circle, rgba(0,255,255,0.8) 0%, rgba(0,255,255,0) 70%);
  animation: heroPulseSelected 0.8s infinite alternate ease-in-out;
}

@keyframes heroPulseSelected {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.3); }
}

.glow-wrap img {
  width: 32px;
  height: 32px;
  z-index: 2;
  position: relative;
  border-radius: 50%; /* Recommended for business icons */
  object-fit: cover;
}


/* Container for the rainbow effect */
.glow-wrap.destacado-arcoiris {
  position: relative;
  z-index: 1;
}

/* The spinning rainbow border */
.glow-wrap.destacado-arcoiris::before {
  content: "";
  position: absolute;
  width: 40px; /* Slightly larger than the 32px img */
  height: 40px;
  top: 50%;
  left: 50%;
  margin-top: -20px;
  margin-left: -20px;
  background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
  border-radius: 50%;
  animation: spin 2s linear infinite;
  z-index: -1;
}

/* Masking to create the "border" look */
.glow-wrap.destacado-arcoiris::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 36px;
  top: 50%;
  left: 50%;
  margin-top: -18px;
  margin-left: -18px;
  background: white; /* Match your map background or marker color */
  border-radius: 50%;
  z-index: 0;
}


/* =====================
   🌐 SEARCH CONTAINER
===================== */
.search-container {
  position: relative;
}

.search-container input {
  /* padding: 16px 12px 16px 45px; espacio para ícono y label flotante */
  background: none;
  transition: border-color 0.3s ease;
  color: #fff;
}

.search-container input:focus {
  border-color: #d8deeb;
}

.search-container label {
  position: absolute;
  margin-left: 10px;
  transform: translateY(-50%);
  color: #999;
  font-size: 14px;
  pointer-events: none;
  transition: all 0.25s ease;
}

.search-container input:focus + label,
.search-container input:not(:placeholder-shown) + label {
  top: 1px;
  left: 70px;
  font-size: 14px;
  color: #999;
  padding: 0 4px;
}

.search-container .search-icon {
  position: absolute;
  left: 22px;
  top: 28%;
  transform: translateY(-50%);
  width: 25px;
  height: 25px;
  pointer-events: none;
  opacity: 0.4;
  transition: all 0.3s ease;
}

input::placeholder{
  color:#ffffffbe;
}

.search-container input:focus ~ .search-icon,
.search-container input:not(:placeholder-shown) ~ .search-icon {
  top: -22px;
  left: 24px;
  transform: translateY(0) scale(1);
  opacity: 0.4;
}

/* .search-container input:focus,
.search-container input:not(:placeholder-shown) {
  padding-left: 20px;
} */

/* =====================
   MOBILE ADJUST BRAND
===================== */
@media (max-width: 768px) {
  #brand {
    top: 12px;
    left: 12px;
    padding: 6px 10px;
  }

  #brand img {
    height: 24px;
    width: 24px;
  }

  .glow-wrap::after {
    display: none;
  }

  .glow-wrap::before {
    filter: blur(4px); /* Lower blur = faster paint */
  }
}

input, select {
  font-size: 16px;
}

/* label flotante solo para input, no select */
.search-container input + label {
  position: absolute;
  left: 73px;
  top: 31%;
  margin-left: 10px;
  transform: translateY(-50%);
  color: #999;
  font-size: 14px;
  pointer-events: none;
  transition: all 0.25s ease;
}

 
 
 
/* =====================
   CATEGORY TOUCH-FRIENDLY (refactor)
===================== */
#category {
  border-radius: 40px;
  border: 1px solid #ddd;
  background-color: transparent;
  color: #fff;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-image: url('/assets/img/icons/8213476.png');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;

  cursor: pointer;
  transition: all 1s ease;
}

/* feedback visual */
#category:active,
#category:focus {
  border-radius: 40px;
  border: 1px solid #ddd;
  background-color: #000;
  color: #fff;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

 
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;

  cursor: pointer;
  transition: all 0.5s ease;
}

 

/* opcional: hover en desktop */
@media (hover: hover) {
  #category:hover {
      border-radius: 40px;
  border: 1px solid #ddd;
  background-color: #000;
  color: #fff;

  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;

  cursor: pointer;
  transition: all 0.5s ease;
  }
}

#btn img {
  width: 20px;
  height: 20px;
}


.imga {
  width: 40px;
  height: 40px;
}

 



.leaflet-container .leaflet-popup a.leaflet-popup-close-button {
    top: 5px;
    right: 15px;
}


#categoriesAdminList{
  max-height:400px;
  overflow-y:auto;
  margin-top: 16px;
  border:1px solid #ddd;
  padding:10px;
  border-radius:10px;
}

.category-item{
  margin-bottom:10px;

  padding:10px;
  background:#f5f5f5;
  border-radius:8px;

  display:flex;
  justify-content:space-between;
  align-items:center;
}

#categoriesAdminList::-webkit-scrollbar{
  width:8px;
}

#categoriesAdminList::-webkit-scrollbar-thumb{
  background:#999;
  border-radius:10px;
}

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


.action-btn{
  background: transparent!important;
  border: none;

  cursor: pointer;

  font-size: 18px;

  padding: 6px;

  border-radius: 8px;

  transition: .2s;
}

.action-btn:hover{
  background: rgba(0,0,0,.08);
}


.delete-btn{
  color: #e53935!important;
}

.edit-btn{
  color: #1976d2!important;
}

.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }


#contadorMeta{
  display:inline-block;

  padding:8px 14px;

  background:#f8fafc;
  color:#64748b;

  border:1px solid #e2e8f0;
  border-radius:999px;

  font-size:13px;
  font-weight:500;
  width: 88%;
}

#contadorMeta b{
  color:#0ca75e;
}

 
/* =====================
   🗑 DELETE CONFIRM
===================== */

.confirm-box{
  width: 320px;
  text-align: center;
}

.confirm-box h3{
  margin-bottom: 10px;
}

.confirm-box p{
  color:#666;
  line-height:1.5;
}

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

.confirm-actions button{
  margin-top:0!important;
  flex:1;
}

.cancel-confirm{
  background:#e5e7eb!important;
  color:#374151!important;
}

.danger-confirm{
  background:#ef4444!important;
}

/* Darkened state when searching */
.leaflet-tile {
  filter: brightness(0.4) saturate(0.2) contrast(1);
}

body:not(.loading-active):not(.searching-active) .leaflet-tile {
  filter: brightness(0.4) saturate(0.2) contrast(1);
  transition: filter 0.6s ease;
}

#mapLoader {
  position: absolute;
  inset: 0;
  z-index: 9000;
  display: none; /* solo visible cuando el body tiene .loading-active */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none; /* deja pasar clicks, es puramente informativo */
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

body.loading-active #mapLoader {
  display: flex;
}

#mapLoader .spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(244, 180, 0, 0.25); /* basado en UI.primary */
  border-top-color: #F4B400;
  border-radius: 50%;
  animation: mapLoaderSpin 0.8s linear infinite;
}

#mapLoader span {
  font-size: 14px;
  font-weight: 600;
  color: #fff; /* sobre fondo oscurecido se lee mejor en blanco */
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

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

#btnHelp {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 1600;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  background:
    linear-gradient(#111, #111) padding-box,
    linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff) border-box;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  -webkit-tap-highlight-color: transparent;
}
/* --- Override iOS/glass look (reemplaza gradientes arcoíris) --- */
#btn {
  background: rgba(10, 132, 255, 0.9) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.3) !important;
  color: white !important;
  
}

#btnHelp {
  background: rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  color: white !important;
}

#sheet {
  background: rgba(30, 30, 32, 0.75) !important;
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

#closeSheet {
  background: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2) !important;
  color: white !important;
}

body.typing-active #category,
body.typing-active #closeSheet {
  display: none !important;
}

.active-ring-wrap {
  background: none;
  border: none;
}
.active-ring {
  width: 52px;
  height: 52px;
  box-sizing: border-box;
  border: 3px dashed #F4B400;
  border-radius: 50%;
  background: rgba(244, 180, 0, 0.12);
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15) !important;
  border-radius: 20px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: rgba(30, 30, 32, 0.75) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff !important;
  border-bottom: 1px solid rgba(255,255,255,0.12) !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 20px !important;
}
.leaflet-control-zoom a:last-child { border-bottom: none !important; }

.leaflet-control-reset {
  border: none !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15) !important;
  border-radius: 20px !important;
  overflow: hidden;
  margin-top: 8px !important;
}
.leaflet-control-reset a {
  background: rgba(30, 30, 32, 0.75) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #fff !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 22px !important;
  text-align: center;
}

.wizard-tap-hint {
  position: fixed;
  font-size: 28px;
  z-index: 100000;
  pointer-events: none;
  animation: wizardTapPulse 4s ease-in-out infinite;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

@keyframes wizardTapPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}


.wizard-highlight {
  outline: 3px solid #ff9800;
  outline-offset: 2px;
  border-radius: 8px;
  animation: wizardPulse 2.8s ease-in-out infinite;
}

@keyframes wizardPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 152, 0, 0); }
}

.wizard-inline-hint {
  position: fixed;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  text-align: center;
  z-index: 100000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
  max-width: 90vw;
  display: none;
}


#btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  /* el resto igual: padding, border-radius, display:flex, gap, etc. */
}

  @media (min-width: 769px) {
  #sheet {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 480px;
  }
}