/* Diseño exclusivo de Colaxis. Ver DERECHOS.md. */
/* ============================================================
   COLAXIS — components.css
   Z-index: contenido(auto) < wa(200) < overlay(300) < navbar-fixed(400) < drawer(500)
============================================================ */

/* ── NAV PLACEHOLDER ──────────────────────────────────────── */
#nav-placeholder {
  position: relative;
  background: var(--c-white);
  min-height: var(--nav-total-height, 112px);
}
@media (max-width: 900px) {
  #nav-placeholder { min-height: var(--nav-total-height, 100px); }
}

#nav-placeholder .navbar { position: relative; width: 100%; }

#nav-placeholder.navbar-is-fixed .navbar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 400;
  box-shadow: 0 4px 20px rgba(0,85,144,.18);
}

/* ── HAMBURGER ────────────────────────────────────────────── */
.navbar__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none;
  cursor: pointer; padding: 6px; margin-left: auto;
}
.navbar__toggle span {
  display: block; width: 24px; height: 2.5px;
  background: var(--c-blue-dark); border-radius: 2px;
  transition: transform .25s, opacity .2s;
}

/* ── MENÚS — visibilidad ──────────────────────────────────── */
.navbar__menu--desktop { display: flex; align-items: center; gap: 4px; flex: 1; }
.navbar__menu--mobile  { display: none; }

/* ── DROPDOWN DESKTOP ─────────────────────────────────────── */
.navbar__link--btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-main); line-height: inherit;
  display: flex; align-items: center; gap: 4px;
}
/* El botón "Productos" también muestra la línea verde cuando es la página activa (su "border: none" la tapaba). */
.navbar__link--btn.navbar__link--active { border-bottom: 2px solid var(--c-green); border-radius: 0; padding-bottom: 6px; }
.navbar__chevron { transition: transform .22s ease; flex-shrink: 0; }
.navbar__dropdown { position: relative; display: flex; align-items: center; }

.navbar__dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 290px;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,85,144,.13);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 450;
}
.navbar__dropdown-menu.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.dropdown__header  { padding: 12px 18px 8px; }
.dropdown__eyebrow {
  font-size: .7rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--c-green-dark);
  display: block; padding-bottom: 10px;
  border-bottom: 2px solid var(--c-green);
}

.dropdown__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  transition: background .2s;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text); text-decoration: none;
}
.dropdown__item:last-of-type { border-bottom: none; }
.dropdown__item:hover { background: var(--c-bg); }
.dropdown__item:hover .dropdown__text strong { color: var(--c-blue); }

.dropdown__icon {
  width: 32px; height: 32px; border-radius: 7px;
  background: rgba(0,85,144,.07);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s;
}
.dropdown__item:hover .dropdown__icon { background: rgba(0,85,144,.13); }
.dropdown__icon svg { stroke: var(--c-blue); }
.dropdown__text strong {
  display: block; font-size: .87rem; font-weight: 600;
  color: var(--c-blue-dark); line-height: 1.3; transition: color .2s;
}

.dropdown__ver-todo {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--c-bg); font-size: .82rem; font-weight: 700;
  color: var(--c-green-dark); transition: background .2s;
  border-top: 1px solid var(--c-border); text-decoration: none;
}
.dropdown__ver-todo:hover { background: #e8f5e9; }
.dropdown__ver-todo svg { stroke: var(--c-green-dark); }

/* ── DRAWER — estructura base ─────────────────────────────── */
.drawer__header { display: none; }
.drawer__footer { display: none; }
.drawer__links  { display: contents; }

.drawer__link {
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 14px 20px; font-size: .95rem; font-weight: 600;
  color: var(--c-text); border-left: 3px solid transparent;
  background: none; border-top: none; border-right: none; border-bottom: none;
  width: 100%; text-align: center; cursor: pointer;
  font-family: var(--font-main); min-height: 48px;
  transition: background .2s, border-color .2s, color .2s;
  text-decoration: none;
}
.drawer__link:hover,
.drawer__link--active {
  background: var(--c-bg);
  border-left-color: var(--c-blue);
  color: var(--c-blue);
}

.drawer__chevron { position: absolute; right: 22px; transition: transform .22s ease; flex-shrink: 0; }
.drawer__link--toggle[aria-expanded="true"] .drawer__chevron { transform: rotate(180deg); }

/* Acordeón con max-height para transición suave */
.drawer__submenu {
  display: block; max-height: 0; overflow: hidden; opacity: 0;
  background: rgba(0,85,144,.03);
  border-left: 3px solid var(--c-blue);
  transition: max-height .35s ease, opacity .25s ease;
}
.drawer__submenu.is-open { max-height: 500px; opacity: 1; }

.drawer__sublink {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 11px 20px; font-size: .85rem; color: var(--c-text-light);
  text-decoration: none; min-height: 44px;
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: background .2s, color .2s;
}
.drawer__sublink:last-child { border-bottom: none; }
.drawer__sublink:hover { background: rgba(0,85,144,.06); color: var(--c-blue); }
.drawer__sublink--all { color: var(--c-green-dark); font-weight: 700; font-size: .82rem; }

/* ── OVERLAY ──────────────────────────────────────────────── */
.nav-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 300;
}
.nav-overlay.is-open { display: block; }

