/* Ficha de producto. Este archivo solo se carga en productos y en el editor.
   Los widgets nativos de Elementor mandan sobre estas reglas (su CSS tiene más
   especificidad), así que sirven de punto de partida. */

:root {
  --of-azul: #1c4056;
  --of-teal: #2bc0b3;
  --of-gris: #9aa7ad;
  --of-borde: #dfe6e6;
  --of-radio: 20px;
}

/* Etiqueta de marca y referencia (widgets de Elementor con campo ACF) */
.of-etiqueta {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--of-teal);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.6;
  text-transform: uppercase;
}

.of-ref {
  color: var(--of-gris);
  font-size: 13px;
  line-height: 1.6;
}

/* Galería: imagen grande + miniaturas, una de ellas el vídeo */
.of-galeria {
  --of-galeria-columnas: 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.of-galeria__escena {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--of-radio);
  background: #fff;
}

.of-galeria__slide {
  display: grid;
  grid-area: 1 / 1;
  place-items: center;
  padding: 8%;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease;
}

.of-galeria__slide.is-activa {
  opacity: 1;
  visibility: visible;
}

.of-galeria__slide img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.of-galeria__miniaturas {
  display: grid;
  grid-template-columns: repeat(var(--of-galeria-columnas), minmax(0, 1fr));
  gap: 12px;
}

.of-galeria__mini {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 8%;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: border-color .25s ease;
}

.of-galeria__mini img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* El fondo se repite porque los estilos de botón del tema padre ganan
   especificidad en :hover */
.of-galeria__mini.is-activa,
.of-galeria__mini:hover,
.of-galeria__mini:focus-visible {
  border-color: var(--of-teal);
  background: #fff;
  outline: none;
}

/* Precio de [oferfarma_producto_precio]. La estructura es la misma con oferta
   y sin ella, así que el bloque no cambia de alto ni de alineación. */
.of-precio {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin: 0;
  color: var(--of-azul);
  font-family: "Kanit", sans-serif;
  line-height: 1;
}

.of-precio__desde {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .01em;
}

.of-precio__actual {
  font-size: 44px;
  font-style: italic;
  font-weight: 800;
  white-space: nowrap;
}

.of-precio__actual .woocommerce-Price-currencySymbol {
  font-size: .6em;
  font-weight: 700;
  vertical-align: .5em;
}

.of-precio__anterior {
  color: #b7b7b7;
  font-size: 20px;
  font-weight: 500;
  text-decoration: line-through;
  white-space: nowrap;
}

.of-precio__anterior .woocommerce-Price-currencySymbol {
  font-size: 1em;
  vertical-align: baseline;
}

/* Porcentaje de descuento */
.of-descuento {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(43, 192, 179, .16);
  color: #17897f;
  font-family: "Kanit", sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

/* Disponibilidad */
.of-stock {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--of-teal);
  font-size: 14px;
  font-weight: 500;
}

.of-stock--reserva {
  color: #d79a2b;
}

.of-stock--agotado {
  color: #c0392b;
}

.of-stock__punto {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

/* Cantidad y añadir al carrito (widget de Elementor) */
.of-qty {
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
  height: 54px;
  padding: 0 6px;
  border: 1px solid var(--of-borde);
  border-radius: 999px;
  background: #fff;
}

.of-qty input.qty {
  width: 44px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--of-azul);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.of-qty input.qty::-webkit-outer-spin-button,
.of-qty input.qty::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.of-qty__boton {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--of-azul);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease;
}

.of-qty__boton:hover {
  background: #f1f5f5;
}

.of-carrito-fila form.cart {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin: 0;
}

.of-carrito-fila form.cart .single_add_to_cart_button {
  flex: 1 1 auto;
  min-height: 54px;
  border-radius: 999px;
  background: var(--of-teal);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Caja de ventajas del repetidor ACF */
.of-checks {
  display: grid;
  gap: 15px;
  margin: 0;
  padding: 24px 26px;
  border-radius: 18px;
  background: #fff;
  list-style: none;
}

.of-checks__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  color: var(--of-azul);
  font-size: 15px;
  line-height: 1.4;
}

.of-checks__item .of-icono {
  flex: 0 0 auto;
  margin-top: .05em;
  color: var(--of-teal);
}

/* Favoritos */
.of-favorito {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--of-azul);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
}

.of-favorito .of-icono {
  flex: 0 0 auto;
  color: var(--of-gris);
  transition: color .2s ease, transform .2s ease;
}

.of-favorito:hover,
.of-favorito:focus-visible {
  background: transparent;
  color: var(--of-azul);
}

.of-favorito:hover .of-icono {
  color: #e2574c;
  transform: scale(1.08);
}

.of-favorito.is-activo .of-icono {
  color: #e2574c;
}

.of-favorito.is-activo .of-icono path {
  fill: currentColor;
}

.of-favorito.is-cargando {
  opacity: .55;
  pointer-events: none;
}

.of-favoritos-vacio {
  margin: 0;
  color: var(--of-azul);
}

/* Vídeo vertical situado a la izquierda del acordeón */
.of-video-lateral {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 18px;
  background: #e8eeee;
  color: var(--of-teal);
}

.of-video-lateral__portada {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.of-video-lateral:hover .of-video-lateral__portada {
  transform: scale(1.025);
}

.of-video-lateral__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 68px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  transform: translate(-50%, -50%);
  transition: transform .25s ease;
}

.of-video-lateral:hover .of-video-lateral__play {
  transform: translate(-50%, -50%) scale(1.08);
}

.of-video-lateral__play .of-icono {
  width: 25px;
  height: 25px;
  margin-left: 3px;
}

.of-video-lateral__duracion {
  position: absolute;
  right: 9px;
  bottom: 9px;
  display: none;
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(20, 26, 29, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.of-video-lateral__duracion:not(:empty) {
  display: block;
}

.of-video-lateral__metadatos {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Clases para los tres contenedores de Elementor:
   padre, columna del vídeo y columna del acordeón. */
.of-producto-detalles {
  display: flex;
}

.of-producto-detalles__contenido {
  min-width: 0;
  flex-grow: 1;
}

.of-producto-detalles__video:has(.of-video-lateral--vacio),
.of-producto-detalles.sin-video .of-producto-detalles__video {
  display: none !important;
}

.of-producto-detalles:has(.of-video-lateral--vacio) .of-producto-detalles__contenido,
.of-producto-detalles.sin-video .of-producto-detalles__contenido {
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 100% !important;
}

/* Botón que abre el vídeo del producto */
.of-video-boton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  padding: 14px 26px;
  border: 1px solid var(--of-borde);
  border-radius: 999px;
  background: #fff;
  color: var(--of-azul);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .25s ease, box-shadow .25s ease;
}

.of-video-boton:hover,
.of-video-boton:focus-visible {
  border-color: var(--of-teal);
  box-shadow: 0 8px 20px rgba(28, 64, 86, .08);
  color: var(--of-azul);
  outline: none;
}

/* Solo se ve dentro del editor de Elementor */
.of-aviso-editor {
  padding: 14px 16px;
  border: 1px dashed #b7b7b7;
  border-radius: 10px;
  color: #6b6b6b;
  font-size: 14px;
}

@media (max-width: 767px) {
  .of-precio__actual {
    font-size: 36px;
  }

  .of-checks {
    padding: 20px;
  }

  .of-carrito-fila form.cart {
    flex-wrap: wrap;
  }

  .of-carrito-fila form.cart .single_add_to_cart_button {
    flex-basis: 100%;
  }
}
