/* ═══════════════════════════════════════════════════════════
   SELLA MAP ENGINE — CSS
   Fusión: POC sella-3d-poc_10 + Plugin Sella Platform
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
#cmplz-cookiebanner-container, .cmplz-cookiebanner { display: none !important; }

:root {
  --bg:           #060d12;
  --panel:        rgba(10, 22, 28, 0.78);
  --panel-border: rgba(94, 234, 212, 0.18);
  --river:        #35d0c4;
  --river-glow:   rgba(53, 208, 196, 0.35);
  --gold:         #f0c060;
  --gold-glow:    rgba(240,192,96,0.35);
  --ink:          #eaf6f4;
  --ink-dim:      #7fa3a0;
  --danger:       #ef5350;
  --display:      'Barlow Condensed', sans-serif;
  --mono:         'IBM Plex Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  font-family: var(--mono);
  overflow: hidden;
}
#map { position: absolute; inset: 0; }

/* ── HUD layer ── */
.hud { position: absolute; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }

/* ── Brand (top-left) ── */
.brand {
  top: max(env(safe-area-inset-top, 0px), 16px); left: 16px;
  display: flex; flex-direction: column; gap: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.brand .eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .18em; color: var(--river);
  text-transform: uppercase; font-weight: 600;
}
.brand h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(22px, 5vw, 30px); line-height: 1;
  color: var(--ink); letter-spacing: .01em;
}

/* ── Stats (top-right) ── */
.stats {
  top: max(env(safe-area-inset-top, 0px), 16px); right: 16px;
  display: flex; gap: 10px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 10px 18px;
  backdrop-filter: blur(12px); min-width: 88px; text-align: right;
}
.stat-card .lbl {
  font-family: var(--mono); font-size: 9px;
  letter-spacing: .14em; color: var(--ink-dim); text-transform: uppercase;
}
.stat-card .val {
  font-family: var(--display); font-size: 26px;
  color: var(--ink); line-height: 1.15; font-weight: 600;
}
.stat-card .unit { font-size: 11px; color: var(--river); margin-left: 3px; }

/* ── POI Layer panel (left side, below brand) ── */
.poi-panel {
  top: 88px; left: 16px; width: 172px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px; backdrop-filter: blur(12px);
}
.poi-panel-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  color: var(--ink-dim); text-transform: uppercase; margin-bottom: 8px;
}
.poi-panel-list { display: flex; flex-direction: column; gap: 6px; }
.poi-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); transition: .15s;
}
.poi-toggle:hover { color: var(--ink); }
.poi-toggle .sw {
  width: 11px; height: 11px; border-radius: 3px;
  border: 1.5px solid rgba(255,255,255,.25); flex: none; transition: .15s;
}
.poi-toggle.on .sw { border-color: transparent; box-shadow: 0 0 6px currentColor; }
.poi-toggle.on { color: var(--ink); }
.poi-toggle .count { opacity: .5; margin-left: auto; font-size: 10px; }

/* ── Bottom bar: layers (left) + play btn (right) ── */
.bottom-bar {
  bottom: max(env(safe-area-inset-bottom, 0px), 20px); left: 0; right: 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 16px;
}
.pill-group {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 8px; backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 8px;
}
.pill-group .row { display: flex; gap: 6px; }
.pill {
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
  background: transparent; border: 1px solid var(--panel-border);
  border-radius: 20px; padding: 6px 12px; cursor: pointer; transition: .15s;
}
.pill:hover { color: var(--ink); }
.pill.active { color: #04161a; background: var(--river); border-color: var(--river); font-weight: 600; }

/* ── Big Play button ── */
#play-btn {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom,0px), 90px); right: 16px;
  z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity .4s ease, transform .4s cubic-bezier(.2,.8,.3,1.2);
}
#play-btn.hidden { opacity: 0; pointer-events: none; transform: scale(0.6); }
.play-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(53,208,196,0.18);
  border: 2px solid rgba(53,208,196,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 0 0 0 rgba(53,208,196,0.4);
  animation: play-pulse 2.4s ease-in-out infinite;
  transition: transform .2s cubic-bezier(.2,.8,.3,1.3), box-shadow .2s;
}
#play-btn:hover .play-circle {
  transform: scale(1.1);
  box-shadow: 0 0 0 16px rgba(53,208,196,0.08);
}
@keyframes play-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(53,208,196,0.4); }
  50%      { box-shadow: 0 0 0 20px rgba(53,208,196,0); }
}
.play-circle svg { margin-left: 6px; }
.play-hint {
  font-family: var(--mono); font-size: 10px; letter-spacing: .10em;
  text-transform: uppercase; color: rgba(234,246,244,0.7);
  margin-top: 8px; white-space: nowrap;
}

