/* ─── Reset y base ────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0b1f3a;
  --navy-claro: #16335c;
  --wa-verde: #128c7e;
  --wa-verde-osc: #075e54;
  --wa-fondo: #e5ddd5;
  --wa-burbuja-in: #ffffff;
  --wa-burbuja-out: #d9fdd3;
  --texto: #111b21;
  --texto-suave: #667781;
  --radio: 14px;
}

html, body {
  height: 100%;
  max-width: 100%;
  /* La página nunca debe scrollear en horizontal: en un celular eso se ve
     como una web rota, y la mayoría de los prospectos la abren desde ahí. */
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--navy) 0%, #071528 100%);
  color: var(--texto);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ─── Banner de marca ─────────────────────────────────────── */
.marca {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.marca__logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.marca__logo:hover { opacity: 0.82; }

.marca__logo img {
  width: 34px;
  height: 34px;
  display: block;
  /* El isotipo es azul marino sobre un fondo azul marino: sin este halo
     el hexágono se pierde contra el fondo de la página. */
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  padding: 2px;
}

.marca__nombre {
  font-family: "Segoe UI Semibold", "Segoe UI", Inter, -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.32em;
  /* letter-spacing agrega el espacio también después de la última letra:
     esto lo compensa para que el bloque quede ópticamente centrado. */
  text-indent: 0.32em;
  color: #f2f6fb;
  line-height: 1;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}

/* ─── Escena ──────────────────────────────────────────────── */
/* min-width: 0 en toda la cadena: por defecto un flex item no encoge por
   debajo del ancho mínimo de su contenido, y los chips de sugerencia
   (nowrap, sin shrink) imponían ~500px que empujaban la página entera. */
.escena {
  flex: 1;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 42px;
  padding: 32px 20px 40px;
  flex-wrap: wrap;
}

/* ─── Marco del teléfono ──────────────────────────────────── */
.telefono {
  width: 100%;
  min-width: 0;
  /* min() en vez de max-width sola: garantiza que nunca supere el ancho
     disponible, sea cual sea el padding del contenedor. */
  max-width: min(400px, 100%);
  height: min(78vh, 720px);
  min-height: 520px;
  background: var(--wa-fondo);
  border-radius: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), 0 0 0 9px #0d1117,
    0 0 0 10px rgba(255, 255, 255, 0.06);
}

/* ─── Cabecera WhatsApp ───────────────────────────────────── */
.wa-header {
  background: var(--wa-verde-osc);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  flex-shrink: 0;
}

.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #25d366;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.wa-titulo { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.wa-titulo strong { font-size: 15.5px; font-weight: 600; }
.wa-titulo span { font-size: 12px; opacity: 0.85; }

.wa-iconos { display: flex; gap: 18px; flex-shrink: 0; }
.wa-iconos svg { width: 19px; height: 19px; fill: #fff; opacity: 0.9; }

/* ─── Chat ────────────────────────────────────────────────── */
.wa-chat {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--wa-fondo);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.5) 0 1.5px, transparent 1.6px),
    radial-gradient(circle at 70% 65%, rgba(0,0,0,0.035) 0 2px, transparent 2.1px),
    radial-gradient(circle at 45% 85%, rgba(255,255,255,0.4) 0 1.5px, transparent 1.6px);
  background-size: 90px 90px, 130px 130px, 70px 70px;
}

/* El chat es un flex column: sin esto los hijos con alto fijo (las fichas)
   se comprimen en vez de desbordar y generar scroll. */
.wa-chat > * { flex-shrink: 0; }

