/* ==========================================================================
   ficha.css — Ficha de producto de las tiendas de licencia (El Siglo)

   Pareja de `ficha.js`. Capa aditiva sobre Journal 3: no toca el CSS del tema,
   sólo viste lo que el script inyecta y reordena.

   OJO CON JOURNAL (ver reference-journal3-css-que-no-gana): el tema emite reglas
   con `!important` y especificidad alta por módulo. Donde hay que pisarle algo
   se gana por especificidad con `html body #product ...`, no con `!important`
   a secas.

   Colores: salen de los tokens de marca de base.css (--brand-primary,
   --brand-accent, --brand-surface...), así que cada tienda se pinta sola.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1) PASOS NUMERADOS
   -------------------------------------------------------------------------- */
html body #product .sg-paso-cab {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, .08);
}
html body #product .product-options > .sg-paso-cab:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
/* La guía de tallas se alinea a la derecha de la cabecera del paso */
html body #product .sg-paso-cab .sg-guia { margin-left: auto; }

html body #product .sg-paso-n {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-primary, #c8102e);
  color: var(--brand-on-primary, #fff);
  font-size: 13px;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}
html body #product .sg-paso-t {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--brand-primary, #222);
}

/* Journal pone el título "Opciones disponibles"; con los pasos sobra */
html body #product .product-options h3.options-title { display: none; }

/* Los grupos que pasan a botones se apilan: etiqueta arriba, botones debajo.
   Se desactiva a propósito el reparto en fila de Journal SÓLO en estos. */
html body #product .product-options .form-group.sg-btn {
  flex-direction: column;
  align-items: stretch;
  row-gap: 8px;
}
html body #product .product-options .form-group.sg-btn > label.control-label {
  width: auto;
  flex: 0 0 auto;
  font-size: 13.5px;
  font-weight: 600;
  color: #55606c;
}
html body #product .sg-guia-suelta { flex: 0 0 100%; margin-bottom: 4px; }

/* Opción obligatoria de un solo valor (la «Selección» de gorras y souvenirs):
   el script la elige sola. El grupo se esconde pero SIGUE EN EL FORMULARIO —
   ahí vive el stock (`subtract=1`), así que no puede quitarse del DOM. */
html body #product .product-options .form-group.sg-auto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Aviso al intentar comprar sin talla */
@keyframes sg-flash {
  0%, 100% { background: transparent; }
  30%      { background: rgba(255, 190, 60, .35); }
}
html body #product .sg-flash { animation: sg-flash 1.2s ease; border-radius: 6px; }

/* --------------------------------------------------------------------------
   2) OPCIONES COMO BOTONES
   -------------------------------------------------------------------------- */
html body #product .form-group.sg-btn > select.form-control {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}
html body #product .sg-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
html body #product button.sg-opt {
  min-width: 52px;
  padding: 9px 13px;
  border: 1.5px solid rgba(0, 0, 0, .18);
  border-radius: 6px;
  background: var(--brand-surface, #fff);
  color: #222;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
}
html body #product button.sg-opt i {
  font-style: normal;
  font-weight: 500;
  opacity: .7;
  margin-left: 3px;
  font-size: 12.5px;
}
html body #product button.sg-opt:hover {
  border-color: var(--brand-accent, #888);
}
html body #product button.sg-opt.sel {
  border-color: var(--brand-primary, #c8102e);
  background: var(--brand-primary, #c8102e);
  color: var(--brand-on-primary, #fff);
}
html body #product button.sg-opt.sel i { opacity: .85; }
/* Valor más barato («Kids −$180»): el descuento se lee en verde y entero */
html body #product button.sg-opt i.sg-menos { color: var(--sg-ok, #0f8f4d); opacity: 1; font-weight: 700; }
html body #product button.sg-opt.sel i.sg-menos { color: inherit; }
html body #product button.sg-opt:focus-visible {
  outline: 2px solid var(--brand-accent, #333);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3) GUIA DE TALLAS
   -------------------------------------------------------------------------- */
html body #product button.sg-guia {
  border: 0;
  background: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-accent, #0a58ca);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  white-space: nowrap;
}
html body #product button.sg-guia:hover { color: var(--brand-primary, #000); }

.sg-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 18, 22, .72);
}
.sg-modal.abierto { display: flex; }
body.sg-modal-on { overflow: hidden; }
.sg-modal-caja {
  position: relative;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 20px 20px 24px;
}
.sg-modal-tit {
  margin: 0 34px 14px 0;
  font-size: 17px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #1a1d21;
}
.sg-modal-caja img { display: block; width: 100%; height: auto; }
.sg-modal-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #eef0f2;
  color: #333;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.sg-modal-x:hover { background: #e0e3e6; }

/* --------------------------------------------------------------------------
   4) AVISO DE PERSONALIZACION
   -------------------------------------------------------------------------- */
