/* Componentes propios (shortcodes y barras). Prefijo .oa- para no chocar con el tema. */

/* ---------- Botón con precio ---------- */
.oa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--oa-btn-h); padding: 0 22px;
  background: var(--oa-carbon); color: var(--oa-ivory) !important;
  border: 1px solid var(--oa-carbon); border-radius: var(--oa-radius);
  font: 600 .8rem/1 var(--oa-sans); letter-spacing: .1em; text-transform: uppercase;
  text-decoration: none !important; white-space: nowrap; cursor: pointer;
  transition: background .2s var(--oa-ease), transform .2s var(--oa-ease);
}
.oa-btn:hover { background: var(--oa-carbon-hover); }
.oa-btn:active { transform: translateY(1px); }
.oa-btn__sep { opacity: .5; }
.oa-btn__price { letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.oa-btn.loading { opacity: .7; pointer-events: none; }
.oa-btn.loading::after,
.oa-btn.added::after { display: none !important; } /* spinner y check de BeTheme/Woo: usamos el nuestro */
.oa-btn.added .oa-btn__ok::before { content: "✓"; margin-left: 4px; }
.oa-btn--ghost { background: transparent; color: var(--oa-carbon) !important; }
.oa-btn--ghost:hover { background: var(--oa-carbon); color: var(--oa-ivory) !important; }
.oa-btn--accent { background: var(--oa-gold); border-color: var(--oa-gold); color: var(--oa-carbon) !important; }
.oa-btn--accent:hover { background: #D3B272; }
.oa-btn--disabled { background: var(--oa-ivory-2); border-color: var(--oa-line); color: var(--oa-carbon-70) !important; cursor: not-allowed; }
/* El enlace "Ver carrito" que WooCommerce inyecta tras añadir sobra: abre el carrito lateral */
.oa-cases .added_to_cart, .oa-aoves .added_to_cart, .oa-pantry .added_to_cart,
.oa-mbar .added_to_cart, .oa-loop-buy .added_to_cart { display: none !important; }

.oa-price { font: 600 var(--oa-fs-price)/1 var(--oa-sans); color: var(--oa-olive); font-variant-numeric: tabular-nums; }
.oa-price del { font-size: .55em; font-weight: 400; color: var(--oa-carbon-70); margin-right: 6px; }
.oa-price ins { text-decoration: none; }

/* WooCommerce y BeTheme fuerzan display/line-height en .button dentro de los
   listados (.woocommerce ul.products li.product .button): blindamos lo esencial. */
body.oa-ui .oa-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  line-height: 1 !important;
  min-height: var(--oa-btn-h);
  height: auto;
  padding: 0 22px !important;
  margin: 0;
}

/* ---------- Botón en listados ---------- */
.oa-loop-buy { padding: var(--oa-s2) 0 0; }
body.oa-ui .oa-loop-buy .oa-btn { width: 100%; }

/* Tarjetas de la misma fila con el botón alineado abajo */
body.oa-ui ul.products li.product { display: flex !important; flex-direction: column !important; flex-wrap: nowrap !important; }
body.oa-ui ul.products li.product > * { width: 100% !important; max-width: 100% !important; }
body.oa-ui ul.products li.product > .desc { flex: 1; display: flex; flex-direction: column; align-items: stretch; padding: var(--oa-s2) var(--oa-s2) 0 !important; box-sizing: border-box; }
body.oa-ui ul.products li.product .mfn-li-product-row-button { margin-top: auto !important; }
/* Precio y etiqueta de ahorro en la misma línea, sin estirarse */
body.oa-ui ul.products li.product .desc > .savings { align-self: flex-start; }

/* Responsive: una columna de rejilla (1fr = minmax(auto,1fr)) nunca encoge por
   debajo del contenido sin min-width:0; si no, el botón "nowrap" desborda la pantalla. */
body.oa-ui ul.products > li.product { min-width: 0; }
body.oa-ui ul.products li.product .oa-btn { max-width: 100%; }
@media (max-width: 600px) {
  /* En tarjetas estrechas el precio ya está encima: el botón queda en "Añadir" */
  body.oa-ui ul.products li.product .oa-btn { padding: 0 10px !important; font-size: .72rem; letter-spacing: .08em; gap: 6px; }
  body.oa-ui ul.products li.product .oa-btn__sep,
  body.oa-ui ul.products li.product .oa-btn__price { display: none; }
  body.oa-ui ul.products li.product > .desc { padding: 12px 12px 0 !important; }
  body.oa-ui ul.products li.product .desc h4,
  body.oa-ui ul.products li.product .woocommerce-loop-product__title { font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
  body.oa-ui ul.products li.product .price { font-size: 1.1rem; }
  body.oa-ui ul.products li.product .price del { font-size: .8em; }
}

/* ---------- [oa_estuches] ---------- */
.oa-cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--oa-s3); }
.oa-case { background: var(--oa-white); border: 1px solid var(--oa-line); border-radius: var(--oa-radius); display: flex; flex-direction: column; min-width: 0; }
.oa-case__media { display: block; background: var(--oa-ivory-2); overflow: hidden; }
.oa-case__img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; transition: transform .4s var(--oa-ease); }
.oa-case:hover .oa-case__img { transform: scale(1.02) translateY(-4px); }
.oa-case__body { padding: var(--oa-s4); display: flex; flex-direction: column; gap: var(--oa-s1); flex: 1; }
.oa-case__title { font-family: var(--oa-serif); font-size: var(--oa-fs-h3); margin: 0; }
.oa-case__title a { text-decoration: none; }
.oa-case__detail { margin: 0; color: var(--oa-carbon-70); }
.oa-case__buy { margin-top: auto; padding-top: var(--oa-s3); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--oa-s2); }