/* ── Stop button ── */
#stop-btn {
  position: absolute; top: max(env(safe-area-inset-top,0px),16px); right: 16px;
  z-index: 12; display: none;
  background: rgba(8,20,26,.85); color: var(--river);
  border: 1px solid var(--river); border-radius: 20px;
  padding: 8px 16px; font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: var(--mono);
  backdrop-filter: blur(12px);
  align-items: center; gap: 7px;
}
#stop-btn.visible { display: flex; }

/* ── Central Cine Caption (POC style) ── */
#cine-caption {
  top: max(env(safe-area-inset-top, 0px), 90px);
  left: 50%; transform: translate(-50%, -12px);
  opacity: 0; pointer-events: none;
  background: rgba(6,14,17, 0.85);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  border-radius: 24px; padding: 10px 22px;
  font-family: var(--display); font-size: 19px; font-weight: 600;
  color: var(--ink); letter-spacing: .01em;
  transition: opacity .4s ease, transform .4s ease;
  white-space: nowrap; z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
#cine-caption.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Cine Progress HUD (thin bar top-center) ── */
.cine-hud {
  position: absolute;
  top: max(env(safe-area-inset-top, 0px), 75px); left: 50%;
  transform: translateX(-50%);
  z-index: 12; display: none; width: 90%; max-width: 400px;
  background: rgba(4,22,26,0.85); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
  padding: 10px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); align-items: center; gap: 16px;
}
.cine-hud.visible { display: flex; animation: slideDown 0.4s cubic-bezier(0.2,0.8,0.3,1.2); }
.cine-hud-dist {
  font-family: var(--display); color: #fff; font-size: 22px;
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cine-hud-dist span { font-size: 13px; color: var(--river); font-weight: 400; margin-left: 4px; }
.cine-hud-bar-wrap { flex: 1; height: 4px; background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden; }
.cine-hud-bar { height: 100%; background: var(--river); width: 0%; transition: width 0.1s linear; border-radius: 4px; }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── Loading screen ── */
.loading {
  position: absolute; inset: 0; z-index: 10; background: var(--bg);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; transition: opacity .5s ease;
}
.loading .eyebrow {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: .2em; color: var(--river); text-transform: uppercase;
}
.loading h2 {
  font-family: var(--display); font-size: 38px; color: var(--ink);
  margin: 0; font-weight: 700;
}
.loading .bar {
  width: 220px; height: 2px; background: rgba(255,255,255,.08);
  position: relative; overflow: hidden;
}
.loading .bar span {
  position: absolute; inset: 0; width: 0%;
  background: var(--river); box-shadow: 0 0 10px var(--river-glow);
  transition: width .2s;
}

/* ── Company Label Markers ── */
.company-label-popup .maplibregl-popup-content {
  padding: 0 !important; background: transparent !important;
  box-shadow: none !important; border-radius: 0 !important;
}
.company-label-popup .maplibregl-popup-tip { display: none !important; }
.company-label-popup { transition: opacity 0.3s ease; }
.company-label-popup.clp-hidden { opacity: 0 !important; pointer-events: none !important; }
.clp-inner { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.clp-logo {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.55);
  object-fit: cover; background: #fff; display: block;
  transition: transform 0.2s cubic-bezier(0.2,0.8,0.3,1.2);
}
.clp-inner:hover .clp-logo { transform: scale(1.15); }
.clp-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.clp-name {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 -1px 4px rgba(0,0,0,0.95), 1px 0 4px rgba(0,0,0,0.95), -1px 0 4px rgba(0,0,0,0.95);
  padding: 1px 0; white-space: nowrap; max-width: 90px;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.1;
}
.ap-badge { font-size: 1.1em; margin-left: 3px; vertical-align: -1px; }
#map.zoom-low .clp-name { display: none; }
#map.zoom-low .clp-logo { width: 24px; height: 24px; border-width: 2px; }

/* ── POI Markers (puentes, chiringuitos…) ── */
.mk {
  display: flex; flex-direction: row; align-items: center; cursor: pointer; gap: 6px;
  pointer-events: auto; background: rgba(255,255,255,0.9);
  padding: 4px 10px 4px 6px; border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4); border: 2px solid #ccc; transition: transform 0.2s;
}
.mk.sign { background: transparent; padding: 0; border: none; box-shadow: none; border-radius: 0; }
.mk-icon { font-size: 18px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5)); }
.mk-label {
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: #111;
  white-space: nowrap;
}
.mk:hover { transform: scale(1.08); }