.wa-aviso {
  align-self: center;
  background: #fdf4c9;
  color: #6b5c1f;
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 6px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

/* ─── Burbujas ────────────────────────────────────────────── */
.burbuja {
  max-width: 82%;
  padding: 7px 10px 6px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.42;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: aparecer 0.22s ease-out;
}

@keyframes aparecer {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.burbuja--bot { align-self: flex-start; background: var(--wa-burbuja-in); border-top-left-radius: 2px; }
.burbuja--yo { align-self: flex-end; background: var(--wa-burbuja-out); border-top-right-radius: 2px; }

.burbuja b { font-weight: 650; }

.burbuja__hora {
  display: block;
  text-align: right;
  font-size: 10.5px;
  color: var(--texto-suave);
  margin-top: 2px;
  user-select: none;
}

.burbuja--yo .burbuja__hora::after {
  content: " ✓✓";
  color: #53bdeb;
  letter-spacing: -2px;
}

/* ─── Tarjeta de propiedad ────────────────────────────────── */
.ficha {
  align-self: flex-start;
  max-width: 82%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
  animation: aparecer 0.28s ease-out;
}

.ficha img {
  width: 100%;
  height: 148px;
  object-fit: cover;
  display: block;
  background: #d5d5d5;
}

.ficha__cuerpo { padding: 8px 10px 9px; }

.ficha__ref {
  font-size: 10.5px;
  color: var(--texto-suave);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ficha__precio {
  font-size: 16px;
  font-weight: 700;
  color: var(--wa-verde-osc);
  margin: 1px 0 3px;
}

.ficha__titulo { font-size: 13.5px; font-weight: 600; line-height: 1.3; }

.ficha__meta {
  font-size: 12.5px;
  color: var(--texto-suave);
  margin-top: 3px;
  line-height: 1.35;
}

/* ─── Indicador de escritura ──────────────────────────────── */
.escribiendo {
  align-self: flex-start;
  background: var(--wa-burbuja-in);
  border-radius: 8px;
  border-top-left-radius: 2px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
}

.escribiendo span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa5ab;
  animation: latir 1.3s infinite ease-in-out;
}

.escribiendo span:nth-child(2) { animation-delay: 0.18s; }
.escribiendo span:nth-child(3) { animation-delay: 0.36s; }

@keyframes latir {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ─── Chips de sugerencia ─────────────────────────────────── */
.wa-chips {
  display: flex;
  min-width: 0;
  gap: 7px;
  padding: 9px 10px;
  overflow-x: auto;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  scrollbar-width: none;
}

.wa-chips::-webkit-scrollbar { display: none; }
.wa-chips:empty { display: none; }

.chip {
  flex-shrink: 0;
  border: 1px solid var(--wa-verde);
  background: #fff;
  color: var(--wa-verde-osc);
  font-size: 12.5px;
  font-weight: 550;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s ease, color 0.14s ease;
}

.chip:hover { background: var(--wa-verde); color: #fff; }

/* ─── Barra de entrada ────────────────────────────────────── */
.wa-barra {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #f0f2f5;
  flex-shrink: 0;
}

.wa-input { flex: 1; background: #fff; border-radius: 22px; padding: 9px 15px; }

.wa-input input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--texto);
  background: transparent;
}

.wa-barra button {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  border: none;
  background: var(--wa-verde);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.wa-barra button:hover:not(:disabled) { transform: scale(1.06); }
.wa-barra button:disabled { opacity: 0.45; cursor: not-allowed; }
.wa-barra button svg { width: 21px; height: 21px; fill: #fff; }

/* ─── Panel lateral ───────────────────────────────────────── */
.notas { max-width: min(340px, 100%); color: #c8d6e8; }

.notas h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #7d95b3;
  margin-bottom: 16px;
  font-weight: 650;
}

.notas ul { list-style: none; display: flex; flex-direction: column; gap: 14px; }

.notas li {
  font-size: 14.5px;
  line-height: 1.55;
  padding-left: 20px;
  position: relative;
}

.notas li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25d366;
}

.notas li strong { color: #fff; font-weight: 650; }

.notas__pie {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  line-height: 1.6;
  color: #8fa5c0;
}

.notas__pie a { color: #4fd1a5; text-decoration: none; }
.notas__pie a:hover { text-decoration: underline; }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .escena { padding: 18px 14px 28px; gap: 28px; }
  .notas { max-width: 400px; order: 2; }
  .telefono {
    height: min(74vh, 640px);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4), 0 0 0 7px #0d1117;
  }
}

@media (max-width: 560px) {
  .marca { padding: 11px 14px; gap: 10px; }
  .marca__logo img { width: 30px; height: 30px; }
  .marca__nombre { font-size: 15px; letter-spacing: 0.28em; text-indent: 0.28em; }
  .escena { padding: 12px 10px 24px; }
  .telefono {
    height: calc(100vh - 150px);
    min-height: 440px;
    border-radius: 18px;
    box-shadow: 0 0 0 5px #0d1117;
  }
  .notas { display: none; }
}