body.drawer-open main,
body.drawer-open #footer-placeholder {
  filter: blur(2px);
  transition: filter .3s;
}

/* ── WHATSAPP FLOTANTE ────────────────────────────────────── */
.wa-float {
  position: fixed; bottom: calc(28px + var(--wa-lift, 0px)); right: 28px;
  z-index: 200;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  pointer-events: none;   /* el contenedor (con el popup oculto) no debe tapar clics de la página */
}
.wa-float__btn {
  pointer-events: auto;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.45);
  transition: transform .25s, background .25s;
  color: white; position: relative;
}
.wa-float__btn:hover { transform: scale(1.08); }
.wa-float__btn.is-open { background: #128c7e; }

.wa-float__icon { position: absolute; transition: opacity .2s, transform .2s; }
.wa-float__icon--wa    { opacity: 1; transform: scale(1); }
.wa-float__icon--close { opacity: 0; transform: scale(.5); }
.wa-float__btn.is-open .wa-float__icon--wa    { opacity: 0; transform: scale(.5); }
.wa-float__btn.is-open .wa-float__icon--close { opacity: 1; transform: scale(1); }

.wa-float__popup {
  background: var(--c-white); border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18); width: 290px;
  overflow: hidden; opacity: 0; pointer-events: none;
  transform: translateY(12px) scale(.96);
  transition: opacity .25s, transform .25s;
  transform-origin: bottom right;
}
.wa-float__popup.is-open { opacity: 1; pointer-events: all; transform: none; }

.wa-popup__header {
  background: #075e54; padding: 16px;
  display: flex; align-items: flex-start; gap: 12px;
}
.wa-popup__avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: white; overflow: hidden; flex-shrink: 0; padding: 5px;
}
.wa-popup__avatar img { width: 100%; object-fit: contain; }
.wa-popup__title    { font-size: .92rem; font-weight: 700; color: white; margin-bottom: 3px; }
.wa-popup__subtitle { font-size: .75rem; color: rgba(255,255,255,.75); line-height: 1.4; }
.wa-popup__options  { padding: 6px 0 8px; }

.wa-popup__option {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; transition: background .2s; text-decoration: none;
}
.wa-popup__option:hover { background: #f0fdf4; }
.wa-popup__option + .wa-popup__option { border-top: 1px solid var(--c-border); }

.wa-popup__flag {
  width: 34px; height: 24px; object-fit: cover;
  border-radius: 4px; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.wa-popup__info { flex: 1; }
.wa-popup__info strong { display: block; font-size: .88rem; font-weight: 700; color: var(--c-blue-dark); margin-bottom: 2px; }
.wa-popup__info span  { font-size: .76rem; color: var(--c-text-light); }

.wa-popup__arrow {
  width: 30px; height: 30px; border-radius: 50%;
  background: #25d366; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; color: white; transition: transform .2s;
}
.wa-popup__option:hover .wa-popup__arrow { transform: scale(1.1); }

/* ══ MÓVIL ≤ 900px ══════════════════════════════════════════ */
@media (max-width: 900px) {
  .navbar__toggle        { display: flex; }
  .navbar__search        { display: none; }
  .navbar__menu--desktop { display: none !important; }

  .navbar__menu--mobile {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: -320px;
    width: 300px; height: 100dvh;
    background: var(--c-white); z-index: 500;
    overflow-y: auto;
    transition: left .3s cubic-bezier(.4,0,.2,1);
  }
  .navbar__menu--mobile.is-open {
    left: 0;
    box-shadow: 4px 0 32px rgba(0,0,0,.15);
  }

  .drawer__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--c-border); flex-shrink: 0;
  }
  .drawer__logo  { height: 34px; width: auto; }
  .drawer__close {
    background: none; border: none; cursor: pointer;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-text-light); transition: background .2s;
  }
  .drawer__close:hover { background: var(--c-bg); }

  .drawer__searchwrap { padding: 12px 18px 4px; flex-shrink: 0; }
  .navbar__search.drawer__search { display: flex; width: 100%; }
  .drawer__search .navbar__search-input { flex: 1; width: auto; min-width: 0; font-size: 1rem; }
  .drawer__searchwrap .search-sug { position: static; width: 100%; max-width: none; box-shadow: none; margin-top: 8px; }

  .drawer__links {
    display: flex; flex-direction: column;
    flex: 1; overflow-y: auto; padding: 6px 0;
  }

  .drawer__footer {
    display: flex; flex-direction: column; gap: 10px;
    padding: 14px 18px 24px;
    border-top: 1px solid var(--c-border); flex-shrink: 0;
  }
  .drawer__cta { justify-content: center; width: 100%; padding: 13px; }

  body.drawer-open { overflow: hidden; }

  /* Topbar compacto en móvil */
  .topbar { padding: 0; }
  .topbar__inner { height: 32px; justify-content: center; gap: 0; }
  .topbar__item:not(:first-child) { display: none; }
  .topbar__item:first-child { font-size: .71rem; gap: 6px; }

  /* WA más compacto */
  .wa-float { bottom: calc(18px + var(--wa-lift, 0px)); right: 16px; }
  .wa-float__btn { width: 52px; height: 52px; }
  .wa-float__popup { width: 265px; }
}