/* Journal declara `.form-group > div { display:flex }`. La nota es un div hijo
   del grupo, así que se volvía contenedor flex: cada <b> y cada trozo de texto
   pasaban a ser ítems y **los espacios entre ellos desaparecían**
   ("bordados.El bordado", "suma de7 a 8 días"). Hay que devolverla a bloque. */
html body #product .form-group > .sg-perso-nota { display: block; }

html body #product .sg-perso-nota {
  margin-top: 10px;
  padding: 10px 13px;
  border-left: 3px solid var(--brand-accent, #e0a92e);
  border-radius: 0 4px 4px 0;
  background: rgba(0, 0, 0, .035);
  font-size: 13.5px;
  line-height: 1.5;
  color: #3a444f;
}
html body #product .sg-perso-nota b { color: #1c2229; }

/* El campo de nombre y número se pega al paso de personalización */
html body #product .form-group.sg-perso-texto {
  margin-top: 10px;
  padding-top: 0;
  border-top: 0;
}

/* La caja "PERSONALIZADO" del módulo 248 decía lo mismo y sólo salía en
   escritorio. Con la nota dentro del paso, sobra. Y en los productos SIN
   personalización (hieleras, gorras, souvenirs) hablaba del bordado de los
   jerseys: fuera siempre (2026-11-04, antes sólo con .sg-perso-ok). */
html body #product .product-blocks.blocks-top { display: none; }

/* --------------------------------------------------------------------------
   5) PRECIO ARRIBA, DATOS INTERNOS ABAJO
   -------------------------------------------------------------------------- */
html body #product .product-price-group { margin-top: 6px; }

html body #product .product-stats.sg-abajo,
html body #product .rating.rating-page.sg-abajo {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, .08);
  opacity: .78;
  font-size: 13px;
}
/* El contador de visitas no es información para quien compra */
html body #product .product-stats .product-views,
html body #product .product-stats .custom-stats { display: none; }

/* --------------------------------------------------------------------------
   6) BLOQUE DE CONFIANZA
   -------------------------------------------------------------------------- */
html body #product .sg-confianza {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, .08);
}
html body #product .sg-confianza .sg-ci {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #48535e;
}
html body #product .sg-confianza .sg-ci svg { flex: none; color: var(--brand-primary, #666); }
html body #product .sg-confianza .sg-ci b { color: #1c2229; font-weight: 600; }

/* --------------------------------------------------------------------------
   7) BARRA FIJA DE COMPRA — SOLO TELEFONO
   -------------------------------------------------------------------------- */
.sg-buybar { display: none; }

@media (max-width: 767px) {
  .sg-buybar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom, 0px));
    background: var(--brand-surface, #fff);
    border-top: 1px solid rgba(0, 0, 0, .12);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .12);
    transform: translateY(0);
    transition: transform .22s ease;
  }
  .sg-buybar.oculta { transform: translateY(120%); }

  .sg-buybar .sg-bb-precio {
    flex: none;
    font-size: 18px;
    font-weight: 800;
    color: #14181d;
    white-space: nowrap;
  }
  .sg-buybar .sg-bb-add {
    flex: 1;
    min-height: 46px;
    border: 0;
    border-radius: 6px;
    background: var(--brand-primary, #c8102e);
    color: var(--brand-on-primary, #fff);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .sg-buybar .sg-bb-add.falta {
    background: #6b7683;
  }

  /* Journal fija `.route-product-product:not(.popup) body { padding-bottom:0 }`,
     que son dos clases: hay que igualarle o la barra tapa el final del pie. */
  html.route-product-product body.con-sg-buybar { padding-bottom: 66px; }

  /* El botón flotante de WhatsApp se sube para no quedar debajo de la barra */
  html.route-product-product body.con-sg-buybar .journal-whatsapp,
  html.route-product-product body.con-sg-buybar [class*="whatsapp"] { bottom: 80px; }

  html body #product .sg-opts { gap: 7px; }
  html body #product button.sg-opt { min-width: 48px; padding: 10px 12px; }
  .sg-modal { padding: 12px; }
  .sg-modal-caja { padding: 16px 16px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sg-buybar { transition: none; }
  html body #product .sg-flash { animation: none; }
}

/* --------------------------------------------------------------------------
   8) LA COLUMNA DERECHA NO SE QUEDA VACÍA (2026-11-04, §113)
   -------------------------------------------------------------------------- */
/* 8a. Caja de opciones sin nada visible: se pliega (el grupo auto-elegido
   sigue dentro, en 1x1 px, porque ahí vive el stock del formulario). */
html body #product.sg-sin-opciones .product-options {
  position: relative;
  height: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
}

/* 8b. Resumen bajo el precio */
html body #product .sg-resumen {
  margin: 2px 0 18px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--sg-ink-soft, #5b6570);
}
html body #product .sg-resumen-txt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html body #product .sg-resumen-txt p { margin: 0 0 6px; }
html body #product .sg-resumen-txt p:last-child { margin-bottom: 0; }
html body #product .sg-resumen-mas {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--brand-accent, var(--sg-accent, #0f62c9));
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* 8c. Tarjeta de compra y detalles (sólo sin opciones) */
html body #product .sg-compra-card {
  background: var(--brand-surface, #fff);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 10px;
  padding: 16px 16px 6px;
  box-shadow: var(--sg-shadow, 0 1px 2px rgba(16, 24, 40, .04));
}
html body #product .sg-compra-card .button-group-page { margin: 0; }
html body #product .sg-compra-card .sg-confianza {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, .08);
}
html body #product .sg-datos { margin-top: 18px; }
html body #product .sg-datos-t {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--sg-ink-soft, #5b6570);
  margin-bottom: 8px;
}
html body #product .sg-datos-l {
  display: grid;
  grid-template-columns: minmax(96px, max-content) 1fr;
  column-gap: 14px;
  row-gap: 7px;
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}
html body #product .sg-datos-l dt { font-weight: 700; color: var(--sg-ink, #14171a); margin: 0; }
html body #product .sg-datos-l dd { margin: 0; color: var(--sg-ink-soft, #5b6570); }
@media (max-width: 767px) {
  html body #product .sg-resumen { font-size: 14px; }
  html body #product .sg-compra-card { padding: 12px 12px 4px; }
  /* Journal deja 68 px de relleno bajo los botones en telefono (reserva
     para lo que se apila debajo); dentro de la tarjeta era un hueco. */
  html body #product .sg-compra-card .button-group-page .buttons-wrapper { padding-bottom: 0; }
}

