/* ============================================================
   MOGAR·360 Plataforma — estilos compartidos (portada + visor)
   Mobile-first · paleta MOGAR: rojo #CE011F, negro, blanco
   ============================================================ */
:root {
  --rojo: #CE011F;
  --rojo-2: #9E0117;
  --negro: #0D0D0D;
  --carbon: #1A1A1A;
  --gris: #ADADAD;
  --linea: rgba(255, 255, 255, .16);
  --verde: #3AE86B;
  --amarillo: #D9A441;
  --rojo-lote: #FF3B30;
  --ui: 'Instrument Sans', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: var(--ui); background: var(--negro); color: #fff; }
button { font-family: var(--ui); cursor: pointer; }

/* ---------- PORTADA ---------- */
.portada { min-height: 100%; padding: 26px 16px 60px; }
.portada .cab { max-width: 1060px; margin: 0 auto 6px; display: flex; align-items: center; gap: 12px; }
.logo-mogar { font-weight: 800; font-size: 26px; letter-spacing: .5px; color: #fff; text-decoration: none; }
.logo-mogar em { font-style: normal; color: var(--rojo); }
.portada .sub { max-width: 1060px; margin: 0 auto 22px; color: var(--gris); font-size: 14px; }
.grid-proy { max-width: 1060px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card-proy { position: relative; background: var(--carbon); border: 1px solid var(--linea); border-radius: 16px; overflow: hidden; }
.card-proy img { width: 100%; height: 160px; object-fit: cover; display: block; background: #222; }
.card-proy .cpo { padding: 14px 16px 16px; }
.card-proy h3 { font-size: 18px; margin-bottom: 4px; }
.card-proy .disp { color: var(--gris); font-size: 13px; margin-bottom: 12px; }
.card-proy .disp strong { color: var(--verde); }
.card-proy .btn-ver { display: inline-block; background: var(--rojo); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; padding: 11px 20px; border-radius: 99px; border: none; }
.card-proy .btn-ver:active { background: var(--rojo-2); }
.card-proy .prox { position: absolute; top: 12px; left: 0; background: #444; color: #fff; font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 0 99px 99px 0; letter-spacing: .4px; }
.card-proy.proximamente img { filter: grayscale(.6) brightness(.6); }

/* ---------- VISOR (tour.html) ---------- */
.visor-body { overflow: hidden; }
#pano { position: fixed; inset: 0; }
#capaLotes { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
#pines { position: fixed; inset: 0; pointer-events: none; z-index: 6; }

/* Pines numerados */
.pin-lote {
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #fff; color: #fff; display: none; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
  pointer-events: auto; cursor: pointer; will-change: transform; user-select: none;
}
.pin-lote .pin-etq {
  position: absolute; top: 110%; left: 50%; transform: translateX(-50%);
  background: rgba(10, 10, 10, .82); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: none;
  border: 1px solid var(--linea);
}
.pin-lote.pulso::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  animation: pulsoPin 2s infinite; border: 2px solid rgba(58, 232, 107, .8);
}
.pin-lote.activo { z-index: 3; }
@keyframes pulsoPin { 0% { transform: scale(1); opacity: .9; } 70% { transform: scale(1.7); opacity: 0; } 100% { opacity: 0; } }

/* Barra superior */
.barra-sup { position: fixed; top: 0; left: 0; right: 0; z-index: 12; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; pointer-events: none; }
.barra-sup > * { pointer-events: auto; }
.logo-chip { background: rgba(13, 13, 13, .82); border: 1px solid var(--linea); padding: 8px 14px; border-radius: 99px; font-size: 15px; }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: rgba(13, 13, 13, .78); color: #ddd; border: 1px solid var(--linea);
  padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 600;
}
.chip.on { background: var(--rojo); color: #fff; border-color: transparent; }
.chip .cnt { opacity: .75; font-weight: 400; }
select.chip { appearance: none; }

/* Brújula */
.brujula { width: 44px; height: 44px; border-radius: 50%; background: rgba(13, 13, 13, .82); border: 1px solid var(--linea); position: relative; flex: 0 0 auto; }
.brujula .aguja { position: absolute; left: 50%; top: 6px; width: 2px; height: 16px; margin-left: -1px; background: linear-gradient(var(--rojo) 50%, #eee 50%); transform-origin: 50% 100%; }
.brujula .n { position: absolute; top: 1px; left: 50%; transform: translateX(-50%); font-size: 8px; color: var(--rojo); font-weight: 800; }

/* Leyenda + botonera inferior */
.pie { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.pie > * { pointer-events: auto; }
.leyenda { display: flex; gap: 12px; justify-content: center; font-size: 11.5px; color: #ddd; }
.leyenda span::before { content: "●"; margin-right: 4px; }
.leyenda .ld::before { color: var(--verde); } .leyenda .la::before { color: var(--amarillo); } .leyenda .lv::before { color: var(--rojo-lote); }
.botonera { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.btn-p { background: rgba(13, 13, 13, .85); color: #fff; border: 1px solid var(--linea); padding: 10px 16px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.btn-p.rojo { background: var(--rojo); border-color: transparent; }
.btn-p:active { transform: scale(.97); }

/* Tira de escenas */
#tira { position: fixed; bottom: 84px; left: 0; right: 0; z-index: 11; display: none; gap: 8px; padding: 8px 12px; overflow-x: auto; }
#tira.abierta { display: flex; }
#tira .mini { flex: 0 0 auto; width: 92px; height: 58px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; position: relative; opacity: .8; }
#tira .mini.on { border-color: var(--rojo); opacity: 1; }
#tira .mini img { width: 100%; height: 100%; object-fit: cover; }
#tira .mini span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(10, 10, 10, .8); font-size: 9.5px; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Hojas (bottom sheets) */
.hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--carbon);
  border-radius: 18px 18px 0 0; border-top: 1px solid var(--linea);
  transform: translateY(105%); transition: transform .28s ease; max-height: 78vh;
  display: flex; flex-direction: column; box-shadow: 0 -12px 40px rgba(0, 0, 0, .5);
}
.hoja.abierta { transform: translateY(0); }
.hoja .asa { width: 42px; height: 4px; border-radius: 99px; background: #444; margin: 10px auto 4px; flex: 0 0 auto; }
.hoja .hoja-cab { display: flex; align-items: center; gap: 10px; padding: 6px 18px 10px; }
.hoja .hoja-cab h2 { font-size: 17px; flex: 1; }
.hoja .cerrar-hoja { background: none; border: none; color: #aaa; font-size: 20px; padding: 4px 8px; }
.hoja .hoja-cuerpo { overflow-y: auto; padding: 0 18px 22px; }
@media (min-width: 760px) { .hoja { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 18px; } }

/* Ficha de lote */
.estatus-tag { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 11.5px; font-weight: 800; letter-spacing: .4px; color: #0B140D; }
.ficha-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 12px 0; font-size: 14px; }
.ficha-datos .fd b { display: block; color: var(--gris); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.ficha-precio { font-size: 24px; font-weight: 800; color: #FF5A6E; margin: 4px 0 12px; }
.carrusel { display: flex; gap: 8px; overflow-x: auto; margin: 4px 0 12px; scroll-snap-type: x mandatory; }
.carrusel img { width: 78%; max-width: 320px; height: 160px; object-fit: cover; border-radius: 12px; flex: 0 0 auto; scroll-snap-align: start; background: #222; }
.ficha-acciones { display: flex; gap: 8px; }
.btn-wa { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; background: #25D366; color: #fff; text-decoration: none; font-weight: 800; padding: 13px; border-radius: 99px; font-size: 14.5px; border: none; }
.btn-video-f { background: var(--rojo); color: #fff; border: none; padding: 13px 18px; border-radius: 99px; font-weight: 800; font-size: 14.5px; }

/* Lista de lotes (panel Ver lotes) */
.fila-lote { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); cursor: pointer; }
.fila-lote .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.fila-lote .fl-txt { flex: 1; font-size: 14px; }
.fila-lote .fl-sub { color: var(--gris); font-size: 12px; }
.fila-lote .fl-est { font-size: 11px; font-weight: 800; }

/* Buscador de referencias */
.buscador input { width: 100%; background: #101010; border: 1px solid var(--linea); border-radius: 12px; padding: 12px 14px; color: #fff; font-size: 15px; margin-bottom: 10px; }
.fila-ref { display: flex; gap: 10px; align-items: center; padding: 10px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.fila-ref .icono-ref { width: 34px; height: 34px; border-radius: 10px; background: #262626; display: flex; align-items: center; justify-content: center; font-size: 16px; flex: 0 0 auto; }
.fila-ref .fr-dist { color: var(--gris); font-size: 12px; }

/* Mini-mapa */
.tarjeta-mapa { position: fixed; left: 12px; bottom: 96px; z-index: 31; width: min(92vw, 340px); background: var(--carbon); border: 1px solid var(--linea); border-radius: 16px; overflow: hidden; display: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); }
.tarjeta-mapa.abierta { display: block; }
.tarjeta-mapa .tm-cab { display: flex; align-items: center; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.tarjeta-mapa .tm-cab button { margin-left: auto; background: none; border: none; color: #aaa; font-size: 18px; }
.tarjeta-mapa iframe { width: 100%; height: 220px; border: 0; display: block; }
.tarjeta-mapa .tm-pie { padding: 10px 14px; }
.tarjeta-mapa .tm-pie a { color: #FF5A6E; font-weight: 700; text-decoration: none; font-size: 13.5px; }

/* Plano de lotificación (radar de vista, heredado del recorrido original) */
.tarjeta-plano { position: fixed; right: 12px; bottom: 96px; z-index: 31; width: min(92vw, 340px); background: var(--carbon); border: 1px solid var(--linea); border-radius: 16px; overflow: hidden; display: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .55); }
.tarjeta-plano.abierta { display: block; }
.tarjeta-plano .tp-cab { display: flex; align-items: center; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.tarjeta-plano .tp-cab button { margin-left: auto; background: none; border: none; color: #aaa; font-size: 18px; }
.plano-lienzo { position: relative; }
.plano-lienzo img { width: 100%; display: block; }
.plano-punto { position: absolute; width: 20px; height: 20px; margin: -10px; cursor: pointer; }
.plano-punto .cono { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin-left: -9px; margin-top: -19px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 20px solid rgba(206, 1, 31, .55); transform-origin: 50% 100%; display: none; }
.plano-punto.actual .cono { display: block; }
.plano-punto .bola { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px; border-radius: 50%; background: #8a8a8a; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.plano-punto.actual .bola { background: var(--rojo); }

/* Clima */
.clima { position: fixed; top: 64px; right: 12px; z-index: 11; background: rgba(13, 13, 13, .78); border: 1px solid var(--linea); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; color: #eee; display: none; }

/* Modal de video */
.velo-video { position: fixed; inset: 0; z-index: 48; background: rgba(0, 0, 0, .92); display: none; align-items: center; justify-content: center; padding: 16px; }
.velo-video.abierto { display: flex; }
.velo-video .caja { position: relative; width: min(96vw, 900px); }
.velo-video .marco { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 12px; overflow: hidden; }
.velo-video iframe, .velo-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.velo-video .cerrar-v { position: absolute; top: -46px; right: 0; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; border: none; font-size: 18px; }

/* Hotspot de video en escena */
.hs-video { position: absolute; left: 0; top: 0; width: 74px; height: 46px; border-radius: 10px; overflow: hidden; border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); pointer-events: auto; cursor: pointer; display: none; will-change: transform; }
.hs-video img { width: 100%; height: 100%; object-fit: cover; }
.hs-video::after { content: "▶"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; background: rgba(0, 0, 0, .35); }

/* Estacas de referencia dentro de la escena (icono + nombre) */
.marcador-ref { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); display: none; flex-direction: column; align-items: center; pointer-events: auto; cursor: pointer; will-change: transform; }
.marcador-ref .mr-ico { width: 36px; height: 36px; border-radius: 50%; background: rgba(13, 13, 13, .85); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: 0 3px 12px rgba(0, 0, 0, .5); }
.marcador-ref .mr-eti { margin-top: 5px; background: rgba(10, 10, 10, .82); border: 1px solid var(--linea); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* WhatsApp flotante */
.btn-wa-flot { position: fixed; right: 12px; bottom: 150px; z-index: 12; width: 52px; height: 52px; border-radius: 50%; background: #25D366; border: none; display: none; align-items: center; justify-content: center; font-size: 25px; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }

/* Aviso GPS / toasts */
.toast { position: fixed; bottom: 128px; left: 50%; transform: translateX(-50%) translateY(20px); background: #fff; color: #111; padding: 10px 18px; border-radius: 99px; font-size: 13px; font-weight: 600; z-index: 60; opacity: 0; transition: all .25s ease; max-width: 92vw; text-align: center; pointer-events: none; }
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Panel debug */
.panel-debug { position: fixed; top: 64px; left: 12px; z-index: 40; width: min(92vw, 320px); background: rgba(10, 10, 10, .92); border: 1px solid var(--verde); border-radius: 14px; padding: 12px; font-size: 12px; }
.panel-debug h3 { color: var(--verde); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.panel-debug textarea { width: 100%; height: 110px; background: #050505; color: #9f9; border: 1px solid #333; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 11px; padding: 8px; }
.panel-debug .acciones-dbg { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.panel-debug button { background: #1e1e1e; color: #fff; border: 1px solid #444; border-radius: 8px; padding: 7px 10px; font-size: 12px; }
.panel-debug button.verde { background: var(--verde); color: #06130A; border: none; font-weight: 800; }

/* Cajita de carga de Pannellum, al estilo MOGAR */
.pnlm-load-box { background: rgba(13, 13, 13, .88) !important; border-radius: 14px; border: 1px solid var(--linea); width: 180px !important; height: 110px !important; margin: -55px 0 0 -90px !important; font-size: 14px !important; font-family: var(--ui); }
.pnlm-load-box p { margin: 14px 0 !important; }
.pnlm-lbar { border-color: rgba(255, 255, 255, .5) !important; width: 120px !important; }
.pnlm-lbar-fill { background: var(--rojo) !important; }
.pnlm-lmsg { color: #999 !important; }

.oculto { display: none !important; }