/* ---------- [oa_coleccion] (bento de 3) ---------- */
.oa-aoves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--oa-s3); }
.oa-aove { background: var(--oa-white); border: 1px solid var(--oa-line); border-radius: var(--oa-radius); display: flex; flex-direction: column; min-width: 0; }
.oa-aove__media { display: block; background: var(--oa-ivory-2); overflow: hidden; }
.oa-aove__img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s var(--oa-ease); }
.oa-aove:hover .oa-aove__img { transform: translateY(-5px); }
.oa-aove__body { padding: var(--oa-s3); display: flex; flex-direction: column; gap: 12px; flex: 1; }
.oa-aove__title { font-family: var(--oa-serif); font-size: 1.75rem; margin: 0; }
.oa-aove__note { margin: 0; color: var(--oa-carbon-70); font-size: .95rem; }
.oa-aove__buy { margin-top: auto; padding-top: var(--oa-s1); }
.oa-aove__buy .oa-btn { width: 100%; }

.oa-int { display: flex; align-items: center; gap: 10px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--oa-olive); font-weight: 600; }
.oa-int__bar { display: grid; grid-template-columns: repeat(3, 22px); gap: 4px; }
.oa-int__bar i { height: 4px; background: var(--oa-line); border-radius: 1px; }
.oa-int__bar i.on { background: var(--oa-olive); }

.oa-seg { display: inline-flex; border: 1px solid var(--oa-carbon); border-radius: var(--oa-radius); padding: 0; margin: 0; overflow: hidden; width: fit-content; }
.oa-seg__opt { position: relative; cursor: pointer; margin: 0; }
.oa-seg__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.oa-seg__opt span { display: block; padding: 10px 14px; min-height: 44px; line-height: 24px; font-size: .8rem; color: var(--oa-carbon); }
.oa-seg__opt input:checked + span { background: var(--oa-carbon); color: var(--oa-ivory); }
.oa-seg__opt input:focus-visible + span { outline: 2px solid var(--oa-gold-deep); outline-offset: -4px; }

