/* ═══════════════════════════════════════════════════════════════
   GERI — Virtual Concierge del GR Team
   El botón flotante (#geri-float) está retirado — ver el bloque de
   abajo. Geri se abre ahora solo desde el CTA "Hablar con el Agente
   Virtual" en fichas de ciudad/evento (includes/geri_cta.php), vía
   window.openGeriPanel(). WhatsApp (.wa-float, en main.css) ha vuelto
   a bottom:28px al quedar libre ese hueco.
   ═══════════════════════════════════════════════════════════════ */

/* z-index: sits above the site's ambient bottom banners (cookie consent
   strip z:9990, language banner z:9960, geo/lead mobile notices z:9965,
   geo/lead popups z:9970) so the launcher is always visible/tappable —
   but below the cookie preferences deep-panel (z:9995), which is a true
   blocking modal and should keep priority. */
#geri-float {
  /* Retired as a sitewide floating trigger — Geri is now opened only from the
     explicit "Hablar con el Agente Virtual" CTA on city and event pages (see
     includes/geri_cta.php). The button/markup stays in the DOM (geri.js still
     reads #geri-btn) purely so the panel wiring keeps working; it's just never
     shown. */
  display: none !important;
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9993;
  align-items: center;
  gap: 8px;
}
#geri-float .geri-tip {
  background: var(--k2);
  border: 1px solid rgba(184,149,42,.25);
  color: var(--c);
  font-size: 11px;
  padding: 7px 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(7px);
  transition: all .25s var(--ease);
  pointer-events: none;
}
#geri-float:hover .geri-tip,
#geri-float.geri-tip-auto .geri-tip { opacity: 1; transform: none; pointer-events: none; }

#geri-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g) 0%, var(--g2) 100%);
  border: 2px solid rgba(255,255,255,.18);
  color: var(--k);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fd);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 5px 22px rgba(184,149,42,.35);
  transition: transform .2s, box-shadow .2s;
}
#geri-btn:hover { transform: scale(1.08); box-shadow: 0 5px 30px rgba(184,149,42,.55); }
#geri-btn .geri-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #25D366;
  border: 2px solid var(--k);
}

/* ── Chat panel ─────────────────────────────────────────────── */
#geri-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(100vh - 212px));
  background: var(--k2);
  border: 1px solid rgba(184,149,42,.22);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  z-index: 9993;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
#geri-panel.geri-open { display: flex; }
#geri-panel.geri-in { opacity: 1; transform: none; }

#geri-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--k3);
  border-bottom: 1px solid rgba(184,149,42,.15);
  flex-shrink: 0;
}
#geri-hdr .geri-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g) 0%, var(--g2) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fd); font-weight: 600; color: var(--k); font-size: 14px;
  flex-shrink: 0;
}
#geri-hdr .geri-hdr-txt { flex: 1; min-width: 0; }
#geri-hdr .geri-hdr-name { font-family: var(--fd); font-size: 14px; color: var(--c); font-weight: 500; }
#geri-hdr .geri-hdr-sub { font-size: 10px; color: var(--g2); letter-spacing: .8px; text-transform: uppercase; }
#geri-hdr .geri-hdr-btns { display: flex; gap: 4px; }
#geri-hdr button {
  background: transparent; border: none; color: var(--dimmest);
  width: 26px; height: 26px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s;
}
#geri-hdr button:hover { color: var(--g2); }

#geri-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#geri-msgs::-webkit-scrollbar { width: 3px; }
#geri-msgs::-webkit-scrollbar-thumb { background: var(--g); }

.geri-msg {
  max-width: 85%;
  font-size: 13.5px;
  line-height: 1.55;
  padding: 10px 13px;
  white-space: pre-wrap;
}
.geri-msg.geri-agent {
  align-self: flex-start;
  background: var(--k3);
  border: 1px solid rgba(184,149,42,.14);
  color: var(--c);
  border-radius: 2px 12px 12px 12px;
}
.geri-msg.geri-user {
  align-self: flex-end;
  background: var(--g);
  color: var(--k);
  border-radius: 12px 2px 12px 12px;
  font-weight: 500;
}
.geri-typing {
  align-self: flex-start;
  display: flex; gap: 4px;
  padding: 12px 14px;
  background: var(--k3);
  border-radius: 2px 12px 12px 12px;
}
.geri-typing span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--g2);
  animation: geriTyping 1.1s ease-in-out infinite;
}
.geri-typing span:nth-child(2) { animation-delay: .15s; }
.geri-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes geriTyping { 0%,60%,100%{opacity:.3;transform:translateY(0)} 30%{opacity:1;transform:translateY(-2px)} }