/* ── Emoji icon layer ── */
.mk-icon-emoji {
  width: 40px; height: 40px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.6);
}

/* ── MapLibre Rich Popup ── */
.rich-popup .maplibregl-popup-content {
  padding: 0; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
  border: 1px solid rgba(0,0,0,0.08);
}
.rich-popup .maplibregl-popup-close-button {
  width: 30px; height: 30px; font-size: 20px; color: #555;
  z-index: 2; right: 4px; top: 4px; border-radius: 50%;
}
.rich-popup .maplibregl-popup-close-button:hover { background: rgba(0,0,0,0.05); }

/* Esconder todo el UI cuando el popup nativo (rich) de MapLibre está abierto, y elevar el mapa */
body.popup-open .hud, body.popup-open #canoa-sphere, body.popup-open #bottom-sheet-nav { display: none !important; }
body.popup-open #map { z-index: 99999 !important; }

/* En móvil el popup nativo puede ser muy grande */
@media (max-width: 768px) {
  .rich-popup {
    position: fixed !important;
    top: auto !important; bottom: 0 !important;
    left: 0 !important; right: 0 !important;
    width: 100% !important; transform: none !important;
    z-index: 99999 !important;
  }
  .rich-popup .maplibregl-popup-content {
    border-radius: 18px 18px 0 0 !important;
    width: 100vw !important; max-width: 100vw !important;
  }
  .rich-popup .maplibregl-popup-tip { display: none !important; }
}

/* ── Float card (cine poi info) ── */
.float-card {
  position: fixed; bottom: max(env(safe-area-inset-bottom, 0px), 100px);
  left: 50%; z-index: 30;
  background: rgba(12, 20, 26, 0.72);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px; padding: 16px 20px;
  backdrop-filter: blur(14px); width: 90%; max-width: 320px;
  color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  transform: translate(-50%, 20px) scale(0.9);
  transition: transform .5s cubic-bezier(.16,1,.3,1.2), opacity .5s ease;
  opacity: 0; pointer-events: none;
  display: flex; gap: 14px; align-items: center;
}
.float-card.show { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }
.fc-logo {
  width: 54px; height: 54px; border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15); flex-shrink: 0;
}
.fc-content { flex: 1; }
.float-card .fc-type {
  font-family: var(--mono); font-size: 10px; letter-spacing: .2em;
  color: var(--river); text-transform: uppercase; font-weight: 600; margin-bottom: 4px;
}
.float-card .fc-name {
  font-family: var(--display); font-size: 20px; font-weight: 700;
  line-height: 1.1; letter-spacing: -.01em;
}
.float-card .fc-desc { font-family: var(--mono); font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 4px; }

/* ── Canoe marker ── */
.canoe-marker {
  width: auto; height: auto;
  background: transparent; border: none; box-shadow: none;
  pointer-events: none; z-index: 10;
}

