/*
 * AllAIs — Estilos del onboarding tour (Tarea #5b)
 * ===================================================
 *
 * Tour nativo sin dependencias externas. Backdrop + tooltip clásicos para los
 * pasos 1-3 y 5; ventana embebida de demo multi-modelo para el paso 4.
 * Respeta la paleta de la landing (dark + cyan) y las preferencias de
 * animación suave (nada "centelleante").
 */

/* ============================================================================
 *  Overlay / backdrop
 * ========================================================================= */
.allais-tour-root[hidden] { display: none !important; }
.allais-tour-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  color: #e8edf5;
  font: 15px/1.55 "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  pointer-events: none; /* backdrop lo gestionará el hijo */
  /* Centra verticalmente la demo embebida (paso 4) dentro del viewport.
     Los hijos posicionados (backdrop, highlight, tooltips) son position:
     absolute/fixed, así que no les afecta este flex — solo queda fuera del
     flujo normal la .allais-tour-demo, que sí se beneficia. */
  display: flex;
  align-items: center;
  justify-content: center;
}
.allais-tour-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 700px at 50% 50%, rgba(12, 11, 22, 0.84), rgba(5, 7, 11, 0.94));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  /* Solo intercepta clics mientras la guia esta abierta. Antes era `auto`
     siempre, de modo que al cerrar quedaba un panel invisible (opacity: 0)
     cubriendo la pantalla y tragandose todos los clics hasta que el
     setTimeout de tour.js marcaba `hidden` 240 ms despues; si ese temporizador
     se retrasaba (pestana en segundo plano), el bloqueo era permanente. */
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}
.allais-tour-root.is-open .allais-tour-backdrop { opacity: 1; pointer-events: auto; }

/* ============================================================================
 *  Highlight (si el paso apunta a un target)
 * ========================================================================= */
.allais-tour-highlight {
  position: absolute;
  pointer-events: none;
  border-radius: 14px;
  box-shadow:
    0 0 0 3px rgba(139, 124, 255, 0.65),
    0 0 0 9999px rgba(5, 7, 11, 0.62);
  transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease, opacity 160ms ease;
  opacity: 0;
}
.allais-tour-highlight.is-visible { opacity: 1; }

/* ============================================================================
 *  Tooltip (pasos 1, 2, 3, 5)
 * ========================================================================= */
.allais-tour-tooltip {
  position: absolute;
  pointer-events: auto;
  max-width: 420px;
  min-width: 300px;
  background: linear-gradient(180deg, rgba(12, 11, 22, 0.98) 0%, rgba(8, 14, 24, 0.98) 100%);
  border: 1px solid rgba(139, 124, 255, 0.3);
  border-radius: 16px;
  padding: 22px 26px 20px;
  box-shadow:
    0 24px 60px -16px rgba(0, 0, 0, 0.7),
    0 0 32px -8px rgba(139, 124, 255, 0.25);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 240ms ease, transform 240ms ease;
}
.allais-tour-tooltip.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.allais-tour-tooltip .tour-eyebrow {
  color: #a79bff;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 8px;
}
.allais-tour-tooltip h3 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: #f3f6fb;
}
.allais-tour-tooltip p {
  margin: 0 0 18px;
  color: #c6d1e2;
  font-size: 14.5px;
  line-height: 1.6;
}
.allais-tour-tooltip .tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.allais-tour-tooltip .tour-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}
.allais-tour-tooltip .tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(139, 124, 255, 0.25);
  transition: background 180ms ease, transform 180ms ease;
}
.allais-tour-tooltip .tour-dot.is-current {
  background: #a79bff;
  transform: scale(1.3);
}
.allais-tour-tooltip .tour-nav { display: flex; gap: 10px; }

