/* BuscaPrecio — estilos de la demo. Mobile-first; panel lateral desde 900 px. */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --line: #e2e5ea;
  --text: #1d232b;
  --muted: #5f6b78;
  --brand: #0b6e4f;
  --brand-dark: #08553d;
  --brand-soft: #e5f3ee;
  --accent: #f2a900;
  --warn: #a35a00;
  --warn-soft: #fff4e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; }
.muted { color: var(--muted); font-weight: normal; }
.na { color: var(--muted); font-style: italic; }
.tbc { color: var(--warn); font-weight: 600; }
.warn { color: var(--warn); }
.ok { color: var(--brand); font-weight: 600; }

.demo-banner {
  position: sticky; top: 0; z-index: 20;
  background: var(--accent); color: #2b1d00; text-align: center;
  font-weight: 700; font-size: 13px; padding: 6px 12px; letter-spacing: .02em;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 9px 18px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 40px;
}
.btn:hover { background: var(--surface); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { border-color: var(--brand); color: var(--brand); }
.btn-small { padding: 6px 14px; min-height: 34px; font-size: 14px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-store { width: 100%; margin-top: 12px; border-style: dashed; color: var(--muted); }
.link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 6px 0; text-decoration: underline; }

/* ---------- Logo y búsqueda ---------- */
.logo { text-decoration: none; font-weight: 800; font-size: 44px; letter-spacing: -.03em; }
.logo-b { color: var(--text); }
.logo-p { color: var(--brand); }
.logo-sm { font-size: 22px; white-space: nowrap; }

.search { display: flex; gap: 8px; width: 100%; }
.search input {
  flex: 1; min-width: 0; font: inherit; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: var(--shadow);
}
.search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.search-lg input { padding: 14px 20px; font-size: 17px; }
.search-lg .btn { padding: 0 24px; min-height: 50px; }

/* ---------- Página A ---------- */
.home {
  max-width: 680px; margin: 0 auto; padding: 8vh 16px 28px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
}
.tagline { font-size: 20px; margin: 0 0 8px; color: var(--muted); }
.hint, .home-note { font-size: 13px; color: var(--muted); margin: 0; }
.home-stores { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 10px; }

/* ---------- Chips ---------- */
.chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: #fff; white-space: nowrap;
}
.chip-off { opacity: .35; text-decoration: line-through; }
.chip-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.store-amazon { color: #232f3e; }
.store-aliexpress { color: #c7361f; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: #fff;
}
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.result-count { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sort { margin-left: auto; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.sort select { font: inherit; color: var(--text); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; max-width: 60vw; }

/* ---------- Página B ---------- */
.layout { display: flex; gap: 24px; padding: 16px; max-width: 1320px; margin: 0 auto; }
.results { flex: 1; min-width: 0; }
.interpreted { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.rule-note { margin: 0 0 16px; font-size: 12.5px; color: var(--muted); }
.section-title { font-size: 17px; margin: 22px 0 6px; }
.result-section:first-of-type .section-title { margin-top: 4px; }
.section-note { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.result-section.pending .section-title { color: var(--warn); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; overflow: hidden; box-shadow: var(--shadow);
}
.card-img svg, .product-img svg { display: block; width: 100%; height: auto; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 15px; margin: 6px 0 2px; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.spec { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.price-label { font-size: 12px; color: var(--muted); }
.price { font-size: 22px; font-weight: 800; }
.price-tbc { color: var(--warn); font-size: 18px; }
.price-sub { font-size: 12.5px; color: var(--muted); }
.meta { font-size: 12.5px; color: var(--muted); margin: 2px 0; }
.member-flag { color: var(--brand-dark); }
.card .btn-block { margin-top: auto; }
.card-body > .meta:last-of-type { margin-bottom: 10px; }

.type-badge {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-dark);
}
.type-rigida { background: #eef0f3; color: #4a5560; }
.type-mano { background: #e8f1fb; color: #2a5b8a; }

/* Filtros: cajón en móvil, columna fija en escritorio */
.filters {
  position: fixed; inset: 0 auto 0 0; width: min(340px, 88vw); z-index: 30;
  background: #fff; padding: 16px; overflow-y: auto; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35);
  transform: translateX(-110%); transition: transform .2s ease; visibility: hidden;
}
.filters.open { transform: none; visibility: visible; }
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters h2 { font-size: 16px; margin: 0; }
.filters fieldset { border: 0; border-top: 1px solid var(--line); margin: 12px 0 0; padding: 12px 0 0; }
.filters legend { font-weight: 700; font-size: 14px; padding: 0; margin-bottom: 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.check .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.range { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.range input { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.fine { font-size: 12px; color: var(--muted); margin: 0 0 6px 24px; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* ---------- Página C ---------- */
.detail { max-width: 1040px; margin: 0 auto; padding: 16px; }
.back { display: inline-block; margin-bottom: 12px; font-weight: 600; text-decoration: none; }
.product { display: grid; grid-template-columns: 1fr; gap: 20px; }
.product-img { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.img-note { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: var(--muted); }
.product-info h1 { font-size: 22px; margin: 8px 0 10px; }
.spec-table { border-collapse: collapse; font-size: 14px; width: 100%; }
.spec-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 12px 4px 0; width: 110px; vertical-align: top; }
.spec-table td { padding: 4px 0; }
.match-note { font-size: 12.5px; background: var(--brand-soft); color: var(--brand-dark); padding: 8px 10px; border-radius: 8px; }

.calc-options {
  margin: 20px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.calc-options form { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.summary p { margin: 8px 0 0; font-size: 14px; }

.offers { display: grid; grid-template-columns: 1fr; gap: 14px; }
.offer { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; box-shadow: var(--shadow); }
.offer.verificado:first-child { border: 2px solid var(--brand); }
.offer.pendiente { background: var(--warn-soft); border-color: #f1d6a6; }
.offer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.rank {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 700; margin-right: 6px;
}
.store-name { font-size: 18px; font-weight: 800; }
.offer-total { text-align: right; display: flex; flex-direction: column; }
.applied { font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0; }
.fields div { min-width: 0; }
.fields .wide { grid-column: 1 / -1; }
.fields dt { font-size: 12px; color: var(--muted); }
.fields dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.more { margin-top: 12px; font-size: 13.5px; }
.more summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.more ul { margin: 8px 0 0; padding-left: 18px; }
.more li { margin-bottom: 4px; }
.how ul, .similar { padding-left: 18px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  background: #1d232b; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .logo { font-size: 36px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .search .btn { padding: 0 14px; }
  .sort { margin-left: 0; width: 100%; justify-content: space-between; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 14px; }
  .price { font-size: 19px; }
  .card .chips .chip { font-size: 11px; padding: 2px 7px; }
  .fields { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Escritorio ---------- */
@media (min-width: 900px) {
  .filters-toggle, .filters-head button { display: none; }
  .filters {
    position: static; align-self: flex-start; width: 250px; flex-shrink: 0;
    transform: none; visibility: visible; box-shadow: none; padding: 0; overflow: visible; z-index: 1;
  }
  .product { grid-template-columns: 360px 1fr; }
  .offers { grid-template-columns: 1fr 1fr; }
}

/* Selector de idioma (solo pruebas internas) */
.demo-banner { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.lang-toggle {
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  background: #2b1d00; color: #fff; border: 0; border-radius: 999px; padding: 3px 12px;
}

/* Página C: una fila por tienda con el enlace al producto */
.store-list { display: grid; gap: 12px; margin-bottom: 24px; }
.store-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; box-shadow: var(--shadow);
}
.store-row.off { background: var(--surface); box-shadow: none; }
.store-row-info { min-width: 0; }
.store-row .listing { margin: 4px 0 2px; font-size: 14px; overflow-wrap: anywhere; }
.store-row p { margin: 4px 0 0; }
.small { font-size: 12.5px; }
.btn-go { white-space: nowrap; flex-shrink: 0; }
.btn-go[disabled] { cursor: not-allowed; color: var(--muted); background: var(--surface); }
@media (max-width: 640px) {
  .store-row { flex-direction: column; align-items: stretch; }
  .btn-go { width: 100%; white-space: normal; }
}

/* Página de búsqueda en las tiendas */
.search-title { font-size: 20px; margin: 4px 0 8px; overflow-wrap: anywhere; }

/* Pie de página y páginas legales */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 16px 28px; text-align: center; font-size: 13px; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 10px; }
.site-footer a { color: var(--muted); }
.site-footer p { max-width: 640px; margin: 0 auto; }
.legal { max-width: 760px; margin: 0 auto; padding: 16px 16px 8px; line-height: 1.65; }
.legal h1 { font-size: 26px; margin: 8px 0 16px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.legal dt { font-weight: 600; }
.legal dd { margin: 0; overflow-wrap: anywhere; }
.email-img { vertical-align: middle; }
.legal .updated { color: var(--muted); font-size: 13px; }

/* Portada: búsquedas populares y cómo funciona */
.home-block { max-width: 920px; margin: 0 auto; padding: 8px 16px 24px; }
.home-block h2 { font-size: 19px; margin: 8px 0 14px; text-align: center; }
.popular { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.popular-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--text); text-decoration: none; box-shadow: var(--shadow); font-size: 14.5px;
}
.popular-item:hover { border-color: var(--brand); color: var(--brand); }
.popular-icon { font-size: 20px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; counter-reset: step; }
.steps li { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.steps b { display: block; margin-bottom: 4px; }
.steps span { font-size: 14px; color: var(--muted); }
.home-guide { text-align: center; margin: 18px 0 0; font-weight: 600; }
@media (max-width: 640px) { .popular { grid-template-columns: 1fr 1fr; } .popular-item { padding: 10px; font-size: 13.5px; } }

/* Productos de AliExpress (API de afiliados) */
.ali { margin: 8px 0 24px; }
.ali-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.ali-head h2 { margin: 0; font-size: 20px; }
.ali-sort { display: flex; flex-wrap: wrap; gap: 6px; }
.ali-sort .chip { cursor: pointer; font: inherit; font-size: 13px; }
.ali-sort .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.ali-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none; min-width: 0; }
.product:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
.product-img { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface); }
.product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-title { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.product-price b { font-size: 18px; color: var(--text); }
.product-price s { font-size: 12.5px; color: var(--muted); }
.product-off { font-size: 12.5px; font-weight: 700; color: #c0392b; }
.product-meta { font-size: 12px; }
.ali-status:empty { display: none; }
.ali-more { display: block; margin: 16px auto 8px; }
@media (max-width: 640px) {
  .ali-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .product { padding: 8px; }
  .product-price b { font-size: 16px; }
}
[hidden] { display: none !important; }
.ali-en { font-size: 13px; margin: -4px 0 12px; }
.hot-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.hot-cats .chip { cursor: pointer; font: inherit; font-size: 13px; }
.hot-cats .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
[aria-busy="true"] { opacity: .5; transition: opacity .2s; }

/* Promoción en portada y páginas temáticas */
.promo { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: var(--brand-soft); color: var(--text); text-decoration: none; border: 1px solid transparent; }
.promo:hover { border-color: var(--brand); }
.promo-icon { font-size: 34px; line-height: 1; }
.promo-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.promo-text b { font-size: 17px; color: var(--brand-dark); }
.promo-text span { font-size: 14px; color: var(--muted); }
.promo-go { font-size: 22px; color: var(--brand); }
.legal .lead { font-size: 17px; color: var(--muted); }
.topic { margin: 20px 0 28px; }
.topic .section-note { margin-top: 10px; }
.topic.topic-loaded > p:last-child { font-size: 14px; }
.faq dt { font-weight: 700; margin-top: 12px; }
.faq dd { margin: 4px 0 0; }

/* Tarjetas que llevan a nuestra ficha + ficha de producto (/temas/<slug>/<id>) */
.product-cta { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--brand); }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.crumbs a { color: var(--muted); }
.pdp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.pdp-main { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--surface); border-radius: 12px; }
.pdp-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pdp-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; width: 56px; height: 56px; overflow: hidden; }
.pdp-thumbs button[aria-current] { border-color: var(--brand); }
.pdp-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-info h1 { font-size: 20px; line-height: 1.35; margin: 0 0 10px; }
.pdp-price b { font-size: 30px; }
.pdp-price s { color: var(--muted); }
.pdp-meta { font-size: 14px; }
.btn-buy { width: 100%; min-height: 52px; font-size: 17px; margin: 8px 0 6px; }
.pdp-info h2 { font-size: 16px; margin: 18px 0 6px; }
.pdp-related { margin-top: 32px; }
.birds { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 16px; }
.birds th, .birds td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.birds th { background: var(--surface); }
@media (max-width: 760px) { .pdp { grid-template-columns: 1fr; gap: 16px; } }
.guides { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.guide { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.guide:hover { border-color: var(--brand); }
.guide span { font-size: 22px; }
.more-topics { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.more-topics h2 { width: 100%; margin: 0 0 4px; font-size: 16px; }

/* Recomendaciones («Buenas cosas») */
.video { margin: 8px 0 16px; }
.video-play, .video iframe { display: block; position: relative; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; overflow: hidden; background: #000; padding: 0; cursor: pointer; }
.video-play img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .9; }
.video-icon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 72px; height: 50px; border-radius: 12px; background: #e62117; color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.video-play:hover .video-icon { background: #c4170f; }
.video figcaption { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.rec-buy { margin: 16px 0 8px; }
.rec-off { padding: 14px; border-radius: 12px; background: var(--warn-soft); }
.steps-list li { margin: 0 0 8px; }
.rec-list { display: grid; gap: 12px; margin: 16px 0; }
.rec-card { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; align-items: center; }
.rec-card:hover { border-color: var(--brand); }
.rec-card-text { display: flex; flex-direction: column; gap: 4px; }
.rec-card-text b { font-size: 17px; }
.rec-card-text span { color: var(--muted); font-size: 14px; }
.rec-card-text .rec-card-price { color: var(--text); font-weight: 700; font-size: 16px; }
.rec-card-text .product-cta { color: var(--brand); }
@media (max-width: 520px) { .rec-card { grid-template-columns: 96px 1fr; } }
