/* Tuki para Destinos — demo Neuquén. Sistema Tuki Costa. */
:root {
  --canvas: #f8fbfc;
  --ink: #13293a;
  --petrol: #1f596b;
  --petrol-dark: #0f3548;
  --marine: #0e2939;
  --sky: #d8e8f4;
  --mist: #edf1f4;
  --muted: #546878;
  --border: #d7dfe4;
  --white: #ffffff;
  --ok: #1d7a55;
  --warn: #9a5b12;

  --font-head: "Instrument Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --r-lg: 20px;
  --r-md: 14px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(14, 41, 57, 0.06), 0 8px 24px rgba(14, 41, 57, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -0.015em; margin: 0; }
a { color: var(--petrol); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--petrol); outline-offset: 2px; border-radius: 6px; }

/* ── Layout principal ─────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, 1fr);
  height: 100dvh;
}
.scene {
  position: relative;
  overflow: hidden;
  background: var(--marine);
  color: var(--white);
}
.scene img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scene::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14, 41, 57, 0.15) 0%, rgba(14, 41, 57, 0) 35%, rgba(14, 41, 57, 0.78) 100%);
}
.scene-content {
  position: absolute; z-index: 1;
  left: clamp(24px, 5vw, 64px); right: clamp(24px, 5vw, 64px); bottom: clamp(28px, 6vh, 64px);
  max-width: 640px;
}
.brandbar {
  position: absolute; z-index: 1; top: 24px; left: clamp(24px, 5vw, 64px); right: 24px;
  display: flex; align-items: center; gap: 12px;
}
.wordmark { font: 700 20px/1 var(--font-head); letter-spacing: -0.02em; color: var(--white); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, 0.16); color: var(--white);
  backdrop-filter: blur(6px);
}
.scene h1 {
  font-size: clamp(40px, 6.2vw, 84px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.scene p {
  margin: 18px 0 0;
  font-size: clamp(16px, 1.4vw, 19px);
  max-width: 34ch;
  color: rgba(255, 255, 255, 0.88);
}
.credit {
  position: absolute; z-index: 1; right: 16px; bottom: 12px;
  font-size: 12px; color: rgba(255, 255, 255, 0.7);
}

/* ── Panel de chat ────────────────────────────────────────────────────────── */
.chat {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--white);
  border-left: 1px solid var(--border);
  min-height: 0;
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px;
  background: var(--petrol);
  display: grid; place-items: center;
}
.chat-head h2 { font-size: 17px; font-weight: 600; }
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.reset {
  margin-left: auto;
  border: 1px solid var(--border); background: var(--white); color: var(--muted);
  padding: 6px 12px; border-radius: var(--r-pill); font-size: 13px;
}
.reset:hover { color: var(--ink); border-color: var(--muted); }

.log {
  flex: 1; overflow-y: auto; min-height: 0;
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.log > * { flex-shrink: 0; }
.msg { max-width: 86%; padding: 11px 15px; border-radius: 18px; white-space: normal; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--mist); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--petrol); color: var(--white); border-bottom-right-radius: 6px; }
.msg.error { align-self: stretch; max-width: none; background: #fdf3e7; color: var(--warn); border-radius: var(--r-md); font-size: 14px; }
.msg strong { font-weight: 600; }

.typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: var(--mist); border-radius: 18px; border-bottom-left-radius: 6px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* Inicio: preguntas sugeridas */
.welcome { padding: 4px 0 8px; }
.welcome h3 { font-size: 22px; font-weight: 600; line-height: 1.2; max-width: 22ch; }
.welcome p { color: var(--muted); margin: 8px 0 16px; font-size: 15px; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestion {
  text-align: left;
  border: 1px solid var(--border); background: var(--white); color: var(--ink);
  padding: 12px 14px; border-radius: var(--r-md); font-size: 15px;
}
.suggestion:hover { border-color: var(--petrol); background: var(--canvas); }

/* Tarjetas de producto */
.products {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 78%);
  gap: 12px; overflow-x: auto; padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
}
.product {
  scroll-snap-align: start;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; display: flex; flex-direction: column;
}
.product img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; background: var(--sky); }
.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product h4 { margin: 0; font: 600 16px/1.25 var(--font-head); letter-spacing: -0.01em; }
.product .where { font-size: 13px; color: var(--muted); }
.product .price { margin-top: 6px; font-size: 14px; }
.product .price b { font: 600 18px/1 var(--font-head); }
.product button { margin-top: 10px; }