.allais-tour-btn {
  appearance: none;
  border: 1px solid rgba(139, 124, 255, 0.35);
  background: transparent;
  color: #e8edf5;
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.allais-tour-btn:hover {
  background: rgba(139, 124, 255, 0.1);
}
.allais-tour-btn.is-primary {
  background: #a79bff;
  border-color: #a79bff;
  color: #0b0a14;
}
.allais-tour-btn.is-primary:hover { filter: brightness(1.08); }
.allais-tour-btn.is-ghost {
  color: #9ba9c0;
  border-color: transparent;
  padding: 9px 10px;
}
.allais-tour-btn.is-ghost:hover { color: #e8edf5; background: rgba(255, 255, 255, 0.04); }

.allais-tour-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #9ba9c0;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.allais-tour-close:hover { background: rgba(255, 255, 255, 0.06); color: #e8edf5; }
.allais-tour-close svg { width: 16px; height: 16px; }

/* Flecha indicadora del tooltip (apunta al target) */
.allais-tour-tooltip::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: inherit;
  border: inherit;
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
  opacity: 0;
}
.allais-tour-tooltip[data-arrow="top"]::before    { opacity: 1; top: -8px;    left: 32px; }
.allais-tour-tooltip[data-arrow="bottom"]::before { opacity: 1; bottom: -8px; left: 32px; transform: rotate(225deg); }
.allais-tour-tooltip[data-arrow="left"]::before   { opacity: 1; left: -8px;   top: 24px;  transform: rotate(-45deg); }
.allais-tour-tooltip[data-arrow="right"]::before  { opacity: 1; right: -8px;  top: 24px;  transform: rotate(135deg); }

/* ============================================================================
 *  Demo embebida del paso 4 (ventana central, 4 columnas)
 * ========================================================================= */
.allais-tour-demo {
  position: relative;
  pointer-events: auto;
  max-width: min(1180px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(12, 11, 22, 0.98) 0%, rgba(8, 14, 24, 0.98) 100%);
  border: 1px solid rgba(139, 124, 255, 0.3);
  border-radius: 20px;
  padding: 26px 28px 30px;
  box-shadow:
    0 32px 80px -16px rgba(0, 0, 0, 0.8),
    0 0 48px -8px rgba(139, 124, 255, 0.22);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 300ms ease, transform 320ms ease;
  display: flex;
  flex-direction: column;
}
.allais-tour-demo.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.allais-tour-demo .demo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.allais-tour-demo .demo-head .tour-eyebrow { margin: 0; }

.allais-tour-demo .demo-prompt {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.allais-tour-demo .demo-prompt .label {
  color: #9ba9c0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.allais-tour-demo .demo-prompt .text {
  color: #f3f6fb;
  font-family: "Newsreader", Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  font-style: italic;
}

.allais-tour-demo .demo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 980px) { .allais-tour-demo .demo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .allais-tour-demo .demo-grid { grid-template-columns: 1fr; } }

.allais-tour-demo .demo-col {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px 16px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  transition: border-color 220ms ease, background 220ms ease;
}
.allais-tour-demo .demo-col.is-active {
  border-color: rgba(139, 124, 255, 0.3);
  background: rgba(139, 124, 255, 0.04);
}
.allais-tour-demo .demo-col .col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.allais-tour-demo .demo-col .col-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-color, #a79bff);
  box-shadow: 0 0 10px -2px var(--brand-color, #a79bff);
}
.allais-tour-demo .demo-col .col-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #e8edf5;
  letter-spacing: 0.01em;
}
.allais-tour-demo .demo-col .col-body {
  color: #cbd6e6;
  font-size: 14px;
  line-height: 1.55;
  flex: 1;
  white-space: pre-wrap;
  min-height: 110px;
}
.allais-tour-demo .demo-col .col-body .caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  background: #a79bff;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: allais-tour-caret 900ms steps(1) infinite;
}
.allais-tour-demo .demo-col.is-done .col-body .caret { display: none; }
@keyframes allais-tour-caret {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.allais-tour-demo .demo-caption {
  text-align: center;
  color: #9ba9c0;
  font-size: 13.5px;
  padding: 10px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 18px;
}

.allais-tour-demo .demo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ============================================================================
 *  Responsive — móvil
 * ========================================================================= */
@media (max-width: 560px) {
  .allais-tour-tooltip {
    position: fixed;
    left: 16px !important;
    right: 16px !important;
    bottom: 16px;
    top: auto !important;
    max-width: calc(100vw - 32px);
    min-width: 0;
  }
  .allais-tour-tooltip::before { display: none; }
  .allais-tour-demo {
    padding: 20px 18px 22px;
  }
  .allais-tour-demo .demo-prompt .text { font-size: 17px; }
}

/* ============================================================================
 *  Footer discreto para reabrir el tour desde la app
 * ========================================================================= */
.allais-tour-reopen {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 50;
  background: rgba(12, 11, 22, 0.85);
  border: 1px solid rgba(139, 124, 255, 0.25);
  color: #c6d1e2;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, background 160ms ease, color 160ms ease;
}
.allais-tour-reopen.is-visible { opacity: 1; pointer-events: auto; }
.allais-tour-reopen:hover { color: #e8edf5; background: rgba(12, 11, 22, 0.95); }

/* Respetar quienes prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .allais-tour-backdrop,
  .allais-tour-tooltip,
  .allais-tour-demo,
  .allais-tour-highlight {
    transition: opacity 120ms ease;
    transform: none !important;
  }
  .allais-tour-demo .demo-col .col-body .caret { animation: none; }
}
