/*
 * Muebles DAJ - Cards modernas para la tienda (WooCommerce)
 * Mismo lenguaje visual que la sección "Productos Recientes" del home.
 */

:root {
  --mdaj-orange: #b45309;
  --mdaj-dark: #2b2b2b;
  --mdaj-green: #2e8b3d;
  --mdaj-border: #ecebe9;
  --mdaj-media-bg: #f0ece5;
}

/* Grilla de productos */
.woocommerce ul.products,
.woocommerce-page ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  margin: 0 0 32px !important;
  padding: 0;
  list-style: none;
}

@media (max-width: 992px) {
  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .woocommerce ul.products,
  .woocommerce-page ul.products {
    grid-template-columns: 1fr;
  }
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* El clearfix por defecto de WooCommerce (pensado para el layout con float)
   agrega ::before/::after con content:"" al ul.products. Al ser el ul un
   grid, esos pseudo-elementos pasan a contar como una celda más (la
   primera), corriendo todas las cards una columna. Los anulamos. */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
  content: none !important;
  display: none !important;
}

/* Card */
@keyframes mdaj-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mueblesdaj-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--mdaj-border);
  border-radius: 14px;
  overflow: hidden;
  transition:
    box-shadow 0.25s ease,
    transform 0.25s ease;
  animation: mdaj-fade-up 0.5s ease both;
}

.mueblesdaj-card:hover {
  box-shadow: 0 16px 32px rgba(20, 20, 20, 0.08);
  transform: translateY(-4px);
}

/* Entrada escalonada: cada card aparece un poco después que la anterior */
.woocommerce ul.products li.product:nth-child(1) .mueblesdaj-card {
  animation-delay: 0ms;
}
.woocommerce ul.products li.product:nth-child(2) .mueblesdaj-card {
  animation-delay: 40ms;
}
.woocommerce ul.products li.product:nth-child(3) .mueblesdaj-card {
  animation-delay: 80ms;
}
.woocommerce ul.products li.product:nth-child(4) .mueblesdaj-card {
  animation-delay: 120ms;
}
.woocommerce ul.products li.product:nth-child(5) .mueblesdaj-card {
  animation-delay: 160ms;
}
.woocommerce ul.products li.product:nth-child(6) .mueblesdaj-card {
  animation-delay: 200ms;
}
.woocommerce ul.products li.product:nth-child(7) .mueblesdaj-card {
  animation-delay: 240ms;
}
.woocommerce ul.products li.product:nth-child(8) .mueblesdaj-card {
  animation-delay: 280ms;
}
.woocommerce ul.products li.product:nth-child(n + 9) .mueblesdaj-card {
  animation-delay: 320ms;
}

@media (prefers-reduced-motion: reduce) {
  .mueblesdaj-card {
    animation: none;
  }
}

/* Imagen */
.mueblesdaj-card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--mdaj-media-bg);
  overflow: hidden;
}

.mueblesdaj-card__thumb-link {
  display: block;
  width: 100%;
  height: 100%;
}

.mueblesdaj-card__media img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.mueblesdaj-card:hover .mueblesdaj-card__media img {
  transform: scale(1.06);
}

/* Ocultamos el badge de oferta por defecto de WooCommerce: el lenguaje visual
   de referencia solo usa el badge de categoría y el de "Nuevo". */
.mueblesdaj-card__media > .onsale {
  display: none;
}

/* Badges sobre la imagen */
.mueblesdaj-card__badges {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.mueblesdaj-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
  transition: transform 0.25s ease;
}

.mueblesdaj-card:hover .mueblesdaj-badge {
  transform: translateY(-1px) scale(1.04);
}

.mueblesdaj-badge--cat {
  background: var(--mdaj-dark);
  color: #fff;
}

.mueblesdaj-badge--new {
  background: var(--mdaj-orange);
  color: #fff;
  margin-left: auto;
}

/* Cuerpo de la card */
.mueblesdaj-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 18px 20px;
}

