/**
 * Astra Product Carousel Pro – Frontend Styles
 * Inspirado en el diseño del carrusel de referencia (estilo Leroy Merlin / ManoMano)
 */

/* =============================================
   CSS CUSTOM PROPERTIES (defaults, overridden inline)
   ============================================= */
:root {
  --apcp-accent:       #e02020;
  --apcp-new-badge:    #3cb878;
  --apcp-bg:           #ffffff;
  --apcp-card-bg:      #ffffff;
  --apcp-title-color:  #111111;
  --apcp-card-radius:  0px;
  --apcp-card-shadow:  0 2px 12px rgba(0,0,0,0.07);
  --apcp-gap:          24px;
  --apcp-padding:      60px 0;

  /* Internal */
  --apcp-text:         #222222;
  --apcp-text-muted:   #888888;
  --apcp-border:       #ececec;
  --apcp-arrow-size:   44px;
  --apcp-transition:   0.28s cubic-bezier(0.4,0,0.2,1);
}

/* =============================================
   SECTION
   ============================================= */
.apcp-section {
  background: var(--apcp-bg);
  padding: var(--apcp-padding);
  box-sizing: border-box;
  position: relative;
  contain: layout style;
}

/* =============================================
   SECTION HEADER
   ============================================= */
.apcp-section__header {
  margin-bottom: 28px;
}

.apcp-section__title {
  font-family: inherit;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
  color: var(--apcp-title-color);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0 0 6px;
  line-height: 1.2;
}

/* Bold second word style (matches reference image) */
.apcp-section__title strong {
  font-weight: 900;
}

.apcp-section__subtitle {
  font-size: 0.95rem;
  color: var(--apcp-text-muted);
  margin: 0;
}

/* =============================================
   CAROUSEL WRAPPER
   ============================================= */
.apcp-carousel-wrapper {
  position: relative;
  overflow: visible;
}

/* =============================================
   SWIPER OVERRIDES
   ============================================= */
.apcp-swiper {
  overflow: hidden;
  padding-bottom: 4px; /* space for shadow */
}

.apcp-swiper .swiper-wrapper {
  align-items: stretch;
}

/* =============================================
   NAVIGATION ARROWS
   ============================================= */
.apcp-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: var(--apcp-arrow-size);
  height: var(--apcp-arrow-size);
  background: #555;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--apcp-transition);
  flex-shrink: 0;
  outline-offset: 2px;
}

.apcp-arrow:hover {
  background: #222;
}

.apcp-arrow:focus-visible {
  outline: 2px solid var(--apcp-accent);
}

.apcp-arrow--prev {
  left: calc(-1 * var(--apcp-arrow-size) - 8px);
}

.apcp-arrow--next {
  right: calc(-1 * var(--apcp-arrow-size) - 8px);
}

.apcp-arrow svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.apcp-arrow.swiper-button-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Responsive: arrows inside on small screens */
@media (max-width: 900px) {
  .apcp-arrow--prev { left: 0; }
  .apcp-arrow--next { right: 0; }
}

/* =============================================
   PAGINATION DOTS
   ============================================= */
.apcp-pagination {
  margin-top: 20px;
  text-align: center;
  line-height: 1;
}

.apcp-pagination .swiper-pagination-bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--apcp-border);
  margin: 0 4px;
  cursor: pointer;
  transition: background var(--apcp-transition), width var(--apcp-transition);
}

.apcp-pagination .swiper-pagination-bullet-active {
  background: var(--apcp-text);
  width: 20px;
  border-radius: 4px;
}

/* =============================================
   SLIDE
   ============================================= */
.apcp-slide {
  height: auto;
  display: flex;
}

/* =============================================
   PRODUCT CARD
   ============================================= */
.apcp-card {
  background: var(--apcp-card-bg);
  border-radius: var(--apcp-card-radius);
  box-shadow: var(--apcp-card-shadow);
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  transition: box-shadow var(--apcp-transition), transform var(--apcp-transition);
  position: relative;
  border: 1px solid transparent;
}

.apcp-card:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,0.13);
  transform: translateY(-2px);
  border-color: var(--apcp-border);
}

/* =============================================
   CARD IMAGE AREA
   ============================================= */
.apcp-card__image-wrap {
  position: relative;
  overflow: hidden;
  background: #f8f8f8;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

.apcp-card__img-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.apcp-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  box-sizing: border-box;
  transition: opacity var(--apcp-transition), transform var(--apcp-transition);
}

.apcp-card__img--primary {
  position: absolute;
  inset: 0;
  opacity: 1;
  transform: scale(1);
}

.apcp-card__img--hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
}

/* Hover image swap */
.apcp-card:hover .apcp-card__img--primary {
  opacity: 0;
  transform: scale(0.97);
}