/* ── Walker animation ── */
.conn-walker {
  position: absolute; pointer-events: none; z-index: 25;
  font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  animation: walker-bounce 0.45s steps(2) infinite;
}
@keyframes walker-bounce {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

/* ── SEO overlay ── */
.seo-overlay {
  position: absolute; top: max(env(safe-area-inset-top, 0px), 16px); left: 60px;
  z-index: 10; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  backdrop-filter: blur(8px); padding: 8px 16px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.6);
  transition: opacity 0.4s ease;
}
.seo-overlay h1 { margin: 0; font-size: 14px; font-weight: 800; color: #04161a; }
.seo-overlay p { margin: 2px 0 0; font-size: 11px; color: #5c6e7a; font-weight: 600; }

/* ── SEO content (visually hidden) ── */
.seo-content {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border-width: 0;
}

/* ── End overlay ── */
#cine-end-overlay {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(6,13,18,.88); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; visibility: hidden; transition: all .4s;
}
#cine-end-overlay.open { opacity: 1; visibility: visible; }
.cef-card {
  background: #fff; color: #04161a; border-radius: 20px;
  padding: 24px; max-width: 400px; width: 100%; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.cef-card h2 { font-family: var(--display); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.cef-card p { font-size: 13px; color: #5c6e7a; margin-bottom: 20px; line-height: 1.4; }
.cef-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.cef-btn {
  background: #f4f6f8; border: 1px solid #e1e7eb; border-radius: 12px;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-family: inherit; transition: all .2s;
}
.cef-btn:hover { background: #eefaf9; border-color: var(--river); transform: translateY(-2px); }
.cef-dist { font-family: var(--display); font-size: 18px; font-weight: 700; color: #04161a; }
.cef-meta { font-family: var(--mono); font-size: 11px; color: #5c6e7a; }
.cef-all {
  width: 100%; padding: 14px; background: #04161a; color: #fff;
  border: none; border-radius: 12px; font-weight: 700;
  font-family: inherit; cursor: pointer; margin-bottom: 12px;
}
.cef-all:hover { background: #0a2a32; }
.cef-close {
  background: transparent; border: none; color: #5c6e7a;
  font-size: 12px; font-weight: 600; cursor: pointer;
  text-decoration: underline; font-family: inherit;
}

/* ── Tour active: hide markers ── */
#map.tour-active .mk:not(.sign),
#map.tour-active .mk-canoe { opacity: 0 !important; pointer-events: none !important; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .poi-panel { display: none; } /* Hidden on small screens */
  .brand h1 { font-size: 20px; }
  .stat-card .val { font-size: 20px; }
  .stats { gap: 6px; }
  .stat-card { padding: 8px 12px; min-width: 70px; }
  .cine-hud {
    top: max(env(safe-area-inset-top, 0px), 12px);
    left: 12px; transform: none;
    width: auto; max-width: 130px;
    padding: 6px 12px; gap: 0; border-radius: 20px;
  }
  .cine-hud-bar-wrap { display: none; }
  .cine-hud-dist { font-size: 15px; }
  .play-circle { width: 68px; height: 68px; }
}
@media (max-width: 480px) {
  .cef-grid { grid-template-columns: 1fr 1fr; }
}

/* ── MAP MODE SELECTOR ── */
#map-mode-selector {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: rgba(13, 20, 28, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 24px;
  text-align: center;
}

#map-mode-selector.active {
  opacity: 1;
  pointer-events: auto;
}

#map-mode-selector h2 {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 40px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.mode-cards-container {
  display: flex;
  gap: 24px;
  max-width: 800px;
  width: 100%;
}

.mode-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mode-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.4);
}

.mode-card .icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.mode-card h3 {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.mode-card p {
  color: #c9d6df;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 768px) {
  .mode-cards-container {
    flex-direction: column;
  }
  #map-mode-selector h2 {
    font-size: 22px;
    margin-bottom: 24px;
  }
  .mode-card {
    padding: 24px 16px;
  }
}
