/* ============================================================
   VERA OVERLAY — CSS compartido
   index.html · agente.html · mi-poliza.html · reportar-siniestro.html
   ============================================================ */

/* FAB */
.fab {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200;
  font-size: .875rem; padding: .7rem 1.4rem;
  box-shadow: 0 8px 28px rgba(26,127,110,.40) !important;
}

/* ── Overlay backdrop ──────────────────────────────────────
   height:100dvh en lugar de inset:0 para que el overlay
   se redimensione automáticamente cuando el teclado iOS sube.
   Sin backdrop-filter para evitar bugs de compositor en Safari.
   ──────────────────────────────────────────────────────────── */
.vera-overlay {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100dvh;
  z-index: 1000;
  background: rgba(7,23,43,.85);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.vera-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Sheet (bottom sheet en mobile) ──
   flex:1 + margin-top:3.5rem → llena el overlay desde 3.5rem
   hasta el borde inferior = borde del teclado cuando está abierto.
   Sin gap visible entre sheet y teclado. ── */
.vera-sheet {
  background: #fff;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  flex: 1;
  margin-top: 3.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(7,23,43,.18);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,.72,0,1);
}
.vera-overlay.open .vera-sheet { transform: translateY(0); }

/* ── Desktop: modal centrado ── */
@media(min-width:640px) {
  .vera-overlay {
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
  .vera-sheet {
    flex: none;
    margin-top: 0;
    width: 100%;
    max-width: 480px;
    height: auto;
    max-height: 82dvh;
    border-radius: var(--radius-xl);
    transform: translateY(20px) scale(.97);
    opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
  }
  .vera-overlay.open .vera-sheet { transform: none; opacity: 1; }
}

/* Handle */
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(13,27,42,.15);
  margin: .75rem auto .25rem;
  flex-shrink: 0;
}
@media(min-width:640px) { .sheet-handle { display: none; } }

/* Header */
.sheet-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(13,27,42,.06);
  flex-shrink: 0;
}
.sheet-avatar {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--teal); color: var(--gold2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.sheet-meta h3 { font-size: .95rem; margin: 0; }
.sheet-status {
  display: flex; align-items: center; gap: .35rem;
  font-size: .72rem; color: var(--ink3);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--teal2);
  animation: pulse 2s ease-in-out infinite;
}
.sheet-close {
  margin-left: auto; font-size: 1.4rem; color: var(--ink3);
  padding: .25rem .5rem; border-radius: .5rem;
  transition: background .2s, color .2s;
}
.sheet-close:hover { background: var(--sand); color: var(--ink); }

/* Messages */
.sheet-messages {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: .6rem;
  scroll-behavior: smooth;
}
.sheet-msg {
  max-width: 85%; padding: .65rem .9rem;
  font-size: .875rem; line-height: 1.5; border-radius: 1rem;
  word-break: break-word; overflow-wrap: anywhere;
}
.sheet-msg p { margin: .2rem 0; }
.sheet-msg ul { padding-left: 1.1rem; margin: .2rem 0; }
.sheet-msg li { margin: .15rem 0; }
.sheet-msg hr { border: none; border-top: 1px solid rgba(13,27,42,.12); margin: .35rem 0; }
.sheet-msg strong { font-weight: 700; }
.sheet-msg em { font-style: italic; }
.sheet-msg--vera  { background: var(--sand); color: var(--ink); border-radius: .25rem 1rem 1rem 1rem; align-self: flex-start; }
.sheet-msg--user  { background: var(--teal); color: #fff; border-radius: 1rem 1rem .25rem 1rem; align-self: flex-end; }
.sheet-msg--error { background: #fef2f2; color: #b91c1c; border-radius: 1rem; align-self: flex-start; }
.sheet-msg--typing span {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--ink3);
  animation: typing 1.2s ease-in-out infinite; margin: 0 2px;
}
.sheet-msg--typing span:nth-child(2) { animation-delay: .2s; }
.sheet-msg--typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Chips */
.sheet-chips {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .5rem 1.25rem 0;
  flex-shrink: 0;
}
.sheet-chip {
  background: var(--sand); color: var(--ink);
  font-size: .8rem; font-weight: 600;
  font-family: "Plus Jakarta Sans", sans-serif;
  padding: .45rem .9rem; border-radius: 9999px;
  border: 1.5px solid rgba(13,27,42,.08);
  transition: background .2s, transform .2s;
}
.sheet-chip:hover { background: var(--teal-light); color: var(--teal); transform: translateY(-1px); }

/* Input */
.sheet-input-area { padding: .75rem 1.25rem 0; flex-shrink: 0; }
.sheet-input-row {
  display: flex; gap: .5rem; align-items: center;
  background: var(--sand); border-radius: var(--radius-md);
  padding: .4rem .4rem .4rem .9rem;
  border: 1.5px solid rgba(13,27,42,.07);
}
.sheet-input-row:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,127,110,.15); }
#sheet-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: .875rem; font-family: inherit; color: var(--ink);
}
#sheet-input::placeholder { color: var(--ink3); }
.sheet-send {
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s, transform .2s;
}
.sheet-send:hover { background: var(--teal2); transform: scale(1.08); }

/* Consent */
.sheet-consent {
  padding: .5rem 1.25rem max(1rem, env(safe-area-inset-bottom));
  font-size: .7rem; color: var(--ink3); text-align: center;
  flex-shrink: 0;
}
.sheet-consent a { text-decoration: underline; text-underline-offset: 2px; }

/* ── Compact mode: teclado iOS abierto ── */
.vera-sheet.kbd-open .sheet-handle { display: none; }
.vera-sheet.kbd-open .sheet-header { padding: .4rem 1.25rem; }
.vera-sheet.kbd-open .sheet-avatar { width: 1.75rem; height: 1.75rem; font-size: .7rem; }
.vera-sheet.kbd-open .sheet-status { display: none; }
.vera-sheet.kbd-open .sheet-chips  { display: none; }
