/* ===========================================================
   AURA — Asistente virtual del Aeropuerto Int. de Maiquetía
   Identidad IAIM: azul marino institucional + amarillo,
   con detalle tricolor. Diseño propio (no reciclar de LUNA).
   =========================================================== */

:root {
  --c-navy-900: #0d1c38;
  --c-navy-800: #17305c;
  --c-navy-700: #1e3e74;
  --c-navy-600: #2a529b;
  --c-navy-400: #5b83c6;
  --c-navy-100: #dfe7f4;
  --c-navy-50: #eef3fa;

  --c-yellow-600: #d9a900;
  --c-yellow-500: #f5c400;
  --c-yellow-300: #ffdf66;
  --c-yellow-50: #fffbea;

  --c-flag-yellow: #f7c600;
  --c-flag-blue: #1e50a0;
  --c-flag-red: #ce2939;

  --c-ink: #16213a;
  --c-ink-soft: #47536e;
  --c-muted: #6d7891;
  --c-line: #d9e1ef;
  --c-bg: #f3f6fb;
  --c-white: #ffffff;

  --shadow-sm: 0 1px 2px rgba(23, 48, 92, 0.07);
  --shadow-md: 0 4px 14px rgba(23, 48, 92, 0.1);
  --shadow-lg: 0 12px 34px rgba(13, 28, 56, 0.16);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-h: 96px;
  --footer-h: 44px;
  --content-max: 900px;
}

@media (max-width: 720px) {
  :root {
    --header-h: 72px;
    --footer-h: 52px;
  }
}

/* ---------- Reset mínimo ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--c-yellow-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 100;
  background: var(--c-navy-800);
  color: var(--c-white);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

/* ---------- Header (azul institucional + línea tricolor) ---------- */
.site-header {
  background: linear-gradient(160deg, var(--c-navy-800) 0%, var(--c-navy-700) 100%);
  color: var(--c-white);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.site-header::after {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--c-flag-yellow) 0%,
    var(--c-flag-yellow) 33.33%,
    var(--c-flag-blue) 33.33%,
    var(--c-flag-blue) 66.66%,
    var(--c-flag-red) 66.66%,
    var(--c-flag-red) 100%
  );
}

.site-header__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px 24px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.site-header__logo {
  height: 58px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  flex: 0 1 auto;
  min-width: 0;
  background: var(--c-white);
  border-radius: 12px;
  padding: 5px 8px;
  box-shadow: var(--shadow-sm);
}

.site-header__brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  margin-left: auto;
  text-align: right;
  border-left: 2px solid rgba(255, 255, 255, 0.22);
  padding-left: 20px;
}

.site-header__brand-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--c-white);
  letter-spacing: 0.08em;
}

.site-header__brand-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-yellow-500);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .site-header__inner {
    padding: 12px 16px;
    gap: 12px;
  }
  .site-header__logo {
    height: 42px;
  }
  .site-header__brand {
    padding-left: 12px;
  }
  .site-header__brand-name {
    font-size: 20px;
  }
  .site-header__brand-tag {
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

@media (max-width: 560px) {
  .site-header__inner {
    padding: 10px 12px;
    gap: 10px;
  }
  .site-header__logo {
    height: 36px;
  }
  .site-header__brand {
    padding-left: 10px;
  }
  .site-header__brand-name {
    font-size: 18px;
  }
  .site-header__brand-tag {
    display: none;
  }
}

/* ---------- Chat ---------- */
.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 24px 0;
  min-height: 0;
}

.chat__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 4px 16px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat__scroll::-webkit-scrollbar {
  width: 10px;
}
.chat__scroll::-webkit-scrollbar-thumb {
  background: var(--c-navy-100);
  border-radius: var(--radius-pill);
}
.chat__scroll::-webkit-scrollbar-thumb:hover {
  background: var(--c-navy-400);
}