/* ---------- [oa_despensa] ---------- */
/* Foto del aceite verde + una tarjeta por lata (2 × 2 en móvil) */
.oa-pantry-wrap { display: grid; gap: var(--oa-s3); }
.oa-pantry__hero { position: relative; margin: 0; border-radius: var(--oa-radius); overflow: hidden; background: var(--oa-olive); }
.oa-pantry__hero-img { display: block; width: 100%; height: auto !important; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 45%; }
.oa-pantry__hero figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px var(--oa-s2) var(--oa-s2);
  background: linear-gradient(transparent, rgba(23, 22, 18, .78)); color: var(--oa-ivory);
  font-family: var(--oa-serif); font-size: 1.15rem; line-height: 1.25;
}
.oa-pantry { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.oa-pantry__item { display: flex; flex-direction: column; min-width: 0; background: var(--oa-white); border: 1px solid var(--oa-line); border-radius: var(--oa-radius); overflow: hidden; }
.oa-pantry__media { position: relative; display: block; background: var(--oa-ivory-2); }
body.oa-ui .oa-pantry__img { display: block; width: 100%; height: auto !important; aspect-ratio: 4 / 5; object-fit: cover; }
.oa-pantry__badge {
  position: absolute; right: 8px; top: 8px; padding: 4px 8px; border-radius: 2px; background: var(--oa-gold);
  font-size: .58rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--oa-carbon); line-height: 1.2;
}
.oa-pantry__body { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 12px; }
.oa-pantry__fmt { font-family: var(--oa-serif); font-size: 1.35rem; line-height: 1.1; }
.oa-pantry__unit { margin-bottom: 10px; color: var(--oa-carbon-70); font-size: .8rem; font-variant-numeric: tabular-nums; }
body.oa-ui .oa-pantry .oa-btn { margin-top: auto; width: 100%; min-height: 44px; padding: 0 8px !important; font-size: .72rem; letter-spacing: .06em; }
@media (min-width: 768px) {
  .oa-pantry { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--oa-s2); }
  .oa-pantry__hero-img { aspect-ratio: 21 / 9; }
}
@media (min-width: 1025px) {
  /* Foto vertical a la izquierda, latas 2 × 2 a la derecha */
  .oa-pantry-wrap { grid-template-columns: minmax(0, .9fr) minmax(0, 2fr); gap: var(--oa-s4); align-items: stretch; }
  .oa-pantry__hero-img { height: 100% !important; aspect-ratio: auto; min-height: 420px; position: absolute; inset: 0; }
  .oa-pantry__hero { min-height: 420px; }
  .oa-pantry__hero figcaption { padding: 80px var(--oa-s3) var(--oa-s3); font-size: 1.4rem; }
  .oa-pantry__body { padding: var(--oa-s2); }
  .oa-pantry__fmt { font-size: 1.6rem; }
  body.oa-ui .oa-pantry .oa-btn { font-size: .76rem; }
}

/* ---------- Envío gratis ---------- */
.oa-ship { padding: 12px 0; }
.oa-ship__text { margin: 0 0 8px; font-size: .88rem; color: var(--oa-olive); }
.oa-ship__track { height: 4px; background: var(--oa-olive-soft); border-radius: 2px; overflow: hidden; }
.oa-ship__track span { display: block; height: 100%; background: var(--oa-olive); transition: width .4s var(--oa-ease); }

