/* Mapas de Tatigo (ver maps.js). Animaciones solo con transform/opacity; sin movimiento si el teléfono lo pide. */
:root { --tm-blue: #1A73E8; --tm-pin-shadow: rgb(0 0 0 / .28); }

/* ---------- Caja del mapa ---------- */
.tm-map { position: relative; overflow: hidden; isolation: isolate; background: var(--surface-2); }
/* Mapbox y MapLibre ponen position: relative en su contenedor: que igual ocupe toda la caja. */
.tm-map > .tm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tm-off { display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; color: var(--muted); }

/* Créditos y logo: pequeños pero visibles (son obligatorios). */
.tm-map .mapboxgl-ctrl-attrib, .tm-map .maplibregl-ctrl-attrib, .tm-map .leaflet-control-attribution {
  font-size: 9.5px; line-height: 1.5; padding: 0 5px; background: rgb(255 255 255 / .72); border-radius: 6px 0 0 0;
}
.tm-map .mapboxgl-ctrl-attrib a, .tm-map .maplibregl-ctrl-attrib a, .tm-map .leaflet-control-attribution a { color: #3E4146; }
.tm-map .mapboxgl-ctrl-logo { width: 72px; height: 18px; }
.tm-map .mapboxgl-ctrl-bottom-left .mapboxgl-ctrl, .tm-map .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl { margin: 0 0 4px 6px; }
.tm-map .mapboxgl-ctrl-bottom-right .mapboxgl-ctrl { margin: 0; }
:root[data-theme="dark"] .tm-map .mapboxgl-ctrl-attrib, :root[data-theme="dark"] .tm-map .maplibregl-ctrl-attrib,
:root[data-theme="dark"] .tm-map .leaflet-control-attribution { background: rgb(18 22 26 / .7); }
:root[data-theme="dark"] .tm-map .mapboxgl-ctrl-attrib a, :root[data-theme="dark"] .tm-map .maplibregl-ctrl-attrib a,
:root[data-theme="dark"] .tm-map .leaflet-control-attribution a { color: #C9CDD2; }
/* Teselas de OpenStreetMap (Leaflet, teléfonos sin WebGL o respaldo de las zonas) en tema oscuro: atenuadas. */
:root[data-theme="dark"] .tm-map.tm-osm .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
.tm-leaflet-icon { background: none; border: 0; }
/* Leaflet pone el marcador con su esquina en el punto: se corre para que coincida la punta (o el centro). */
.tm-leaflet-icon.tm-at-bottom > * { transform: translate(-50%, -100%); }
.tm-leaflet-icon.tm-at-center > * { transform: translate(-50%, -50%); }

/* ---------- Pin de Tatigo (rojo con la T) ---------- */
.tm-pin, .tm-center, .tm-static-pin { position: relative; width: 40px; height: 52px; pointer-events: none; }
.tm-pin-svg { position: relative; z-index: 1; display: block; width: 40px; height: 52px; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .25)); }
.tm-pin-shadow {
  position: absolute; left: 50%; bottom: -3px; width: 14px; height: 5px; margin-left: -7px; border-radius: 50%;
  background: var(--tm-pin-shadow); filter: blur(1.5px);
}
@media (prefers-reduced-motion: no-preference) {
  .tm-drop { animation: tm-drop .5s cubic-bezier(.3, 1.4, .5, 1) both; }
  .tm-drop .tm-pin-shadow, .tm-drop .tm-biz-tip { animation: tm-fade .5s ease-out both; }
}
@keyframes tm-drop { from { transform: translateY(-28px); opacity: 0; } 60% { opacity: 1; } }
@keyframes tm-fade { from { opacity: 0; } }

/* ---------- Elegir un punto: pin fijo al centro del mapa ---------- */
.tm-picker { display: block; margin-bottom: 10px; }
.tm-frame { position: relative; height: 300px; border-radius: var(--r-md, 12px); overflow: hidden; isolation: isolate; background: var(--surface-2); }
.tm-holder { position: absolute; inset: 0; }
.tm-center { position: absolute; left: 50%; top: 50%; margin: -52px 0 0 -20px; z-index: 2; }
.tm-center .tm-pin-svg { transition: transform .18s ease-out; }
.tm-center .tm-pin-shadow { transition: transform .18s ease-out, opacity .18s; }
.tm-center.tm-lift .tm-pin-svg { transform: translateY(-12px); }
.tm-center.tm-lift .tm-pin-shadow { transform: scale(.7); opacity: .6; }
.tm-center.tm-unset .tm-pin-svg { opacity: .72; }
@media (prefers-reduced-motion: no-preference) {
  .tm-center.tm-bounce .tm-pin-svg { animation: tm-bounce .42s cubic-bezier(.3, 1.6, .5, 1); }
}
@keyframes tm-bounce { 0% { transform: translateY(-12px); } 55% { transform: translateY(2px); } 100% { transform: translateY(0); } }
.tm-hint {
  position: absolute; left: 50%; top: 14px; z-index: 2; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-md, 0 4px 14px rgb(0 0 0 / .14));
}
.tm-suggest {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 10px 12px; border-radius: var(--r-md, 12px);
  background: var(--surface-2); font-size: 14px;
}
.tm-suggest[hidden] { display: none; }
.tm-suggest > span { flex: 1; min-width: 0; }
.tm-suggest .ph-i { width: 18px; height: 18px; flex: none; color: var(--brand-text, #D6001C); }
.tm-use {
  flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; font: inherit; font-weight: 700; font-size: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm, 0 1px 3px rgb(0 0 0 / .12)); cursor: pointer;
}

/* ---------- Botón redondo "mi ubicación" ---------- */
.tm-locate, .tm-round {
  position: absolute; z-index: 3; width: 44px; height: 44px; border: 0; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-md, 0 4px 14px rgb(0 0 0 / .18));
}
.tm-locate { right: 12px; bottom: 30px; }
.tm-locate .ph-i, .tm-round .ph-i { width: 22px; height: 22px; vertical-align: 0; }
.tm-locate.tm-busy .ph-i { opacity: .45; }
@media (prefers-reduced-motion: no-preference) {
  .tm-locate.tm-busy .ph-i { animation: tm-pulse 1s ease-in-out infinite; }
  .tm-locate:active, .tm-round:active { transform: scale(.94); }
}
@keyframes tm-pulse { 50% { opacity: 1; } }