.mueblesdaj-card__category {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9a958f;
  margin-bottom: 6px;
}

.mueblesdaj-card__body .woocommerce-loop-product__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--mdaj-dark);
  margin: 0 0 8px;
  line-height: 1.3;
}

.mueblesdaj-card__body .star-rating {
  margin-bottom: 6px;
  font-size: 13px;
}

.mueblesdaj-card__body .price {
  display: block;
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 700;
  color: var(--mdaj-orange);
}

.mueblesdaj-card__body .price del {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #9a958f;
  opacity: 1;
  order: -1;
}

.mueblesdaj-card__body .price ins {
  text-decoration: none;
  color: var(--mdaj-green);
}

/* Plugin de precio "Precio Lista / Transferencia" (markup .ip-prices) */
.mueblesdaj-card__body .price .ip-prices {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mueblesdaj-card__body .ip-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mueblesdaj-card__body .ip-row--list {
  order: 2;
  font-size: 13px;
  font-weight: 400;
  color: #9a958f;
}

.mueblesdaj-card__body .ip-row--list .ip-amount {
  text-decoration: line-through;
}

.mueblesdaj-card__body .ip-row--transfer {
  order: 1;
  font-size: 19px;
  font-weight: 700;
  color: var(--mdaj-green);
}

.mueblesdaj-card__body .ip-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.8;
}

/* Botones */
.mueblesdaj-card__actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.mueblesdaj-card__actions > a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-align: center;
  text-decoration: none !important;
  line-height: 1.4 !important;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
  white-space: normal;
  box-shadow: none !important;
}

.mueblesdaj-card__actions > a:active {
  transform: scale(0.96);
}

.mueblesdaj-btn--outline {
  background: #fff !important;
  color: var(--mdaj-dark) !important;
  border: 1px solid var(--mdaj-dark) !important;
}

.mueblesdaj-btn--outline:hover {
  background: var(--mdaj-dark) !important;
  color: #fff !important;
}

.mueblesdaj-card__actions .add_to_cart_button,
.mueblesdaj-card__actions .product_type_variable,
.mueblesdaj-card__actions .product_type_grouped,
.mueblesdaj-card__actions .product_type_external {
  background: var(--mdaj-dark) !important;
  color: #fff !important;
  border: 1px solid var(--mdaj-dark) !important;
  opacity: 1 !important;
}

/* Mismo ícono de carrito (outline) que usa la card del home (daj-card__btn-cart) */
.mueblesdaj-card__actions .add_to_cart_button::before,
.mueblesdaj-card__actions .product_type_variable::before,
.mueblesdaj-card__actions .product_type_grouped::before,
.mueblesdaj-card__actions .product_type_external::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIuNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48Y2lyY2xlIGN4PSI5IiBjeT0iMjEiIHI9IjEiLz48Y2lyY2xlIGN4PSIyMCIgY3k9IjIxIiByPSIxIi8+PHBhdGggZD0iTTEgMWg0bDIuNjggMTMuMzlhMiAyIDAgMDAxLjk5IDEuNjFoOS43MmEyIDIgMCAwMDEuOTctMS42N0wyMyA2SDYiLz48L3N2Zz4=");
  mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNSIgaGVpZ2h0PSIxNSIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIuNCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48Y2lyY2xlIGN4PSI5IiBjeT0iMjEiIHI9IjEiLz48Y2lyY2xlIGN4PSIyMCIgY3k9IjIxIiByPSIxIi8+PHBhdGggZD0iTTEgMWg0bDIuNjggMTMuMzlhMiAyIDAgMDAxLjk5IDEuNjFoOS43MmEyIDIgMCAwMDEuOTctMS42N0wyMyA2SDYiLz48L3N2Zz4=");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
}

.mueblesdaj-card__actions a:hover {
  background: var(--mdaj-orange) !important;
  border-color: var(--mdaj-orange) !important;
  color: #fff !important;
}

.mueblesdaj-card__actions .added_to_cart {
  display: none !important;
}