/* ══ DESKTOP > 900px ════════════════════════════════════════ */
@media (min-width: 901px) {
  .navbar__toggle       { display: none !important; }
  .navbar__search       { display: flex !important; }
  .navbar__menu--mobile { display: none !important; }
  .drawer__header       { display: none !important; }
  .drawer__searchwrap   { display: none !important; }
  .drawer__footer       { display: none !important; }
  .drawer__links        { display: contents !important; }
  .nav-overlay          { display: none !important; }
  body.drawer-open main,
  body.drawer-open #footer-placeholder { filter: none !important; }
}

/* ============================================================
   LANZAMIENTO — accesibilidad, cookies, PWA, legales
============================================================ */

/* Saltar al contenido (solo visible al enfocar con teclado) */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 10000;
  background: var(--c-blue-dark); color: var(--c-white); padding: 10px 16px;
  border-radius: var(--radius-sm); font-weight: 700; font-size: .9rem; text-decoration: none;
  transition: top .15s;
}
.skip-link:focus-visible { top: 12px; }
main:focus { outline: none; }

/* Foco visible para quien navega con teclado */
:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 2px; }
.footer :focus-visible, .demo :focus-visible, .cookie-banner :focus-visible { outline-color: var(--c-green); }
.form__input:focus-visible { outline: none; }  /* ya tiene borde + sombra propios */

.noscript-msg { background: #fff4d6; color: #5c4400; padding: 12px 20px; text-align: center; font-size: .9rem; }

/* Honeypot anti-spam: fuera de pantalla, no visible ni enfocable */
.form__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Consentimiento de datos en formularios */
.form__consent { margin: 4px 0 14px; font-size: .8rem; color: var(--c-text-light); line-height: 1.5; }
.form__consent label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.form__consent input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--c-blue); }
.form__consent a { color: var(--c-blue); text-decoration: underline; }
.form__error { color: #b3261e; font-size: .8rem; margin-top: 6px; }

/* Combobox accesible: opción activa con flechas */
.combo__option.is-active { background: var(--c-bg); outline: 2px solid var(--c-blue); outline-offset: -2px; }

/* Utilidad: solo lectores de pantalla */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Banner de cookies ───────────────────────────────────── */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 9000;
  max-width: 760px; margin: 0 auto; background: var(--c-blue-dark); color: var(--c-white);
  border-radius: var(--radius-lg); padding: 18px 22px; box-shadow: 0 12px 40px rgba(0,20,50,.35);
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__text { flex: 1 1 340px; font-size: .85rem; line-height: 1.55; color: rgba(255,255,255,.9); }
.cookie-banner__text a { color: var(--c-green); text-decoration: underline; }
.cookie-banner__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cookie-banner .btn { padding: 10px 18px; font-size: .85rem; }
.cookie-banner .btn--ghost { background: transparent; color: var(--c-white); border: 1.5px solid rgba(255,255,255,.6); }
.cookie-banner .btn--ghost:hover { background: rgba(255,255,255,.12); }

/* ── Footer: enlaces legales + instalar app ───────────────── */
.footer__legal { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-top: 8px; }
.footer__legal a, .footer__legal button {
  background: none; border: 0; padding: 0; font: inherit; font-size: .78rem; cursor: pointer;
  color: rgba(255,255,255,.75); text-decoration: underline; text-underline-offset: 3px;
}
.footer__legal a:hover, .footer__legal button:hover { color: var(--c-green); }
/* Escritorio: derechos reservados a la izquierda y legales a la derecha, en una sola línea */
@media (min-width: 721px) {
  .footer__bottom-inner { flex-direction: row; justify-content: space-between; align-items: center; gap: 24px; }
  .footer__legal { margin-top: 0; justify-content: flex-end; flex-wrap: nowrap; }
}
.footer__install-hint { font-size: .78rem; color: rgba(255,255,255,.75); margin-top: 8px; text-align: center; }

/* ── Aviso de nueva versión (PWA) ─────────────────────────── */
.update-toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 9100;
  background: var(--c-white); color: var(--c-blue-dark); border: 1px solid var(--c-border);
  border-radius: 999px; padding: 10px 14px 10px 20px; box-shadow: var(--shadow-md);
  display: flex; gap: 14px; align-items: center; font-size: .85rem; font-weight: 600;
}
.update-toast[hidden] { display: none; }
.update-toast button { border: 0; background: var(--c-blue); color: var(--c-white); border-radius: 999px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }

/* ── Páginas legales / 404 / offline ──────────────────────── */
.legal { padding: 64px 0 88px; }
.legal__inner { max-width: 820px; }
.legal h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); font-weight: 800; color: var(--c-blue-dark); margin-bottom: 8px; }
.legal__updated { color: var(--c-text-light); font-size: .85rem; margin-bottom: 28px; }
.legal h2 { font-size: 1.15rem; font-weight: 800; color: var(--c-blue-dark); margin: 32px 0 10px; }
.legal p, .legal li { font-size: .95rem; color: var(--c-text); line-height: 1.75; }
.legal ul { padding-left: 22px; margin: 8px 0; }
.legal a { color: var(--c-blue); text-decoration: underline; }
.legal__draft { background: #fff4d6; border: 1px solid #f0d58a; color: #5c4400; border-radius: var(--radius-md, 10px); padding: 14px 18px; font-size: .88rem; margin-bottom: 28px; }
.legal table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .88rem; }
.legal th, .legal td { text-align: left; padding: 10px 12px; border: 1px solid var(--c-border); vertical-align: top; }
.legal th { background: var(--c-bg); color: var(--c-blue-dark); }
.estado { min-height: 60vh; display: flex; align-items: center; text-align: center; padding: 72px 0; }
.estado__code { font-size: clamp(4rem, 14vw, 8rem); font-weight: 800; color: var(--c-blue); line-height: 1; }
.estado h1 { font-size: clamp(1.4rem, 3vw, 2rem); color: var(--c-blue-dark); margin: 12px 0; }
.estado p { color: var(--c-text-light); margin-bottom: 24px; }

@media (max-width: 600px) {
  .cookie-banner { left: 10px; right: 10px; bottom: 10px; padding: 16px; }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* Tablas legales en celular: cada fila pasa a ser una tarjeta (sin desbordar) */
.legal code, .legal a, .legal p, .legal li { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .legal table, .legal tbody, .legal tr, .legal td { display: block; width: 100%; }
  .legal thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .legal tr { border: 1px solid var(--c-border); border-radius: var(--radius-md); margin-bottom: 12px; overflow: hidden; }
  .legal td { border: 0; border-bottom: 1px solid var(--c-border); padding: 8px 12px; }
  .legal td:last-child { border-bottom: 0; }
  .legal td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-text-light); margin-bottom: 2px; }
}

/* ── BUSCADOR: sugerencias ─────────────────────────────────── */
.navbar__search-btn { border-radius: 0 999px 999px 0; }
.search-sug { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-width: 90vw; background: #fff; border: 1px solid var(--c-border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,60,101,.16); padding: 6px; z-index: 300; list-style: none; margin: 0; }
.search-sug[hidden] { display: none; }
.search-sug__item { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 10px; color: var(--c-text); text-decoration: none; font-size: .88rem; cursor: pointer; }
.search-sug__item small { color: var(--c-text-light); font-size: .74rem; }
.search-sug__item:hover, .search-sug__item[aria-selected="true"] { background: var(--c-bg); }
.search-sug__item mark { background: none; color: var(--c-blue); font-weight: 800; }
.search-sug__all { color: var(--c-blue); font-weight: 700; border-top: 1px solid var(--c-border); border-radius: 0 0 10px 10px; margin-top: 4px; }

.navbar__search-input:focus-visible { outline: none; }  /* el borde azul de la píldora ya indica el foco */
