/* ═══ Accesos rápidos (Julio, 22-oct) ═══
   Una columna de burbujas a la derecha: Te ayudo a elegir, Comparar, Vistos recientemente y WhatsApp.
   Cada burbuja es un círculo sólido (capa ::before) con su icono encima; su nombre es una pastilla detrás que se abre
   hacia la izquierda. Llegan abiertas y a los 5 s se recogen una tras otra: la pastilla se cierra dentro del círculo y el
   texto se apaga un poco antes, para que nunca quede cortado. Todo se anima con recorte, color y transform: nada cambia de tamaño (sin
   saltos de maquetación) y el orden de capas no cambia durante las animaciones (isolation en cada burbuja). */

/* las piezas viejas (asistente, vistos, barra de comparar) siguen en la página, pero las maneja el dock */
body .basis-btn, body .recent-pill, body .bcmp-bar { display: none !important; }
body .recent-widget { animation: none !important; }

.quick-actions {
  --b: 52px;                              /* diámetro de cada burbuja */
  --abre: cubic-bezier(.16, 1, .3, 1);    /* abrir: arranca rápido y llega suave */
  --cierra: cubic-bezier(.4, 0, .2, 1);   /* cerrar */
  position: fixed; z-index: 75; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
.quick-actions > * { --i: 0; --fondo: #fff; --tinta: var(--navy); --pastilla: #fff; --texto: var(--navy); }
.quick-actions > :nth-child(2) { --i: 1; }
.quick-actions > :nth-child(3) { --i: 2; }
.quick-actions > :nth-child(4) { --i: 3; }

/* burbuja */
.quick-actions > button,
body .quick-actions .wa-float.wa-float {
  position: relative !important; inset: auto !important; isolation: isolate;
  display: grid !important; place-items: center; width: var(--b) !important; height: var(--b) !important; min-width: 0;
  margin: 0; padding: 0 !important; border: 0; border-radius: 50%; background: none !important; box-shadow: none !important;
  color: var(--tinta); cursor: pointer; text-decoration: none; opacity: 1 !important; transform: none !important;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.quick-actions > button::before,
body .quick-actions .wa-float.wa-float::before {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: 50%; background: var(--fondo);
  box-shadow: 0 8px 24px rgb(10 37 64 / .16); transition: transform .1s ease-out, box-shadow .15s ease-out;
}
body .quick-actions .wa-float::after { display: none !important; }
.quick-actions > button > svg,
body .quick-actions .wa-float.wa-float > svg { position: relative; z-index: 1; width: 22px !important; height: 22px !important; padding: 0 !important; border-radius: 0; background: none !important; color: inherit !important; fill: none; }
body .quick-actions .wa-float.wa-float > svg { fill: currentColor; }
.quick-actions > button:focus-visible,
body .quick-actions .wa-float:focus-visible { outline: 3px solid var(--blue-700); outline-offset: 3px; }
@media (hover: hover) {
  .quick-actions > button:not([aria-disabled="true"]):hover::before,
  body .quick-actions .wa-float:hover::before { box-shadow: 0 10px 28px rgb(10 37 64 / .22); }
}
.quick-actions > button:active::before,
body .quick-actions .wa-float:active::before { transform: scale(.94); }

/* color de cada burbuja */
.quick-actions > [data-tool="assistant"] { --fondo: linear-gradient(120deg, #6d4bd8, #009de1, #c04fd8, #6d4bd8) 0 0 / 300% 300%; --tinta: #fff; }
.quick-actions > [data-tool="compare"] { --fondo: #eaf2f9; --tinta: #8da2b6; }
.quick-actions > [data-tool="compare"][aria-disabled="false"] { --fondo: var(--blue-700); --tinta: #fff; }
body .quick-actions .wa-float.wa-float { --fondo: var(--wa, #25d366); --tinta: var(--wa-ink, #06210f); --pastilla: var(--wa, #25d366); --texto: var(--wa-ink, #06210f); }
.quick-actions > [aria-disabled="true"] { cursor: default; }

/* contador */
.quick-actions b { position: absolute; z-index: 2; top: -4px; right: -4px; display: grid; place-items: center; min-width: 20px; height: 20px; padding-inline: 5px;
  border-radius: 10px; background: var(--blue-700); color: #fff; box-shadow: 0 0 0 2px #fff; font: 600 11px/1 var(--font); font-variant-numeric: tabular-nums; }
.quick-actions b[hidden] { display: none; }

/* nombre: pastilla detrás del círculo. Abierta deja ver su sombra (recorte con margen); recogida queda bajo el círculo */
body .quick-actions .wa-float > span { display: none !important; }
.quick-actions > button > span,
body .quick-actions .wa-float > .quick-actions__wa-label {
  position: absolute; z-index: -1; top: 0; right: 0; height: var(--b);
  display: flex !important; align-items: center; max-width: none !important; padding: 0 calc(var(--b) + 14px) 0 20px; border-radius: 999px;
  background: var(--pastilla); color: var(--texto); box-shadow: 0 8px 24px rgb(10 37 64 / .14);
  font: 600 14px/1 var(--font); white-space: nowrap; opacity: 1 !important;
  clip-path: inset(-24px -24px -24px -24px round 999px);
  transition: clip-path .45s var(--abre) calc(var(--i) * 60ms), color .25s ease calc(var(--i) * 60ms + .15s);
}
.quick-actions.is-recogida > button > span,
body .quick-actions.is-recogida .wa-float > .quick-actions__wa-label {
  clip-path: inset(0 0 0 calc(100% - var(--b)) round 999px); color: transparent;
  transition: color .12s ease calc(var(--i) * 60ms), clip-path .42s var(--cierra) calc(var(--i) * 60ms);
}
@media (hover: hover) {
  .quick-actions.is-recogida > button:hover > span,
  body .quick-actions.is-recogida .wa-float:hover > .quick-actions__wa-label {
    clip-path: inset(-24px -24px -24px -24px round 999px); color: var(--texto); transition: clip-path .4s var(--abre), color .2s ease .12s;
  }
}
.quick-actions.is-recogida > button:focus-visible > span,
body .quick-actions.is-recogida .wa-float:focus-visible > .quick-actions__wa-label {
  clip-path: inset(-24px -24px -24px -24px round 999px); color: var(--texto); transition: clip-path .4s var(--abre), color .2s ease .12s;
}

/* llegada en cascada y degradado vivo de «Te ayudo a elegir» */
@media (prefers-reduced-motion: no-preference) {
  .quick-actions > button,
  body .quick-actions .wa-float.wa-float { animation: dock-llega .5s var(--abre) calc(.3s + var(--i) * 70ms) backwards !important; }
  @keyframes dock-llega { from { opacity: 0; translate: 16px 0; scale: .9; } }
  .quick-actions > [data-tool="assistant"]::before { animation: dock-ayuda 5s ease-in-out infinite alternate; }
  @keyframes dock-ayuda { to { background-position: 100% 100%; } }
}
@media (prefers-reduced-motion: reduce) {
  .quick-actions > button > span,
  body .quick-actions .wa-float > .quick-actions__wa-label { transition: none !important; }
}

/* se esconde cuando estorba: aviso de cookies, teclado abierto o un panel abierto en el teléfono */
html.con-cookies .quick-actions, html.escribiendo .quick-actions { visibility: hidden; }

@media (max-width: 639px) {
  .quick-actions { --b: 48px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .quick-actions > button > span,
  body .quick-actions .wa-float > .quick-actions__wa-label { padding-right: calc(var(--b) + 12px); font-size: 13.5px; }
}

/* Teléfono plegado (Web ADS #49, 25-oct): a la vista solo WhatsApp y «Más accesos» (y Comparar cuando ya hay 2 laptops);
   «Más accesos» abre las demás burbujas encima. En computadora el botón no sale. */
.quick-actions > [data-tools-mas] { display: none !important; }
.quick-actions.is-plegada > [data-tools-mas] { display: grid !important; --i: 3; }
.quick-actions.is-plegada:not(.is-abierta) > [data-tool]:not([data-tool="compare"][aria-disabled="false"]) { display: none !important; }
.quick-actions.is-plegada.is-abierta > [data-tools-mas] { --fondo: var(--navy); --tinta: #fff; }
.quick-actions.is-plegada.is-abierta > button > span { clip-path: inset(-24px -24px -24px -24px round 999px); color: var(--texto); }

/* ═══ Paneles del asistente y de vistos ═══
   Escritorio: junto a la columna, sin taparla. Teléfono: hoja que sube desde abajo, con el fondo atenuado. */
html body .basis-panel,
html body .recent-panel { position: fixed; z-index: 90; top: auto; left: auto; right: 84px; bottom: max(16px, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
html body .basis-panel:focus { outline: none; }
body .recent-widget { z-index: 90; } /* su panel vive dentro: debe quedar sobre la columna */
/* con un panel abierto, las burbujas se quedan en su icono (no se despliegan encima del panel) */
html.con-panel .quick-actions > button > span,
html.con-panel body .quick-actions .wa-float > .quick-actions__wa-label { clip-path: inset(0 0 0 calc(100% - var(--b)) round 999px) !important; color: transparent !important; }
@media (max-width: 639px) {
  html body .basis-panel,
  html body .recent-panel {
    left: 0; right: 0; bottom: 0; width: 100%; max-width: none; height: min(74dvh, 600px); max-height: none;
    border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -8px 32px rgb(10 37 64 / .22), 0 0 0 100vmax rgb(10 37 64 / .4);
  }
  html.con-panel .quick-actions, html.con-panel .dock-idea { visibility: hidden; }
}
@media (max-width: 639px) and (prefers-reduced-motion: no-preference) {
  html body .basis-panel:not([hidden]),
  html body .recent-panel:not([hidden]) { animation: hoja-sube .32s cubic-bezier(.16, 1, .3, 1); }
  @keyframes hoja-sube { from { transform: translateY(100%); } }
}

/* ═══ Sugerencia del dock (dock-ideas.js) ═══
   Sale a la izquierda de la burbuja que la propone (dock-ideas.js pone left/top y la flecha); en el teléfono, encima. */
.dock-idea { position: fixed; z-index: 76; width: min(300px, calc(100vw - 32px)); display: grid; gap: 8px; padding: 14px 14px 12px; border-radius: 18px;
  background: var(--navy); color: #fff; box-shadow: 0 2px 6px rgb(10 37 64 / .12), 0 18px 44px rgb(10 37 64 / .28); font: 400 13.5px/1.45 var(--font); }
.dock-idea::after { content: ""; position: absolute; right: -6px; top: var(--flecha, 50%); width: 14px; height: 14px; margin-top: -7px; background: var(--navy); transform: rotate(45deg); border-radius: 0 3px 0 0; }
.dock-idea.is-arriba::after { top: auto; bottom: -6px; right: 24px; margin: 0; border-radius: 0 0 3px 0; }
.dock-idea__t { margin: 0; padding-right: 22px; font: 600 15px/1.3 var(--font); }
.dock-idea__s { margin: 0; color: #c9d6e3; }
.dock-idea__eq { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; background: #ffffff14; color: #c9d6e3; text-decoration: none; font-size: 12.5px; }
.dock-idea__eq img { width: 44px; height: 44px; padding: 3px; border-radius: 9px; object-fit: contain; background: #fff; }
.dock-idea__eq b { display: block; color: #fff; font: 600 13.5px/1.3 var(--font); }
a.dock-idea__eq:hover { background: #ffffff22; }
.dock-idea__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--blue); color: #fff; font: 600 14px/1 var(--font); text-decoration: none; cursor: pointer; }
.dock-idea__btn:hover { background: #00b3ff; }
.dock-idea__btn--wa { background: var(--wa, #25d366); color: var(--wa-ink, #0e1726); }
.dock-idea__x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #c9d6e3; font-size: 18px; cursor: pointer; }
.dock-idea__x:hover { background: #ffffff1a; color: #fff; }
html:is(.con-cookies, .escribiendo) .dock-idea { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .dock-idea { animation: dock-idea-llega .7s cubic-bezier(.22, 1.2, .36, 1); transform-origin: 100% 50%; }
  .dock-idea.is-arriba { transform-origin: 90% 100%; }
  @keyframes dock-idea-llega { 0% { opacity: 0; transform: translateX(18px) scale(.94); filter: blur(3px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: none; } }
  .dock-idea > * { animation: dock-idea-parte .55s cubic-bezier(.16, 1, .3, 1) backwards; }
  .dock-idea > :nth-child(1) { animation-delay: .12s; } .dock-idea > :nth-child(2) { animation-delay: .18s; }
  .dock-idea > :nth-child(3) { animation-delay: .24s; } .dock-idea > :nth-child(4) { animation-delay: .3s; }
  @keyframes dock-idea-parte { from { opacity: 0; transform: translateY(6px); } }
  .dock-idea__btn, .dock-idea__eq, .dock-idea__x { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background-color .25s ease; }
  .dock-idea__btn:hover { transform: translateY(-1px); }
  .dock-idea__btn:active, .dock-idea__x:active { transform: scale(.95); }
  a.dock-idea__eq:hover { transform: translateX(-2px); }
}