.chat__actions {
  position: sticky;
  bottom: 0;
  padding: 16px 0 24px;
  background: linear-gradient(
    to bottom,
    rgba(243, 246, 251, 0) 0%,
    var(--c-bg) 28%
  );
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

@media (max-width: 720px) {
  .chat {
    padding: 16px 14px 0;
  }
  .chat__actions {
    padding: 12px 0 16px;
  }
}

/* ---------- Mensajes ---------- */
.msg {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  max-width: 100%;
  min-width: 0;
  animation: msg-in 0.28s ease-out both;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg--aura {
  justify-content: flex-start;
}
.msg--user {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.msg__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--c-navy-800);
  color: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--c-white);
  outline: 2px solid var(--c-yellow-500);
}

.msg__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg--user .msg__avatar {
  background: var(--c-navy-600);
  color: var(--c-white);
  outline: 2px solid var(--c-navy-100);
}

.msg__bubble {
  flex: 1 1 0;
  min-width: 0;
  max-width: 560px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg--aura .msg__bubble {
  background: var(--c-white);
  color: var(--c-ink);
  border: 1px solid var(--c-line);
  border-bottom-left-radius: 6px;
}

.msg--user .msg__bubble {
  background: linear-gradient(135deg, var(--c-navy-800), var(--c-navy-600));
  color: var(--c-white);
  border-bottom-right-radius: 6px;
}

.msg__bubble p {
  margin: 0;
}
.msg__bubble p + p {
  margin-top: 10px;
}
.msg__bubble strong {
  color: var(--c-navy-700);
}
.msg--user .msg__bubble strong {
  color: var(--c-yellow-300);
}

.msg__sender {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-muted);
  margin-bottom: 6px;
}
.msg--user .msg__sender {
  color: var(--c-yellow-300);
}

.msg__images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}
.msg__images[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}
.msg__image-fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--c-navy-50);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--c-line);
}
.msg__image-fig img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}
.msg__image-fig figcaption {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-navy-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  text-align: center;
  width: 100%;
  background: var(--c-white);
  border-top: 1px solid var(--c-line);
}

/* Lightbox modal para ver imagen ampliada */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(13, 28, 56, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  cursor: zoom-out;
  animation: fade-in 0.18s ease-out;
}
.lightbox.is-open {
  display: flex;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.msg__audio {
  display: block;
  width: 100%;
  margin-top: 12px;
  height: 36px;
  border-radius: var(--radius-pill);
  outline: none;
  accent-color: var(--c-navy-600);
}
.msg__audio::-webkit-media-controls-panel {
  background-color: var(--c-navy-50);
}

/* ---------- Typing indicator ---------- */
.typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-yellow-500);
  animation: typing 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---------- Botones de acción (categorías / preguntas) ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-navy-800);
  background: var(--c-white);
  border: 1.5px solid var(--c-navy-100);
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  min-height: 48px;
  text-align: left;
}

