/* Instalar la app (PWA) — hoja de instalación + entradas del menú (oct. 2026).
   Mobile-first: pensado a 320–430px; en desktop es una card centrada. */

/* Ya es la app instalada: ninguna entrada "Instalar app" tiene sentido. */
html.to-standalone [data-instalar-app],
html.to-standalone .pwa-install-section { display: none !important; }

/* ===== Overlay ===== */
.ia-ov {
  position: fixed; top: 0; left: 0; right: 0;
  height: 100%; height: 100dvh;
  z-index: 100060;                       /* sobre FAB de WhatsApp (99998) y bottom-nav */
  background: rgba(10, 10, 14, .62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: iaFade .2s ease;
}
.ia-ov[hidden] { display: none !important; }
.ia-ov[data-pos="top"] { align-items: flex-start; }
@keyframes iaFade { from { opacity: 0 } to { opacity: 1 } }

/* Con la hoja abierta, los flotantes no compiten. */
html.ia-open .wa-fab, html.ia-open .wa-burbuja, html.ia-open .scroll-top { display: none !important; }

/* ===== Hoja ===== */
.ia-sheet {
  position: relative;
  width: 100%; max-width: 440px;
  max-height: 88%;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(160deg, #1d1d24 0%, #121216 100%);
  color: #f5f5f7;
  border: 1px solid rgba(255, 209, 26, .28);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .45);
  font-family: 'Inter', 'Open Sans', system-ui, sans-serif;
  animation: iaUp .32s cubic-bezier(.2, .9, .3, 1.2);
}
.ia-ov[data-pos="top"] .ia-sheet {
  border-radius: 0 0 24px 24px;
  border-top: 0; border-bottom: 1px solid rgba(255, 209, 26, .28);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 18px;
  animation-name: iaDown;
  max-height: 78%;
}
@keyframes iaUp   { from { transform: translateY(40px); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes iaDown { from { transform: translateY(-40px); opacity: 0 } to { transform: none; opacity: 1 } }

@media (min-width: 577px) {
  .ia-ov, .ia-ov[data-pos="top"] { align-items: center; padding: 20px; }
  .ia-sheet, .ia-ov[data-pos="top"] .ia-sheet {
    border-radius: 24px; border: 1px solid rgba(255, 209, 26, .28);
    padding: 22px 24px 22px;
  }
}

.ia-x {
  position: absolute; top: 10px; right: 10px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .8);
  font-size: 1rem; cursor: pointer;
}
.ia-x:hover, .ia-x:focus-visible { background: rgba(255, 255, 255, .16); color: #fff; outline: none; }

.ia-tit {
  font-family: 'Montserrat', sans-serif; font-weight: 800;
  font-size: 1.22rem; line-height: 1.2;
  margin: 4px 44px 4px 0; color: #fff;
}
.ia-sub { margin: 0 0 14px; font-size: .9rem; line-height: 1.4; color: rgba(245, 245, 247, .72); }
.ia-sub b { color: #ffd11a; }

/* ===== Mini pantalla de inicio (el ícono "aparece") ===== */
.ia-mock {
  display: grid; grid-template-columns: repeat(4, 38px); gap: 10px;
  justify-content: start;
  padding: 12px; margin: 0 44px 12px 0;
  width: max-content; max-width: 100%;
  border-radius: 18px;
  background: linear-gradient(135deg, #2b2b35, #1b1b22);
  border: 1px solid rgba(255, 255, 255, .06);
}
.ia-app {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, .1);
  animation: iaPop .35s ease both; animation-delay: var(--d, 0ms);
}
.ia-app--to {
  background: none; position: relative;
  animation: iaToIn 1.6s ease .3s infinite;
}
.ia-app--to.is-on { animation: iaPop .5s cubic-bezier(.2, .9, .3, 1.5) .35s both; }
.ia-app--to img { width: 100%; height: 100%; border-radius: 10px; display: block; box-shadow: 0 0 0 2px #ffd11a, 0 0 16px rgba(255, 209, 26, .55); }
@keyframes iaPop  { from { transform: scale(.4); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes iaToIn {
  0%   { transform: scale(.3); opacity: 0 }
  25%  { transform: scale(1.12); opacity: 1 }
  35%  { transform: none; opacity: 1 }
  85%  { transform: none; opacity: 1 }
  100% { transform: scale(.3); opacity: 0 }
}

/* ===== Pasos ===== */
.ia-pasos { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.ia-paso {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 0;
  animation: iaPop .35s ease both; animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}
.ia-paso + .ia-paso { border-top: 1px dashed rgba(255, 255, 255, .1); }
.ia-num {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  background: #ffd11a; color: #15151a;
  font-weight: 800; font-size: .88rem;
  display: flex; align-items: center; justify-content: center;
}
.ia-paso-txt { font-size: .95rem; line-height: 1.75; padding-top: 1px; }
.ia-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; margin: 0 1px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  line-height: 1.5; white-space: normal; max-width: 100%; vertical-align: 1px;
}
.ia-chip .bi { color: #4da3ff; font-size: .95rem; }
.ia-chip b { font-weight: 700; color: #fff; }
.ia-chip--txt b { color: #ffd11a; }

.ia-tip, .ia-nota {
  margin: 10px 0 0; padding: 10px 12px;
  border-radius: 12px; font-size: .84rem; line-height: 1.4;
  background: rgba(255, 209, 26, .1); color: rgba(245, 245, 247, .85);
}
.ia-tip b { color: #ffd11a; }
.ia-nota { background: rgba(34, 197, 94, .12); }
.ia-nota .bi { color: #22c55e; }
.ia-o { margin: 14px 0 2px; font-size: .84rem; color: rgba(245, 245, 247, .6); }

/* ===== CTA ===== */
.ia-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px;
  margin: 6px 0 0; padding: 12px 20px;
  border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #ffe066, #ffd11a 55%, #f5bc2f);
  color: #15151a !important; text-decoration: none !important;
  font-weight: 800; font-size: 1rem; cursor: pointer;
  box-shadow: 0 10px 26px rgba(255, 209, 26, .3);
}

.ia-qr { display: flex; justify-content: center; padding: 6px 0 4px; }
.ia-qr img { background: #fff; padding: 10px; border-radius: 16px; width: 180px; height: 180px; }

/* ===== Video opcional ===== */
.ia-video { margin: 12px 0 0; }
.ia-video summary {
  cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; font-size: .9rem; font-weight: 700; color: #ffd11a;
}
.ia-video summary::-webkit-details-marker { display: none; }
.ia-video summary::before { content: '▶'; font-size: .75rem; }
.ia-video video { display: block; width: 100%; max-width: 260px; margin: 6px auto 0; border-radius: 16px; background: #000; }

.ia-foot { margin: 14px 0 0; text-align: center; font-size: .78rem; color: rgba(245, 245, 247, .5); }
.ia-foot .bi { color: #22c55e; }

/* ===== Flecha que señala el botón del navegador ===== */
.ia-flecha {
  position: fixed; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none; color: #ffd11a;
}
.ia-flecha[hidden] { display: none; }
.ia-flecha em {
  font-style: normal; font-weight: 800; font-size: .78rem;
  background: #15151a; color: #ffd11a; border: 1px solid rgba(255, 209, 26, .5);
  padding: 2px 10px; border-radius: 999px; margin: 0 0 6px;
}
.ia-flecha[data-dir="arriba-der"] { flex-direction: column-reverse; }
.ia-flecha[data-dir="arriba-der"] em { margin: 6px 0 0; }
.ia-flecha span {
  width: 46px; height: 46px; border-radius: 50%;
  background: #ffd11a; box-shadow: 0 0 0 6px rgba(255, 209, 26, .25), 0 8px 24px rgba(0, 0, 0, .4);
  position: relative;
}
.ia-flecha span::after {             /* chevron dibujado (sin depender de íconos) */
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 14px; height: 14px;
  border-right: 4px solid #15151a; border-bottom: 4px solid #15151a;
  transform: translate(-50%, -70%) rotate(45deg);
}
.ia-flecha[data-dir="abajo"]     { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 50%; margin-left: -23px; animation: iaBotaAbajo 1s ease-in-out infinite; }
.ia-flecha[data-dir="abajo-der"] { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); right: 14px; animation: iaBotaAbajo 1s ease-in-out infinite; }
.ia-flecha[data-dir="arriba-der"]{ top: calc(10px + env(safe-area-inset-top, 0px)); right: 14px; animation: iaBotaArriba 1s ease-in-out infinite; }
.ia-flecha[data-dir="arriba-der"] span::after { transform: translate(-50%, -30%) rotate(225deg); }
@keyframes iaBotaAbajo  { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(8px) } }
@keyframes iaBotaArriba { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@media (min-width: 992px) { .ia-flecha { display: none !important; } }

@media (max-width: 360px) {
  .ia-sheet { padding-left: 16px; padding-right: 16px; }
  .ia-mock { grid-template-columns: repeat(4, 32px); gap: 8px; }
  .ia-app { width: 32px; height: 32px; }
  .ia-paso-txt { font-size: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ia-ov, .ia-sheet, .ia-app, .ia-app--to, .ia-paso, .ia-flecha { animation: none !important; }
  .ia-app--to { opacity: 1; }
}

/* Entrada "Instalar app" del popup "Más" del bottom-nav: se destaca. */
.bottom-nav-popup-item--app i { color: #f5bc2f !important; }
.bottom-nav-popup-item--app span { font-weight: 700; }

/* ===== Sugerencia en el momento justo (TOInstalarApp.sugerir) =====
   Tarjeta chica sobre el bottom-nav: nunca tapa la pantalla ni bloquea nada. */
.ia-sug {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  z-index: 99990;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
  padding: 12px 14px;
  background: linear-gradient(160deg, #1d1d24 0%, #121216 100%);
  color: #f5f5f7;
  border: 1px solid rgba(255, 209, 26, .35); border-radius: 18px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
  font-family: 'Inter', 'Open Sans', system-ui, sans-serif;
  animation: iaUp .3s cubic-bezier(.2, .9, .3, 1.2);
}
.ia-sug[hidden] { display: none; }
.ia-sug-ico { width: 44px; height: 44px; border-radius: 11px; flex: 0 0 44px; box-shadow: 0 0 0 2px rgba(255, 209, 26, .8); }
.ia-sug-txt { flex: 1 1 180px; min-width: 0; font-size: .86rem; line-height: 1.35; }
.ia-sug-txt b { display: block; color: #fff; font-size: .95rem; margin-bottom: 2px; }
.ia-sug-txt span { color: rgba(245, 245, 247, .75); }
.ia-sug-btns { display: flex; gap: 8px; flex: 1 1 100%; }
.ia-sug-si, .ia-sug-no {
  flex: 1 1 0; min-height: 44px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .92rem; cursor: pointer; text-decoration: none !important;
}
.ia-sug-si { background: linear-gradient(135deg, #ffe066, #ffd11a 55%, #f5bc2f); color: #15151a !important; border: 0; }
.ia-sug-no { background: rgba(255, 255, 255, .08); color: rgba(245, 245, 247, .85); border: 1px solid rgba(255, 255, 255, .14); }
html.to-capa-abierta .ia-sug { display: none; }
@media (min-width: 577px) {
  .ia-sug { left: auto; right: 24px; bottom: 24px; max-width: 380px; }
}
@media (prefers-reduced-motion: reduce) { .ia-sug { animation: none; } }