.apcp-card:hover .apcp-card__img--hover {
  opacity: 1;
  transform: scale(1);
}

/* =============================================
   BADGES
   ============================================= */
.apcp-card__badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.apcp-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 3px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}

.apcp-badge--sale {
  background: var(--apcp-accent);
  color: #fff;
}

.apcp-badge--new {
  background: var(--apcp-new-badge);
  color: #fff;
}

/* =============================================
   WISHLIST AREA
   ============================================= */
.apcp-card__wishlist {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

/* =============================================
   CARD INFO
   ============================================= */
.apcp-card__info {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

/* =============================================
   CARD TITLE
   ============================================= */
.apcp-card__title {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--apcp-text);
  margin: 0;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.apcp-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--apcp-transition);
}

.apcp-card__title a:hover {
  color: var(--apcp-accent);
}

/* =============================================
   CARD PRICING
   ============================================= */
.apcp-card__pricing {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 6px;
}

.apcp-card__price {
  line-height: 1;
}

/* Sale price */
.apcp-card__price--sale {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--apcp-accent);
}

.apcp-card__price--sale .woocommerce-Price-amount,
.apcp-card__price--sale bdi {
  color: var(--apcp-accent) !important;
  font-weight: 700;
}

/* Regular (crossed) price */
.apcp-card__price--regular {
  font-size: 0.82rem;
  color: var(--apcp-text-muted);
}

.apcp-card__price--regular .woocommerce-Price-amount,
.apcp-card__price--regular bdi {
  text-decoration: line-through;
  color: var(--apcp-text-muted) !important;
}

/* Normal price (no sale) */
.apcp-card__price--normal {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--apcp-text);
}

/* WooCommerce default price override */
.apcp-card__pricing ins {
  text-decoration: none;
}

.apcp-card__pricing del {
  opacity: 0.7;
}

/* =============================================
   CARD ACTIONS
   ============================================= */
.apcp-card__actions {
  margin-top: 10px;
}

.apcp-btn-cart {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #111;
  color: #fff;
  border: none;
  padding: 10px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--apcp-card-radius);
  transition: background var(--apcp-transition), transform var(--apcp-transition);
  width: 100%;
  justify-content: center;
  font-family: inherit;
  outline-offset: 2px;
}

.apcp-btn-cart:hover {
  background: var(--apcp-accent);
  transform: none;
}

.apcp-btn-cart:focus-visible {
  outline: 2px solid var(--apcp-accent);
}

.apcp-btn-cart:active {
  transform: scale(0.97);
}

.apcp-btn-cart--added {
  background: #3cb878;
}

.apcp-btn-cart__icon {
  width: 15px;
  height: 15px;
  stroke-width: 2;
  flex-shrink: 0;
}

.apcp-btn-cart .apcp-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: apcp-spin 0.7s linear infinite;
}

.apcp-btn-cart.loading .apcp-btn-cart__icon { display: none; }
.apcp-btn-cart.loading .apcp-spinner         { display: block; }

.apcp-btn-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #111;
  border: 1.5px solid #ddd;
  padding: 9px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--apcp-card-radius);
  transition: border-color var(--apcp-transition), color var(--apcp-transition);
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}

.apcp-btn-view:hover {
  border-color: var(--apcp-accent);
  color: var(--apcp-accent);
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes apcp-spin {
  to { transform: rotate(360deg); }
}

@keyframes apcp-fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.apcp-section .swiper-slide-visible .apcp-card {
  animation: apcp-fadeIn 0.4s ease both;
}

/* =============================================
   NO PRODUCTS
   ============================================= */
.apcp-no-products {
  color: var(--apcp-text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}

/* =============================================
   EQUAL HEIGHT
   ============================================= */
.apcp-section[data-equal-height="true"] .apcp-swiper .swiper-wrapper {
  align-items: stretch;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
  .apcp-arrow--prev { left: -36px; }
  .apcp-arrow--next { right: -36px; }
}

@media (max-width: 900px) {
  .apcp-carousel-wrapper {
    padding: 0 50px;
  }

  .apcp-arrow--prev { left: 0; }
  .apcp-arrow--next { right: 0; }

  .apcp-card__title { -webkit-line-clamp: 2; }
}

@media (max-width: 600px) {
  .apcp-carousel-wrapper {
    padding: 0 40px;
  }

  :root {
    --apcp-arrow-size: 36px;
  }

  .apcp-card__info {
    padding: 10px 12px 12px;
  }
}

/* =============================================
   ASTRA THEME COMPAT
   ============================================= */
.ast-container .apcp-section,
.entry-content .apcp-section {
  margin-left: 0;
  margin-right: 0;
  max-width: none;
}