.chip:hover {
  background: var(--c-navy-50);
  border-color: var(--c-navy-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.chip:active {
  transform: translateY(1px);
}

/* Categorías: tarjeta blanca con icono en placa amarilla */
.chip--category {
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  background: var(--c-white);
  color: var(--c-navy-800);
  border: 1.5px solid var(--c-navy-100);
}
.chip--category .chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--c-yellow-50);
  border: 1px solid var(--c-yellow-300);
  font-size: 20px;
  flex-shrink: 0;
}
.chip--category:hover {
  border-color: var(--c-yellow-500);
  background: var(--c-yellow-50);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.chip--question {
  background: var(--c-white);
  color: var(--c-ink);
  font-weight: 500;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  max-width: 100%;
  white-space: normal;
  line-height: 1.4;
}
.chip--question::before {
  content: "›";
  color: var(--c-yellow-600);
  font-weight: 800;
  font-size: 18px;
  margin-right: 4px;
}
.chip--question:hover {
  border-color: var(--c-yellow-500);
  background: var(--c-yellow-50);
}

.chip--nav {
  background: transparent;
  border: 1.5px solid var(--c-navy-400);
  color: var(--c-navy-700);
  border-radius: var(--radius-pill);
}
.chip--nav:hover {
  background: var(--c-navy-100);
}

.chip__icon {
  font-size: 18px;
  line-height: 1;
}

.chip__icon img {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  object-fit: contain;
  display: inline-block;
}

/* Grid para categorías */
.chat__actions[data-layout="categories"] {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Móvil: 2 columnas compactas y altura limitada para que el chat
   siempre quede visible (10 categorías no caben como tarjetas grandes) */
@media (max-width: 639px) {
  .chat__actions {
    max-height: 58vh;
    overflow-y: auto;
  }
  .chat__actions[data-layout="categories"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .chat__actions[data-layout="categories"] .chip--category {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    gap: 8px;
    min-height: 58px;
    line-height: 1.25;
  }
  .chat__actions[data-layout="categories"] .chip--category .chip__icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 9px;
  }
}
.chat__actions[data-layout="categories"] .chip--category {
  justify-content: flex-start;
  min-width: 0;
  width: 100%;
}
@media (min-width: 640px) {
  .chat__actions[data-layout="categories"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
@media (min-width: 1024px) {
  .chat__actions[data-layout="categories"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Lista para preguntas */
.chat__actions[data-layout="questions"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat__actions[data-layout="questions"] .chip--question {
  width: 100%;
  justify-content: flex-start;
}

/* Navegación después de respuesta */
.chat__actions[data-layout="nav"] {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Presencia visual de AURA (kiosco / desktop ancho) ---------- */
.presence {
  display: none;
}

@media (min-width: 1280px) {
  body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .site-header,
  .site-footer {
    grid-column: 1 / -1;
  }
  .chat {
    grid-column: 1;
    grid-row: 2;
    max-width: 720px;
    margin-left: auto;
    margin-right: 0;
    padding-right: 24px;
  }
  .presence {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px 24px 8px;
    min-height: 0;
  }
}

@media (min-width: 1600px) {
  body {
    grid-template-columns: minmax(0, 1fr) 520px;
  }
  .chat {
    max-width: 820px;
  }
}

.presence__card {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(180deg, #f3f6fb 0%, #dfe7f4 100%);
  box-shadow: var(--shadow-lg);
}

.presence__idle,
.presence__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.presence__video {
  display: none;
}
.presence__video.is-playing {
  display: block;
}
.presence.is-speaking .presence__idle {
  visibility: hidden;
}

/* Sutil respiración cuando está idle */
@keyframes presence-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}
.presence__idle {
  animation: presence-breathe 4s ease-in-out infinite;
}

/* Banda institucional al pie — cubre el watermark D-ID sin tapar a Aura */
.presence__band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    rgba(13, 28, 56, 0) 0%,
    rgba(13, 28, 56, 0.35) 30%,
    rgba(13, 28, 56, 0.85) 55%,
    var(--c-navy-900) 72%,
    var(--c-navy-900) 100%
  );
  color: var(--c-white);
  padding: 34px 18px 12px;
  text-align: center;
  pointer-events: none;
}
.presence__band-name {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.presence__band-tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--c-yellow-500);
  margin-top: 3px;
}

/* En pantallas anchas, oculta el control de audio en burbuja
   (el sonido viene del video del panel) */
@media (min-width: 1280px) {
  .msg__audio {
    display: none;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-navy-900);
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-size: 12px;
  padding: 14px 16px;
  letter-spacing: 0.02em;
  border-top: 3px solid var(--c-yellow-500);
}

/* ---------- Kiosco (pantallas muy grandes) ---------- */
@media (min-width: 1200px) {
  :root {
    --content-max: 1000px;
    --header-h: 112px;
  }
  body {
    font-size: 17px;
  }
  .site-header__logo {
    height: 68px;
  }
  .site-header__brand-name {
    font-size: 32px;
  }
  .msg__bubble {
    font-size: 17px;
    padding: 16px 22px;
  }
  .chip {
    padding: 14px 22px;
    font-size: 15px;
    min-height: 56px;
  }
  .chip--question {
    font-size: 16px;
  }
}

@media (min-width: 1600px) {
  :root {
    --content-max: 1100px;
  }
  body {
    font-size: 18px;
  }
}

/* ---------- Reducción de movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
