/* Recomendador de una frase, aviso de ayuda y encuesta de salida (21/11/2026). JS en js/recomendador.js. */

/* Entrada (el formulario de la portada se quitó el 21/11/2026; queda el del diálogo) */
.reco-entrada textarea { flex: 1 1 auto; width: 100%; min-width: 0; min-height: 64px; resize: vertical; padding: 12px 14px; font: inherit; font-size: 1rem; border: 1px solid var(--line-strong, #e2e8f0); border-radius: var(--radius, 10px); background: #fff; color: var(--ink, #0b0c0f); }
.reco-entrada textarea:focus, .reco-enviar input:focus { outline: 2px solid var(--accent, #00b9e4); outline-offset: 1px; border-color: transparent; }
.reco-ejemplos, .reco-q__ops, .reco-ajustes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.reco-chip { font: inherit; font-size: .88rem; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-strong, #e2e8f0); background: #fff; color: var(--ink, #0b0c0f); cursor: pointer; min-height: 36px; text-align: left; }
.reco-chip:hover { border-color: var(--ink-soft, #475569); }
.reco-chip.is-on { background: var(--ink, #0b0c0f); border-color: var(--ink, #0b0c0f); color: #fff; }
.reco-parecido button, .reco-cambiar, .reco-saltar { font: inherit; background: none; border: 0; padding: 0; color: var(--accent-ink, #007091); text-decoration: underline; cursor: pointer; }

/* Ficha */
.reco-parecido { margin: 10px 0 0; font-size: .9rem; color: var(--ink-soft, #475569); }

/* Diálogo */
.reco-dlg { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: var(--radius-lg, 18px); box-shadow: var(--shadow-lg, 0 24px 56px rgba(11,12,15,.16)); color: var(--ink, #0b0c0f); background: #fff; overflow: hidden; }
.reco-dlg[open] { display: flex; flex-direction: column; }
.reco-dlg::backdrop { background: rgba(11, 12, 15, .45); }
html.reco-abierto { overflow: hidden; }
.reco-dlg__cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line, #f1f3f4); }
.reco-dlg__tit { margin: 0; font-size: 1.15rem; }
.reco-dlg__cerrar { width: 44px; height: 44px; border: 0; background: none; font-size: 1.1rem; cursor: pointer; color: var(--ink-soft, #475569); border-radius: 50%; }
.reco-dlg__cerrar:hover { background: var(--bg-soft, #f8fafc); }
.reco-dlg__cuerpo { padding: 16px 20px 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.reco-dlg__pie { padding: 14px 20px 16px; border-top: 1px solid var(--line-strong, #e2e8f0); background: var(--bg-soft, #f8fafc); }

.reco-entrada { display: flex; flex-direction: column; gap: 4px; }
.reco-entrada__lbl { font-weight: 700; margin-bottom: 6px; }
.reco-btn { margin-top: 14px; align-self: flex-start; width: auto; }
.reco-nota { margin: 12px 0 0; font-size: .82rem; color: var(--ink-soft, #475569); }
.reco-cargando { display: flex; align-items: center; gap: 12px; padding: 36px 0; color: var(--ink-soft, #475569); }
.reco-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong, #e2e8f0); border-top-color: var(--accent, #00b9e4); animation: reco-gira .8s linear infinite; }
@keyframes reco-gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .reco-spin { animation: none; } }
.reco-error, .reco-vacio { padding: 20px 0; }
.reco-frase { margin: 0 0 8px; font-style: italic; color: var(--ink-soft, #475569); overflow-wrap: anywhere; }
.reco-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.reco-tag { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft, #e0f5fb); color: var(--accent-ink, #007091); }
.reco-cambiar { font-size: .85rem; margin-left: 4px; }
.reco-aviso { padding: 8px 12px; background: #fef9c3; border-radius: var(--radius, 10px); font-size: .9rem; }
.reco-q { border: 0; padding: 0; margin: 0 0 16px; }
.reco-q legend { font-weight: 700; padding: 0; }
.reco-q input { margin-top: 10px; width: 160px; padding: 9px 12px; font: inherit; border: 1px solid var(--line-strong, #e2e8f0); border-radius: var(--radius, 10px); }
.reco-ajustes { margin: 0 0 6px; }

.reco-grupo { padding: 16px 0; border-bottom: 1px solid var(--line, #f1f3f4); }
.reco-grupo:last-of-type { border-bottom: 0; }
.reco-grupo__cab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.reco-grupo h3 { margin: 0; font-size: 1.02rem; }
.reco-quitar { font: inherit; font-size: .82rem; background: none; border: 0; color: var(--ink-soft, #475569); text-decoration: underline; cursor: pointer; padding: 6px 0; }
.reco-grupo__motivo { margin: 4px 0 0; font-size: .92rem; }
.reco-grupo__n { margin: 4px 0 0; font-size: .8rem; color: var(--ink-soft, #475569); }
.reco-items { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.reco-item { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line-strong, #e2e8f0); border-radius: var(--radius, 10px); background: #fff; min-width: 0; }
.reco-item__img { display: block; aspect-ratio: 4 / 3; background: var(--bg-soft, #f8fafc); border-radius: 8px; overflow: hidden; }
.reco-item__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.reco-item__txt { display: flex; flex-direction: column; gap: 3px; font-size: .84rem; min-width: 0; }
.reco-item__nom { color: var(--ink, #0b0c0f); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.reco-item__nom:hover { text-decoration: underline; }
.reco-item__precio strong { font-size: 1rem; }
.reco-item__total, .reco-item__plazo { color: var(--ink-soft, #475569); }
.reco-item__plazo.is-justo { color: #a16207; }
.reco-like { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong, #e2e8f0); background: rgba(255,255,255,.95); color: var(--ink-mute, #94a3b8); font-size: 1rem; cursor: pointer; line-height: 1; }
.reco-like.is-on { color: #fff; background: var(--red, #d52b1e); border-color: var(--red, #d52b1e); }
.reco-like.is-max { animation: reco-no .3s; }
@keyframes reco-no { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.reco-fuera { margin: 8px 0 0; font-size: .88rem; color: var(--ink-soft, #475569); }

.reco-enviar__tit { margin: 0 0 8px; font-weight: 700; }
.reco-enviar__tit span { font-weight: 400; font-size: .85rem; color: var(--ink-soft, #475569); margin-left: 6px; }
.reco-enviar__fila { display: flex; gap: 8px; }
.reco-enviar__fila input[type="email"] { flex: 1; min-width: 0; padding: 11px 14px; font: inherit; border: 1px solid var(--line-strong, #e2e8f0); border-radius: var(--radius, 10px); background: #fff; }
.reco-enviar__fila .reco-btn { margin-top: 0; }
.reco-enviar__legal { margin: 8px 0 0; font-size: .78rem; color: var(--ink-soft, #475569); }
.reco-enviar__err { margin: 8px 0 0; font-size: .85rem; color: var(--red, #d52b1e); }
.reco-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.reco-ok { margin: 0; font-weight: 600; color: var(--green, #206c49); }
.reco-encuesta { padding: 18px 0; }
.reco-encuesta__tit { font-weight: 700; margin: 0 0 4px; }
.reco-saltar { display: block; margin-top: 16px; font-size: .88rem; }

/* Aviso a la tercera ficha */
.reco-burbuja { position: fixed; left: 16px; bottom: 80px; z-index: 900; width: min(320px, calc(100vw - 32px)); padding: 16px 16px 14px; background: #fff; border: 1px solid var(--line-strong, #e2e8f0); border-radius: var(--radius-lg, 18px); box-shadow: var(--shadow-lg, 0 24px 56px rgba(11,12,15,.16)); font-size: .9rem; }
.reco-burbuja p { margin: 0 28px 12px 0; }
.reco-burbuja__x { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; color: var(--ink-soft, #475569); }
.reco-burbuja__si { width: 100%; }

@media (max-width: 640px) {
  .reco { padding: 14px; }
  .reco__fila { flex-direction: column; }
  .reco__btn { align-self: stretch; }
  .reco .reco-chip:nth-child(n+4) { display: none; }
  .reco .reco-chip { font-size: .84rem; }
  .reco-dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .reco-dlg__cab { padding: 10px 12px 10px 16px; }
  .reco-dlg__cuerpo { padding: 12px 16px 16px; }
  .reco-dlg__pie { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .reco-items { grid-template-columns: 1fr; gap: 8px; }
  .reco-item { flex-direction: row; align-items: center; padding: 8px 52px 8px 8px; }
  .reco-item__img { width: 84px; flex: 0 0 84px; }
  .reco-like { top: 50%; transform: translateY(-50%); right: 10px; }
  .reco-enviar__fila { flex-direction: column; }
  .reco-enviar__fila .reco-btn { align-self: stretch; }
  .reco-btn { align-self: stretch; }
  /* La barra fija de la ficha móvil vive abajo: el aviso sube por encima. */
  .reco-burbuja { bottom: 150px; }
}

/* Icono del recomendador en móvil (21/11/2026): círculo fijo abajo a la izquierda con punto de nuevo. */
.reco-fab { display: none; }
@media (max-width: 720px) {
  .reco-fab { display: inline-flex; align-items: center; gap: 7px; position: fixed; left: 16px; bottom: 18px; z-index: 90; height: 46px; padding: 0 16px 0 14px; border: 0; border-radius: 999px; background: var(--ink, #0b0c0f); color: #fff; font: inherit; font-size: 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(11,12,15,.25); cursor: pointer; transition: transform .2s, opacity .2s; }
  .reco-fab.is-oculto { transform: translateY(90px); opacity: 0; pointer-events: none; }
  .reco-fab__nuevo { position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: #e11d48; border: 2px solid #fff; }
  /* En la ficha la barra fija ocupa el pie: el icono sube por encima. */
  /* En la ficha ya está «Te buscamos algo parecido»: el botón no tapa colores ni precios (22/11/2026). */
  body.is-product-page .reco-fab { display: none; }
  body.is-product-page:has(.reco-burbuja) .reco-fab, .reco-dlg[open] ~ .reco-fab { display: none; }
}

/* Botón de la cabecera de escritorio (22/11/2026). */
.how-link--reco { display: none; }
@media (min-width: 721px) {
  .how-link--reco { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--ink, #0b0c0f); border-radius: 999px; background: #fff; color: var(--ink, #0b0c0f); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
  .how-link--reco:hover { background: var(--ink, #0b0c0f); color: #fff; }
}
@media (min-width: 721px) and (max-width: 1100px) { .how-link--reco span { display: none; } .how-link--reco { padding: 9px 11px; } }
