/* Guía virtual de Cartagena (/guia/): chat en pantalla completa, pensado primero para el celular. */
:root {
    --azul: #0d3b8e;
    --azul-2: #1d4ed8;
    --azul-claro: #e8efff;
    --fondo: #f3f6fb;
    --tinta: #0f172a;
    --gris: #64748b;
    --borde: #e2e8f0;
    --wa: #25d366;
    --wa-oscuro: #1da851;
    --marca: linear-gradient(90deg, #e6007e 0%, #f7941d 45%, #ffd400 70%, #2e9be0 100%);
    --radio: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--tinta);
    background: var(--fondo);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
button, textarea { font: inherit; color: inherit; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #f7941d; outline-offset: 2px; }

/* ── Estructura ─────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.barra {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
    background: #fff;
    box-shadow: 0 1px 0 var(--borde), 0 6px 18px -14px rgba(13, 59, 142, .45);
    z-index: 2;
}
.barra::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -3px;
    height: 3px;
    background: var(--marca);
}
.barra-marca { flex: none; display: block; line-height: 0; border-radius: 12px; }
.barra-marca img { width: 40px; height: 40px; object-fit: contain; }
.barra-titulos { flex: 1; min-width: 0; }
.barra-titulos h1 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--azul);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.barra-titulos p { margin: 1px 0 0; font-size: .75rem; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-boton {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
}
.barra-icono, .barra-wa { width: 40px; }
.barra-icono { background: var(--azul-claro); color: var(--azul); }
.barra-icono:hover { background: #dbe6ff; }
.barra-icono svg { width: 20px; height: 20px; }
.barra-wa { background: var(--wa); color: #fff; }
.barra-wa:hover { background: var(--wa-oscuro); }
.barra-wa svg { width: 22px; height: 22px; }
.barra-instalar {
    padding: 0 14px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--azul);
    background: #fff;
    box-shadow: inset 0 0 0 1.5px var(--azul);
}
.barra-instalar[hidden] { display: none; }

.previa {
    margin: 0;
    padding: 8px 14px;
    font-size: .78rem;
    text-align: center;
    color: #7c2d12;
    background: #ffedd5;
    border-bottom: 1px solid #fed7aa;
}

.chat { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat-columna { max-width: 760px; margin: 0 auto; padding: 18px 14px 12px; }

/* ── Mensajes ───────────────────────────────────────────── */
.mensajes { list-style: none; margin: 0; padding: 0; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin: 12px 0; }
.msg-user { justify-content: flex-end; }
.msg-avatar { flex: none; width: 32px; height: 32px; padding: 3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--borde); object-fit: contain; }

.burbuja {
    max-width: min(85%, 600px);
    padding: 10px 14px;
    font-size: .95rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
    border-radius: var(--radio) var(--radio) var(--radio) 6px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 0 0 1px rgba(15, 23, 42, .04);
}
.msg-user .burbuja {
    color: #fff;
    border-radius: var(--radio) var(--radio) 6px var(--radio);
    background: linear-gradient(135deg, var(--azul-2), var(--azul));
    box-shadow: 0 4px 14px -6px rgba(13, 59, 142, .55);
    white-space: pre-wrap;
}
.burbuja p { margin: .3em 0; }
.burbuja p:first-child, .burbuja ul:first-child { margin-top: 0; }
.burbuja p:last-child, .burbuja ul:last-child { margin-bottom: 0; }
.burbuja ul { margin: .4em 0; padding-left: 1.15em; }
.burbuja li { margin: .25em 0; padding-left: .15em; }
.burbuja li::marker { color: #f7941d; }
.msg-assistant .burbuja strong { font-weight: 600; color: var(--azul); }
.burbuja a.enlace {
    font-weight: 600;
    color: var(--azul-2);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(29, 78, 216, .3);
    text-underline-offset: 3px;
}
.burbuja a.enlace:hover { text-decoration-color: var(--azul-2); }
.burbuja .nota { margin-top: .5em; font-size: .8rem; color: var(--gris); font-style: italic; }

/* Escribiendo… */
.escribiendo { display: inline-flex; gap: 5px; padding: 6px 2px; }
.escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: salto 1.2s infinite ease-in-out; }
.escribiendo span:nth-child(2) { animation-delay: .15s; }
.escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes salto { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }

/* Aviso de error dentro de la burbuja del guía */
.burbuja.con-error { background: #fff7ed; box-shadow: 0 0 0 1px #fed7aa; }
.error-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.boton-recargar {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 14px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--azul);
    background: #fff;
    border: 0;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1.5px var(--azul);
    cursor: pointer;
}

/* Botón de WhatsApp (errores y página «Muy pronto») */
.boton-wa {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--wa);
    border-radius: 999px;
}
.boton-wa:hover { background: var(--wa-oscuro); }
.boton-wa svg { width: 18px; height: 18px; flex: none; }