/* ---------- Ubicación del cliente: punto azul con un halo que late ---------- */
.tm-user { position: relative; width: 18px; height: 18px; }
.tm-user-dot { position: absolute; inset: 0; border-radius: 50%; background: var(--tm-blue); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.tm-user-halo { position: absolute; inset: -11px; border-radius: 50%; background: rgb(26 115 232 / .22); }
@media (prefers-reduced-motion: no-preference) {
  .tm-user-halo { animation: tm-halo 2.2s ease-out infinite; }
}
@keyframes tm-halo { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }

/* ---------- Negocio: pin con su logo en un círculo ---------- */
.tm-biz { position: relative; width: 52px; height: 62px; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.tm-biz-logo {
  position: relative; z-index: 1; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; border: 3px solid #fff;
  background: var(--tatigo-red, #D6001C); color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 8px rgb(0 0 0 / .3);
}
.tm-biz-logo img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.tm-biz-tip { width: 0; height: 0; margin-top: -3px; border: 8px solid transparent; border-top: 10px solid #fff; filter: drop-shadow(0 2px 1px rgb(0 0 0 / .2)); }

/* ---------- Buscador arriba del mapa ---------- */
.tm-search { position: relative; margin-bottom: 8px; }
.tm-search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.tm-search-ico .ph-i { width: 20px; height: 20px; vertical-align: 0; }
.tm-search input.tm-search-input {
  width: 100%; min-height: 48px; padding: 0 14px 0 44px; border-radius: 999px; border: 1px solid var(--line-strong, #D0D4D9);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; box-sizing: border-box;
}
.tm-search input.tm-search-input:focus { outline: 2px solid var(--focus-ring, rgba(214, 0, 28, .3)); outline-offset: 1px; border-color: transparent; }
.tm-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border-radius: var(--r-md, 12px); box-shadow: var(--shadow-lg, 0 10px 30px rgb(0 0 0 / .2));
  max-height: 300px; overflow-y: auto;
}
.tm-results[hidden] { display: none; }
.tm-results button {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; text-align: left;
  background: none; color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
}
.tm-results button:hover, .tm-results button:focus-visible { background: var(--surface-2); }
.tm-results button .ph-i { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.tm-results b { display: block; font-weight: 700; }
.tm-results small { display: block; color: var(--muted); font-size: 13px; }
.tm-none { padding: 10px; color: var(--muted); font-size: 14px; }

/* ---------- Imagen fija (sección Información y "para recoger") ---------- */
.tm-static { position: relative; overflow: hidden; border-radius: var(--r-md, 12px); background: var(--surface-2); }
.tm-static-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.tm-static img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tm-static-pin { position: absolute; left: 50%; top: 50%; margin: -52px 0 0 -20px; }
.tm-static-off img { visibility: hidden; }
.tm-directions {
  position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 700; text-decoration: none;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-md, 0 4px 14px rgb(0 0 0 / .16));
}
.tm-directions .ph-i { width: 18px; height: 18px; vertical-align: 0; }

/* ---------- Mapa grande en hoja a pantalla completa ---------- */
.tm-sheet { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tm-sheet .sheet-grab { display: none; }
.tm-sheet-map { position: relative; flex: 1; }
.tm-close { top: calc(12px + env(safe-area-inset-top)); left: 12px; }
.tm-locate-sheet { bottom: auto; top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.tm-sheet-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); box-shadow: 0 -4px 16px rgb(0 0 0 / .08); }
.tm-sheet-title { font-weight: 800; font-size: 18px; margin-bottom: 10px; }
/* Créditos de la imagen fija (Mapbox los pide visibles; en la imagen se cortaban, así que van como texto) */
.tm-static-attrib {
  position: absolute; right: 0; bottom: 0; z-index: 2; padding: 1px 6px; border-radius: 6px 0 0 0;
  font-size: 9.5px; line-height: 1.6; background: rgb(255 255 255 / .75);
}
.tm-static-attrib a { color: #3E4146; text-decoration: none; }
:root[data-theme="dark"] .tm-static-attrib { background: rgb(18 22 26 / .7); }
:root[data-theme="dark"] .tm-static-attrib a { color: #C9CDD2; }

/* ---------- Lugares de referencia de Tatigo ---------- */
/* Ícono del tipo de lugar (lista de resultados del buscador y del admin) */
.tm-kind {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--tm-kind, #6D6F73); color: #fff; box-shadow: 0 0 0 2px var(--surface);
}
.tm-kind .ph-i { width: 15px; height: 15px; vertical-align: 0; margin: 0; }
.tm-results button.tm-own b { color: var(--text); }
.tm-results button .tm-kind { margin-top: 0; }
.tm-link { padding: 0; border: 0; background: none; color: var(--brand-text, #D6001C); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
/* "¿No encuentras un lugar? Sugiérelo" debajo del buscador */
.tm-suggest-place {
  display: block; width: 100%; margin: -2px 0 10px; padding: 4px 2px; border: 0; background: none; text-align: left;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.tm-suggest-place b { color: var(--brand-text, #D6001C); }
.tm-suggest-form label { display: block; font-weight: 700; margin: 8px 0 6px; }
.tm-suggest-form input {
  width: 100%; min-height: 48px; padding: 0 14px; box-sizing: border-box; font: inherit; font-size: 16px; color: var(--text);
  border: 1px solid var(--line-strong, #D0D4D9); border-radius: var(--r-md, 12px); background: var(--surface);
}
.tm-suggest-error { color: var(--danger, #D6001C); font-size: 14px; margin: 8px 0 0; }
/* Leaflet (sin WebGL): lugar con su ícono y nombre */
.tm-place { display: inline-flex; flex-direction: column; align-items: center; transform: translate(-50%, -13px); pointer-events: none; }
.tm-place .ph-i {
  width: 16px; height: 16px; padding: 5px; border-radius: 50%; background: var(--tm-kind, #6D6F73); color: #fff; box-sizing: content-box;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3);
}
.tm-place b {
  margin-top: 2px; max-width: 120px; font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center; color: #2B2F33;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}
:root[data-theme="dark"] .tm-place b { color: #E8EAEC; text-shadow: 0 0 3px #12161A, 0 0 3px #12161A, 0 0 3px #12161A; }
.tm-more { padding: 8px 10px; color: var(--muted); font-size: 13px; }
/* "sugiérelo" dentro del mensaje sin resultados: un enlace en la frase, no un botón de la lista */
.tm-results .tm-none .tm-link { display: inline; width: auto; padding: 0; border-radius: 0; font-size: inherit; color: var(--brand-text, #D6001C); }