/* ---------- Barra de compra fija (ficha) ---------- */
.oa-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
  display: flex; align-items: center; justify-content: space-between; gap: var(--oa-s2);
  padding: 12px var(--oa-gutter) calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(250, 247, 240, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--oa-gold);
}
.oa-sticky[hidden] { display: none; }
.oa-sticky__info { display: flex; flex-direction: column; min-width: 0; }
.oa-sticky__name { font-family: var(--oa-serif); font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-sticky__price { font-size: .9rem; color: var(--oa-olive); }
body.oa-has-sticky { padding-bottom: 80px; }

/* ---------- Barra inferior en móvil (portada y tienda) ---------- */
.oa-mbar { display: none; }
@media (max-width: 767px) {
  .oa-mbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--oa-carbon); color: var(--oa-ivory);
    transition: transform .3s var(--oa-ease);
  }
  /* oa.js la esconde al bajar, mientras se ven los estuches y al añadir uno */
  .oa-mbar.is-hidden { transform: translateY(110%); }
  .oa-mbar__info { display: flex; flex-direction: column; color: var(--oa-ivory) !important; text-decoration: none; }
  .oa-mbar__name { font-family: var(--oa-serif); font-size: 1.15rem; }
  .oa-mbar__price { font-size: .8rem; color: var(--oa-gold); }
  body.oa-ui.oa-has-mbar { padding-bottom: 72px; }
  /* En la ficha manda la barra de compra propia */
  body.single-product .oa-mbar { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .oa-aoves { grid-template-columns: 1fr; }
  .oa-aove { flex-direction: row; }
  .oa-aove__media { flex: 0 0 38%; }
  .oa-aove__img { height: 100%; aspect-ratio: auto; }
}
@media (max-width: 767px) {
  .oa-cases { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding-bottom: 8px; }
  .oa-case { flex: 0 0 85%; scroll-snap-align: start; }
  .oa-case__body { padding: var(--oa-s3); }
  /* Variedades en filas compactas (brief 6.6): foto a la izquierda, compra a la derecha */
  .oa-aoves { gap: 12px; }
  .oa-aove { display: grid; grid-template-columns: 108px minmax(0, 1fr); flex-direction: row; }
  .oa-aove__media { flex: none; position: relative; }
  .oa-aove__img { position: absolute; inset: 0; width: 100%; height: 100% !important; aspect-ratio: auto; }
  .oa-aove__body { padding: 12px; gap: 8px; }
  .oa-aove__body > .oa-eyebrow { display: none; }
  .oa-aove__title { font-size: 1.35rem; }
  .oa-aove__note { font-size: .82rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .oa-seg__opt span { padding: 8px 10px; min-height: 40px; line-height: 24px; font-size: .74rem; }
  body.oa-ui .oa-aove__buy .oa-btn { min-height: 44px; padding: 0 12px !important; font-size: .74rem; }
}

/* ---------- Microinteracción del contador ---------- */
@keyframes oa-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.oa-pulse { animation: oa-pulse .45s var(--oa-ease); }

/* ---------- Carrito lateral (BeTheme .mfn-cart-holder) ---------- */
body.oa-ui .mfn-cart-holder { background: var(--oa-ivory) !important; font-family: var(--oa-sans); }
/* Hasta 480px el panel ocupa toda la pantalla: cerrado hay que sacarlo entero
   (BeTheme solo lo desplaza 420px y asomaba una franja a la derecha). */
@media (max-width: 480px) {
  body.oa-ui .mfn-cart-holder { max-width: 100vw !important; width: 100vw !important; right: -100vw; }
  html.mfn-cart-opened body.oa-ui .mfn-cart-holder { right: 0; }
}
body.oa-ui .mfn-cart-holder .mfn-ch-header { border-bottom: 1px solid var(--oa-line); }
body.oa-ui .mfn-cart-holder .mfn-ch-header h3,
body.oa-ui .mfn-cart-holder .mfn-ch-header h4 { font-family: var(--oa-serif); font-weight: 400; }
body.oa-ui .mfn-cart-holder .mfn-ch-product { background: var(--oa-white) !important; border: 1px solid var(--oa-line); border-radius: var(--oa-radius); }
body.oa-ui .mfn-cart-holder .mfn-chp-image img { width: 72px !important; height: 72px; object-fit: cover; }
body.oa-ui .mfn-cart-holder .mfn-chp-name { font-size: .95rem; line-height: 1.3; }
/* El precio unitario sobra: ya está el importe de la línea */
body.oa-ui .mfn-cart-holder .mfn-chp-info > p.price { display: none; }
body.oa-ui .mfn-cart-holder .mfn-chp-price { color: var(--oa-olive); font-weight: 600; text-align: right !important; }
body.oa-ui .mfn-cart-holder .mfn-ch-footer { background: var(--oa-ivory-2) !important; border-top: 1px solid var(--oa-gold); }
/* El IVA ya va incluido en el total ("incluye … IVA") */
body.oa-ui .mfn-cart-holder .mfn-chft-vat { display: none !important; }
body.oa-ui .mfn-cart-holder .mfn-chft-total { font-family: var(--oa-sans); }
body.oa-ui .mfn-cart-holder .mfn-chft-total .amount,
body.oa-ui .mfn-cart-holder .mfn-chft-subtotal-amount .amount { color: var(--oa-carbon) !important; }
body.oa-ui .mfn-cart-holder .mfn-ch-footer-buttons .button {
  min-height: 52px; display: flex !important; align-items: center; justify-content: center;
  background: var(--oa-carbon) !important; color: var(--oa-ivory) !important; border-radius: var(--oa-radius) !important;
  font-weight: 600; letter-spacing: .1em;
}
body.oa-ui .mfn-cart-holder .mfn-ch-footer-links a { color: var(--oa-carbon-70); }
body.oa-ui .mfn-cart-holder .oa-ship { padding: 12px 16px 0; }
.oa-suggest { display: flex; align-items: center; gap: 12px; padding: 12px 0; margin-bottom: 8px; border-bottom: 1px solid var(--oa-line); }
.oa-suggest__text { margin: 0; font-size: .85rem; line-height: 1.4; color: var(--oa-carbon); }
.oa-suggest .oa-btn { flex: 0 0 auto; min-height: 44px; padding: 0 14px !important; font-size: .72rem; }
.oa-suggest .added_to_cart { display: none !important; }
/* Carrito vacío: sugerencia en columna, botón a todo el ancho y salida a la tienda */
.oa-suggest--empty { flex-direction: column; align-items: stretch; text-align: center; border-bottom: 0; }
.oa-suggest--empty .oa-suggest__text { font-size: .92rem !important; }
.oa-suggest--empty .oa-btn { width: 100%; justify-content: center; }
body.oa-ui .oa-suggest__link { align-self: center; font-size: .85rem; font-weight: 600; color: var(--oa-olive); text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }
/* Con el carrito vacío sobran subtotal y total a 0,00 € */
body.oa-ui .mfn-cart-holder:has(.cart-empty) .mfn-ch-footer-totals > :not(.oa-suggest) { display: none !important; }
body.oa-ui .mfn-cart-holder:has(.cart-empty) .mfn-ch-footer-totals { margin: 0 !important; }
/* Sin productos no hay nada que finalizar (gana al display:block en línea de BeTheme) */
body.oa-ui .mfn-cart-holder:has(.cart-empty) .mfn-ch-footer-buttons { display: none !important; }
/* Pie del carrito lateral compacto: que se vean las líneas y el botón a la vez */
body.oa-ui .mfn-cart-holder .mfn-ch-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important; }
body.oa-ui .mfn-cart-holder .mfn-chft-row { padding-top: 4px !important; padding-bottom: 4px !important; margin: 0 !important; font-size: .9rem; }
body.oa-ui .mfn-cart-holder .mfn-chft-total { margin-top: 6px !important; padding-top: 8px !important; }
body.oa-ui .mfn-cart-holder .mfn-chft-total .amount { font-size: 1.35rem; }
body.oa-ui .mfn-cart-holder .mfn-ch-footer-buttons { padding-top: 10px; }
body.oa-ui .mfn-cart-holder .mfn-ch-footer-links { margin-top: 8px; }
body.oa-ui .mfn-cart-holder .mfn-ch-content { padding: 12px 16px !important; }
body.oa-ui .mfn-cart-holder .mfn-ch-product { padding: 0 !important; margin-bottom: 10px !important; }
body.oa-ui .mfn-cart-holder .mfn-ch-product > .mfn-chp-col,
body.oa-ui .mfn-cart-holder .mfn-chp-footer { padding: 10px 12px !important; }
/* BeTheme compensa con márgenes negativos el relleno de la tarjeta, que aquí es 0:
   sin anularlos el contador de cantidad se sale por abajo y por los lados */
body.oa-ui .mfn-cart-holder .mfn-chp-footer { margin: 0 !important; width: 100%; box-sizing: border-box; border-top: 1px solid var(--oa-line); }
.oa-suggest { padding: 0 0 10px; }
.oa-suggest__text { font-size: .8rem; }
body.oa-ui .mfn-cart-holder .mfn-ch-footer-totals { margin-bottom: 4px !important; }

/* BeTheme sangra las listas del contenido (.the_content_wrapper ul): las nuestras no */
body.oa-ui ul.oa-guar, body.oa-ui ol.oa-ritual__steps, body.oa-ui ul.oa-tierra__data,
body.oa-ui ul.oa-pantry, body.oa-ui ol.oa-inside__list, body.oa-ui ul.oa-perks {
  margin-left: 0 !important; margin-right: 0 !important; padding-left: 0 !important; list-style: none !important;
}
body.oa-ui .oa-guar li, body.oa-ui .oa-ritual__steps li, body.oa-ui .oa-tierra__data li,
body.oa-ui .oa-pantry li, body.oa-ui .oa-inside__list li { margin: 0 !important; }