/* Preguntas sugeridas */
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px 40px; }
.sugerencias[hidden] { display: none; }
.sugerencia {
    padding: 9px 14px;
    font-size: .85rem;
    line-height: 1.3;
    text-align: left;
    color: var(--azul);
    background: #fff;
    border: 1px solid #c7d6f5;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .15s;
}
.sugerencia:hover { background: var(--azul-claro); border-color: var(--azul-2); }
.sugerencia:active { transform: scale(.98); }

/* ── Redactor ───────────────────────────────────────────── */
.pie {
    padding: 10px 12px calc(env(safe-area-inset-bottom) + 8px);
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--borde);
}
.redactor {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 760px;
    margin: 0 auto;
    padding: 5px 5px 5px 16px;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 26px;
    transition: border-color .15s, box-shadow .15s;
}
.redactor:focus-within { border-color: var(--azul-2); box-shadow: 0 0 0 4px rgba(29, 78, 216, .12); }
.redactor textarea {
    flex: 1;
    min-width: 0;
    max-height: 140px;
    padding: 9px 0;
    font-size: 16px; /* con menos, iOS acerca la página al escribir */
    line-height: 1.4;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
}
.redactor textarea::placeholder { color: #94a3b8; }
.redactor-enviar {
    flex: none;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--azul-2), var(--azul));
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}
.redactor-enviar:active { transform: scale(.94); }
.redactor-enviar svg { width: 20px; height: 20px; }
.redactor-enviar .icono-detener { display: none; }
.redactor.enviando .redactor-enviar { background: #334155; }
.redactor.enviando .icono-enviar { display: none; }
.redactor.enviando .icono-detener { display: block; }
/* Verificación anti-robots (Turnstile, modo «solo si hace falta»): vacía no ocupa sitio; si Cloudflare pide un clic,
   el recuadro aparece aquí, encima del aviso */
.verificacion { display: flex; justify-content: center; }
.verificacion:not(:empty) { margin-top: 8px; }
.pie-aviso { max-width: 760px; margin: 6px auto 0; font-size: .7rem; line-height: 1.35; text-align: center; color: var(--gris); }

/* ── Página «Muy pronto» ────────────────────────────────── */
.pronto {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 460px;
    margin: 0 auto;
    padding: 32px 24px;
    text-align: center;
}
.pronto-logo { width: 88px; height: 88px; object-fit: contain; }
.pronto-etiqueta { margin: 18px 0 0; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--gris); }
.pronto h1 { margin: 4px 0 10px; font-size: 1.9rem; color: var(--azul); }
.pronto p { margin: 0 0 22px; line-height: 1.6; color: #334155; }
.pronto .boton-wa { height: 46px; padding: 0 22px; font-size: .95rem; }
.pronto-volver { margin-top: 18px; font-size: .9rem; color: var(--azul-2); }

@media (max-width: 400px) {
    .barra { gap: 8px; }
    .barra-titulos h1 { font-size: .9rem; letter-spacing: -.01em; }
    .barra-icono, .barra-wa { width: 38px; height: 38px; }
}

@media (min-width: 768px) {
    .barra { padding-left: max(24px, calc((100vw - 812px) / 2)); padding-right: max(24px, calc((100vw - 812px) / 2)); }
    .barra-titulos h1 { font-size: 1.1rem; }
    .burbuja { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