.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  border: 0; border-radius: var(--r-pill);
  background: var(--petrol-dark); color: var(--white);
  padding: 11px 18px; font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn:hover { background: var(--marine); }
.btn.secondary { background: var(--white); color: var(--petrol-dark); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--petrol); background: var(--canvas); }
.btn[disabled] { opacity: 0.5; cursor: default; }

/* Fotos que elige el agente */
.photos { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 70%); gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.photos figure { margin: 0; scroll-snap-align: start; border-radius: var(--r-md); overflow: hidden; background: var(--sky); }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photos figcaption { font-size: 12px; color: var(--muted); padding: 6px 10px; background: var(--white); }

/* Cotización y orden */
.sheet {
  align-self: stretch;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--white); overflow: hidden;
}
.sheet-top { display: flex; gap: 12px; padding: 14px; align-items: center; }
.sheet-top img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; }
.sheet-top h4 { margin: 0; font: 600 16px/1.25 var(--font-head); }
.sheet-top .where { font-size: 13px; color: var(--muted); }
.lines { margin: 0; padding: 0 14px; list-style: none; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--mist); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-top: 1px solid var(--border); }
.total b { font: 700 22px/1 var(--font-head); letter-spacing: -0.02em; }
.sheet-actions { display: flex; gap: 8px; padding: 0 14px 14px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; }
.locator { padding: 14px 14px 4px; }
.locator span { font-size: 13px; color: var(--muted); display: block; }
.locator b { font: 700 26px/1.1 var(--font-head); letter-spacing: 0.02em; }
.note { font-size: 13px; color: var(--muted); padding: 0 14px 12px; margin: 0; }

/* Entrada */
.composer { border-top: 1px solid var(--border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--white); }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; max-height: 120px;
  border: 1px solid var(--border); border-radius: 22px;
  padding: 11px 16px; font: inherit; color: var(--ink); background: var(--canvas);
}
.composer textarea:focus { outline: none; border-color: var(--petrol); background: var(--white); }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--petrol-dark); display: grid; place-items: center; flex: none; }
.send[disabled] { opacity: 0.4; cursor: default; }
.fineprint { margin: 8px 4px 0; font-size: 12px; color: var(--muted); }

/* ── Móvil: la foto arriba, el chat ocupa el resto ────────────────────────── */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .scene { height: 26dvh; min-height: 180px; }
  .scene h1 { font-size: clamp(32px, 9vw, 44px); }
  .scene p { display: none; }
  .scene-content { bottom: 20px; left: 16px; right: 16px; }
  .brandbar { top: 14px; left: 16px; }
  .credit { display: none; }
  .chat { border-left: 0; border-radius: 22px 22px 0 0; margin-top: -20px; position: relative; z-index: 2; }
  .chat-head { padding: 14px 16px; }
  .log { padding: 16px; }
  .msg { max-width: 92%; }
  .welcome h3 { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}

/* ── Página de pago ───────────────────────────────────────────────────────── */
.pay {
  min-height: 100dvh;
  display: grid; place-items: start center;
  padding: 32px 16px 48px;
  background: var(--canvas);
}
.pay-card { width: 100%; max-width: 480px; }
.pay-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.pay-brand .wordmark { color: var(--petrol-dark); }
.pay-brand .pill { background: var(--sky); color: var(--petrol-dark); backdrop-filter: none; }
.pay h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.pay .lead { color: var(--muted); margin: 0 0 20px; }
.pay .sheet { box-shadow: var(--shadow); }
.pay .hero-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.details { margin: 0; padding: 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; }
.paybox { padding: 14px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.paybox .btn { width: 100%; padding: 14px 18px; font-size: 16px; }
.paybox small { color: var(--muted); text-align: center; }
.done { text-align: center; padding: 28px 18px 22px; }
.done .check { width: 56px; height: 56px; border-radius: 50%; background: #e3f3ec; display: grid; place-items: center; margin: 0 auto 12px; }
.done h2 { font-size: 24px; }
.done .locator { padding: 10px 0 0; }
.explain { margin: 20px 0 0; padding: 16px; border-radius: var(--r-md); background: var(--mist); font-size: 14px; color: var(--ink); }
.explain h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.explain p { margin: 0; color: var(--muted); }
.back { display: inline-block; margin-top: 18px; font-size: 15px; }