/* --------------------------------------------------------------------------
   9) BOTONES TIPO PASTILLA Y SELECTOR DE CANTIDAD MODERNO (2026-11-04, §114)
   --------------------------------------------------------------------------
   El usuario: «estilizar los botones a que se vea más tipo pastilla, que se
   vea redondito, e igual modernizar el selector de cantidad».
   Medido antes: tallas con radio 6; COMPRAR con radio 0 (base.css le pone
   --sg-radius-sm pero lo pisa el tema, de ahí el !important); y el contador
   de Journal era un cuadro de 100x52 con marco negro de 1 px y dos flechas
   FontAwesome en bloques gris marengo de 39x25 apiladas a la derecha
   (position:absolute). Pasa a una pastilla horizontal  (−) 1 (+)  con los
   botones estáticos y en círculo; el icono FA se sustituye por el signo
   escribiendo encima de su ::before. Vale para las cuatro tiendas. */
html body #product button.sg-opt {
  border-radius: 999px;
  padding: 9px 16px;
  min-width: 56px;
}
html body #product .button-group-page #button-cart,
html body #product .button-group-page .btn-cart,
.sg-buybar .sg-bb-add {
  border-radius: 999px !important;
}

html body #product .button-group-page .stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 52px;
  /* Journal fija el ancho por variable (--stepper-*) y el campo se encogía a
     25 px: ancho fijo y sin encoger. Medido. */
  width: 134px !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: 0 0 134px !important;
  padding: 0 5px;
  border: 1.5px solid rgba(0, 0, 0, .16) !important;
  border-radius: 999px;
  background: var(--brand-surface, #fff) !important;
  overflow: hidden;
  box-sizing: border-box;
}
html body #product .button-group-page .stepper > button {
  position: static !important;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  color: var(--sg-ink, #14171a) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s;
}
html body #product .button-group-page .stepper > button:hover { background: rgba(0, 0, 0, .07) !important; }
html body #product .button-group-page .stepper > button:active { background: rgba(0, 0, 0, .13) !important; }
html body #product .button-group-page .stepper > button::before {
  font: 700 22px/1 "Ubuntu", Arial, sans-serif !important;
  color: inherit;
}
html body #product .button-group-page .stepper > button.fa-angle-down::before { content: "\2212" !important; }
html body #product .button-group-page .stepper > button.fa-angle-up::before { content: "+" !important; }
html body #product .button-group-page .stepper input.form-control {
  width: 40px !important;
  flex: 0 0 40px !important;
  height: 46px;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--sg-ink, #14171a);
  -moz-appearance: textfield;
}
html body #product .button-group-page .stepper input.form-control::-webkit-outer-spin-button,
html body #product .button-group-page .stepper input.form-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

@media (max-width: 767px) {
  /* En teléfono el CTA ocupa todo el ancho y el contador va encima, centrado */
  html body #product .button-group-page .stepper { height: 48px; width: 128px !important; flex-basis: 128px !important; }
  html body #product .button-group-page .stepper > button { width: 36px; height: 36px; }
  html body #product .button-group-page .stepper input.form-control { height: 42px; }
}