/* ── Summary card ───────────────────────────────────────────── */
.geri-summary {
  align-self: stretch;
  background: var(--k3);
  border: 1px solid rgba(184,149,42,.3);
  padding: 14px;
}
.geri-summary h4 {
  font-family: var(--fd); font-size: 13px; color: var(--g2);
  font-weight: 500; margin-bottom: 10px; letter-spacing: .3px;
}
.geri-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin-bottom: 12px; }
.geri-summary dt { font-size: 11px; color: var(--dimmest); text-transform: uppercase; letter-spacing: .4px; }
.geri-summary dd { font-size: 12.5px; color: var(--c); }
.geri-summary .geri-summary-q { font-size: 12.5px; color: var(--dim); margin-bottom: 10px; }
.geri-summary-btns { display: flex; gap: 8px; }
.geri-summary-btns button {
  flex: 1; padding: 10px 12px; font-size: 11px; font-weight: 600;
  letter-spacing: .5px; text-transform: uppercase; cursor: pointer;
  border: none; transition: opacity .2s;
}
.geri-summary-btns button:hover { opacity: .85; }
#geri-confirm-btn { background: var(--g); color: var(--k); }
#geri-modify-btn { background: transparent; border: 1px solid rgba(184,149,42,.3) !important; color: var(--dim); }

.geri-wa-cta {
  align-self: stretch;
  display: block;
  text-align: center;
  background: #25D366;
  color: #fff;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .6px;
  text-decoration: none;
  margin-top: 4px;
}

.geri-gdpr {
  font-size: 10px;
  color: var(--dimmest);
  padding: 8px 16px;
  border-top: 1px solid rgba(184,149,42,.1);
  flex-shrink: 0;
}
.geri-gdpr a { color: var(--g2); text-decoration: underline; }

#geri-inputrow {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(184,149,42,.15);
  flex-shrink: 0;
}
#geri-input {
  flex: 1;
  background: var(--k3);
  border: 1px solid rgba(184,149,42,.18);
  color: var(--c);
  font-family: var(--fs);
  font-size: 13px;
  padding: 10px 12px;
  resize: none;
  max-height: 80px;
}
#geri-input:focus { outline: none; border-color: var(--g); }
#geri-sendbtn {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--g); color: var(--k); border: none;
  cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s;
}
#geri-sendbtn:hover { opacity: .85; }
#geri-sendbtn:disabled { opacity: .4; cursor: default; }

/* ── Mobile ─────────────────────────────────────────────────────
   Below 600px (covers essentially all phones, portrait and most
   landscape) the chat becomes a true full-screen takeover instead of a
   floating box. This is the same pattern the site already uses for its
   own mobile nav (.mob) and geo/lead modals — and it fully eliminates
   any possibility of colliding with the cookie banner, language banner,
   or any other bottom-fixed element: while open, Geri IS the screen.
   ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* #geri-float is display:none sitewide now (see base rule above); these
     rules are harmless leftovers kept only in case the launcher is ever
     re-enabled. */
  #geri-float .geri-tip { display: none; }
  #geri-btn { width: 46px; height: 46px; font-size: 16px; }

  #geri-panel {
    position: fixed;
    inset: 0;
    bottom: 0; right: 0; left: 0; top: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    height: 100dvh; /* dynamic viewport height — shrinks with the on-screen keyboard
                        on browsers that support it; geri.js's visualViewport sync
                        below is the authoritative fix, this is just a CSS-only
                        baseline for the instant before JS runs (or if it can't). */
    max-height: none;
    border: none;
    z-index: 10050; /* above the mobile nav (10010) / hamburger (10020) too — while
                        actively chatting, Geri takes full priority over everything */
    transform: translateY(100%);
  }
  #geri-panel.geri-in { transform: translateY(0); }

  #geri-hdr {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  }
  #geri-hdr button {
    width: 34px; height: 34px; font-size: 18px;
  }
  #geri-inputrow {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  #geri-input { font-size: 16px; } /* ≥16px avoids iOS Safari auto-zoom on focus */
}

[dir="rtl"] #geri-float { right: auto; left: 28px; }
[dir="rtl"] #geri-panel { right: auto; left: 28px; }
