/* =========================================================
   MVD Factura · Contratación asistida con Eduardo
   Montevideo COMM
   ========================================================= */

/* ---------- Fuentes ---------- */
@font-face {
  font-family: "Trasandina Web";
  src: url("../fonts/trasandina-regular.woff2") format("woff2"),
       url("/plantillas/fonts/trasandinaregular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Trasandina Web";
  src: url("../fonts/trasandina-medium.woff2") format("woff2"),
       url("/plantillas/fonts/trasandinamedium.woff") format("woff");
  font-weight: 500 600; font-style: normal; font-display: swap;
}

/* ---------- Colores de marca ---------- */
:root {
  --navy: #1c285e;
  --blue-dark: #001f8a;
  --blue: #0074C5;
  --blue-light: #4b9ef9;
  --blue-pale: #a9d4ff;
  --text-soft: #4a5480;
  --text-muted: #56608a;
  --text-faint: #8a93b5;
  --line: #e1e6f0;
  --line-input: #d5ddf0;
  --bg: #f5f7fb;
  --bg-soft: #eef1f8;
  --bg-hover: #f3f6ff;
  --orange: #f78823;
  --green: #3aaa35;
  --red: #d93025;
  --red-dark: #b3261e;
}

/* ---------- Base ---------- */
body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font-family: 'Trasandina', 'Trasandina Web', 'Segoe UI', 'Helvetica Neue', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-dark); }
a:hover { color: var(--blue-light); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--navy); box-shadow: 0 1px 0 rgba(255,255,255,.1); }
.topbar__inner { max-width: 1226px; margin: 0 auto; padding: 0 20px; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar__logo { display: flex; align-items: center; text-decoration: none; flex: 0 1 220px; min-width: 140px; }
.topbar__logo img { width: 100%; height: auto; display: block; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__product { font-size: 16px; font-weight: 500; color: #fff; }
.topbar__badge { font-size: 13px; font-weight: 500; color: #fff; background: var(--blue-light); border-radius: 5px; padding: 3px 10px 5px; white-space: nowrap; }

/* ---------- Estructura principal ---------- */
.layout {
  max-width: 1200px; margin: 0 auto; padding: 40px 20px 64px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  gap: 32px 56px; align-items: start;
}
.intro { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-light); }
.intro h1 { margin: 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.1; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
.lead { margin: 0; font-size: 18px; line-height: 1.6; color: var(--text-soft); text-wrap: pretty; }
.lead strong { color: var(--navy); font-weight: 600; }

/* ---------- Bloques de contenido ---------- */
.block { display: flex; flex-direction: column; gap: 18px; }
.block--plans { gap: 16px; }
.block__title { display: flex; flex-direction: column; gap: 12px; }
.block__title--tight { gap: 6px; }
.block__title h2 { margin: 0; font-size: 22px; font-weight: 600; }
.block__title .item-text { margin: 0; }
.rule { display: block; width: 55px; height: 3px; background: var(--blue-light); }
.item-title { font-weight: 600; font-size: 16px; }
.item-text { font-size: 15px; line-height: 1.55; color: var(--text-soft); text-wrap: pretty; }
.strong-link { color: var(--blue-dark); font-weight: 600; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.steps li { display: grid; grid-template-columns: 36px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps__num { width: 32px; height: 32px; border-radius: 50%; background: #e8eeff; color: var(--blue-dark); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.steps__num--last { background: var(--orange); color: #fff; }

.callout { display: flex; gap: 14px; align-items: flex-start; background: var(--bg); border-radius: 12px; padding: 16px 18px; }
.callout svg { flex: none; margin-top: 1px; }
.callout > div { display: flex; flex-direction: column; gap: 4px; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.plan { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.plan__text { font-size: 14px; line-height: 1.5; color: var(--text-soft); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; padding-top: 4px; }
.checks > span { display: flex; align-items: center; gap: 6px; }
.check { color: var(--green); font-weight: 600; }

/* ---------- Preguntas frecuentes ---------- */
.faq { background: #fff; border-top: 1px solid var(--line); }
.faq__inner { max-width: 1200px; margin: 0 auto; padding: 48px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 28px 48px; }
.faq__title { grid-column: 1 / -1; }
.faq__item { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Pie ---------- */
.footer { background: #4a494f; padding: 45px 0; }
.footer__inner { max-width: 1226px; margin: 0 auto; padding: 0 20px; display: flex; flex-direction: column; gap: 28px; }
.footer__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 30px; border-bottom: 1px solid rgba(255,255,255,.2); }
.footer__logo { width: 240px; max-width: 70%; height: auto; display: block; }
.footer__client { color: #fff; text-decoration: none; font-size: 15px; border: 1px solid rgba(255,255,255,.35); border-radius: 5px; padding: 8px 14px; }
.footer__client:hover { color: #fff; border-color: #fff; }
.footer__nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer__nav a { color: #fff; text-decoration: none; font-size: 16px; }
.footer__nav a:hover { color: var(--blue-light); }
.footer__legal { display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.5; color: #b1b1b1; }
.footer__legal a { color: #b1b1b1; }

/* =========================================================
   Panel de conversación
   ========================================================= */
.panel {
  grid-row: span 3; position: sticky; top: 88px;
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 24px 48px -32px rgba(28,40,94,.35);
  display: flex; flex-direction: column; overflow: hidden;
  height: min(680px, calc(100vh - 112px)); min-height: 520px;
}
.panel__head { flex: none; display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }

.icon-btn { flex: none; width: 44px; height: 44px; border: none; border-radius: 50%; background: var(--bg-soft); color: var(--navy); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--line); }

.orb-back { flex: none; position: relative; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--blue-light); padding: 2px; background: #fff; cursor: pointer; }
.orb-back__ball { display: block; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 30% 28%, var(--blue-pale), var(--blue-light) 40%, var(--blue) 70%, var(--navy)); }
.orb-back__arrow { position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: var(--navy); display: flex; align-items: center; justify-content: center; }

.avatar { position: relative; width: 48px; height: 48px; flex: none; }
.avatar__ring { position: absolute; inset: -5px; border-radius: 14px; background: var(--blue-light); opacity: 0; }
.avatar__ring.is-on { opacity: .3; }
.avatar__logo { position: absolute; inset: 0; border-radius: 10px; display: block; }

.head-text { flex: 1; min-width: 0; }
.head-text__name { margin: 0; font-size: 19px; font-weight: 600; }
.head-text__status { margin: 0; font-size: 14px; color: var(--text-muted); }
.head-text__name--sm { font-size: 15px; }
.head-text__status--sm { font-size: 13px; }

.pill-btn { font-size: 13px; font-weight: 500; color: var(--navy); background: var(--bg-soft); border: none; border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.pill-btn:hover { background: var(--line); }

/* Orbe */
.orb-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; }
.orb-stage__label { margin: 0; font-size: 17px; color: var(--text-muted); }
.orb { position: relative; width: min(220px, 56vw); aspect-ratio: 1 / 1; }
.orb__glow { position: absolute; inset: -18px; border-radius: 50%; background: var(--blue-light); opacity: .14; filter: blur(24px); transition: opacity .4s; animation: orbBreathe 3.2s ease-in-out infinite; }
.orb__core { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 32% 28%, var(--blue-pale), var(--blue-light) 38%, var(--blue) 66%, var(--navy)); box-shadow: 0 20px 40px -20px rgba(28,40,94,.55); transition: transform .09s linear; transform: scale(1); }
.orb__swirl { position: absolute; inset: -30%; background: conic-gradient(from 0deg, #4b9ef9, #0074C5, #001f8a, #4b9ef9, #a9d4ff, #0074C5, #4b9ef9); filter: blur(26px); opacity: .8; animation: orbSpin 10s linear infinite; }
.orb__shine { position: absolute; inset: 10%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.55), rgba(255,255,255,0) 55%); animation: orbDrift 5s ease-in-out infinite alternate; }
.orb__mark { position: absolute; left: 50%; top: 50%; width: 30%; transform: translate(-50%,-50%); filter: drop-shadow(0 2px 6px rgba(0,31,138,.35)); }
.orb.is-speaking .orb__glow { opacity: .28; }
.orb.is-speaking .orb__swirl { animation-duration: 5s; }

/* Mensajes */
.messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: #fff; }
.msg-list { display: contents; }
.msg { display: flex; }
.msg--user { justify-content: flex-end; }
.msg--ai { justify-content: flex-start; }
.msg--system { justify-content: center; }
.bubble { max-width: 82%; font-size: 16px; line-height: 1.5; padding: 12px 16px; white-space: pre-wrap; text-wrap: pretty; }
.msg--user .bubble { background: #0b4ea2; color: #fff; border-radius: 16px 16px 4px 16px; }
.msg--ai .bubble { background: var(--bg-soft); color: var(--navy); border-radius: 16px 16px 16px 4px; }
.msg--system .bubble { max-width: none; font-size: 13px; line-height: 1.4; color: var(--text-muted); background: var(--bg-soft); border-radius: 999px; padding: 6px 14px; }

/* Estado inicial */
.empty { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: 12px 0; }
.empty__text { margin: 0; font-size: 16px; line-height: 1.55; color: var(--text-soft); max-width: 360px; text-wrap: pretty; }
.empty__actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 340px; }
.empty__note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); text-wrap: pretty; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; font-weight: 600; border-radius: 999px; padding: 14px 26px; min-height: 52px; cursor: pointer; }
.btn--primary { color: #fff; background: var(--blue-dark); border: none; }
.btn--primary:hover { background: var(--navy); }
.btn--outline { color: var(--blue-dark); background: #fff; border: 1.5px solid var(--blue-dark); }
.btn--outline:hover { background: var(--bg-hover); }
.suggestions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 380px; margin-top: 8px; }
.suggestions__label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.suggestion { font-size: 15px; text-align: left; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.suggestion:hover { border-color: var(--blue-light); background: var(--bg-hover); }

/* Caja de texto */
.composer { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: #fff; }
.composer__field { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.composer input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 16px; color: var(--navy); background: #fff; border: 1.5px solid var(--line-input); border-radius: 999px; padding: 14px 54px 14px 20px; min-height: 54px; outline: none; }
.composer input:focus { border-color: var(--blue-light); }
.send-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: none; border-radius: 50%; background: transparent; color: var(--blue); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.send-btn:disabled { color: #a7afc8; cursor: default; }
.round-btn { flex: none; width: 54px; height: 54px; border: none; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.round-btn--hang { background: var(--red); }
.round-btn--hang:hover { background: var(--red-dark); }
.round-btn--call { background: var(--navy); }
.round-btn--call:hover { background: var(--blue-dark); }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  .topbar__product { display: none; }
  .panel { position: relative; top: auto; height: auto; min-height: 0; }
  .panel.has-messages { height: min(560px, 80dvh); }
}

/* Pantalla completa del chat en celular */
.panel.is-full {
  position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-h, 100dvh);
  min-height: 0; z-index: 50; border: none; border-radius: 0; box-shadow: none;
}
.panel.is-full .panel__head { gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
body.chat-open { position: fixed; left: 0; right: 0; overflow: hidden; }

/* ---------- Animaciones ---------- */
@keyframes orbSpin { to { transform: rotate(360deg); } }
@keyframes orbDrift { 0% { transform: translate(-10%,-8%); } 100% { transform: translate(12%,10%); } }
@keyframes orbBreathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes orbPulse { 0%,100% { transform: scale(1); opacity: .35; } 50% { transform: scale(1.12); opacity: .15; } }

@media (prefers-reduced-motion: reduce) {
  .orb__glow, .orb__swirl, .orb__shine { animation: none !important; }
}
