/* ================================================================
   Ahnira – Best Selling Products Widget  |  ahnira-bsw.css
   Uses theme CSS variables from storefront-child-ahnira/style.css
   ================================================================ */

/* ── Section wrapper ── */
.ahnira-bsw-section {
  padding: 48px 0 56px;
  position: relative;
  background-color: var(--bg-color, #ffffff);
}

/* ── Header ── */
.ahnira-bsw-header {
  text-align: center;
  margin-bottom: 28px;
}
.ahnira-bsw-section-title {
  font-family: var(--font-family, 'Montserrat', sans-serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--secondary-color, #1a1a1a);
  margin: 0 0 8px;
}
.ahnira-bsw-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted, #8c7a7d);
  margin: 0 0 8px;
  font-family: var(--font-family, 'Montserrat', sans-serif);
}
.ahnira-bsw-title-underline {
  display: block;
  width: 48px;
  height: 2px;
  background: var(--gold, #d4af37);
  margin: 0 auto;
  border-radius: 2px;
}

/* ── Category Tabs ── */
.ahnira-bsw-tabs-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  text-align: center;
  margin-bottom: 28px;
}
.ahnira-bsw-tabs-wrap::-webkit-scrollbar { display: none; }

.ahnira-bsw-tabs {
  display: inline-flex;
  gap: 10px;
  padding: 4px 12px;
  white-space: nowrap;
}

.ahnira-bsw-tab {
  display: inline-block;
  padding: 8px 20px;
  border: 1.5px solid var(--border-color, #e5e1eb);
  border-radius: 999px;
  background: transparent;
  color: var(--secondary-color, #1a1a1a);
  font-family: var(--font-family, 'Montserrat', sans-serif);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition, all 0.3s ease);
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.ahnira-bsw-tab:hover {
  border-color: var(--primary-color, #65378b);
  color: var(--primary-color, #65378b);
  background: var(--bg-light, #fbf9fe);
}
.ahnira-bsw-tab.is-active {
  background-color: var(--primary-color, #65378b);
  border-color: var(--primary-color, #65378b);
  color: #fff;
}

/* ── Slider wrapper ── */
.ahnira-bsw-slider-wrap {
  position: relative;
  padding: 0 12px;
}

.ahnira-bsw-swiper {
  overflow: hidden;
  position: relative;
}

/* ── Loader spinner ── */
.ahnira-bsw-loader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.75);
  align-items: center;
  justify-content: center;
}
.ahnira-bsw-loader.is-visible { display: flex; }
.ahnira-bsw-loader span {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color, #e5e1eb);
  border-top-color: var(--primary-color, #65378b);
  border-radius: 50%;
  animation: ahnira-bsw-spin 0.75s linear infinite;
}
@keyframes ahnira-bsw-spin { to { transform: rotate(360deg); } }

/* ── Product card ── */
.ahnira-bsw-slide { height: auto; }

.ahnira-bsw-card {
  position: relative;
  background: var(--bg-color, #ffffff);
  overflow: hidden; 
  transition: var(--transition, all 0.3s ease);
}

/* ── Thumbnail area ── */
.ahnira-bsw-thumbnail {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #f8f8f8;
}

.ahnira-bsw-thumb-link {
  display: block;
  width: 100%;
  height: 100%;
}

.ahnira-bsw-img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.ahnira-bsw-main-img,
.ahnira-bsw-hover-wrap {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
}
.ahnira-bsw-main-img  { opacity: 1; z-index: 1; }
.ahnira-bsw-hover-wrap { opacity: 0; z-index: 2; }
.ahnira-bsw-card:hover .ahnira-bsw-main-img  { opacity: 0; }
.ahnira-bsw-card:hover .ahnira-bsw-hover-wrap { opacity: 1; }

.ahnira-bsw-main-img img,
.ahnira-bsw-hover-wrap img,
.ahnira-bsw-hover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s ease;
}
.ahnira-bsw-card:hover .ahnira-bsw-main-img img {
  transform: scale(1.05);
}

/* ── Badges ── */
.ahnira-bsw-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 6px;
}
.ahnira-bsw-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
}
.ahnira-bsw-badge--sale {
  background-color: var(--primary-color, #65378b);
}

/* ── Out-of-stock overlay ── */
.ahnira-bsw-oos-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 12px;
}
.ahnira-bsw-oos-overlay span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--oos-color, #ff0000);
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  line-height: 1;
}

/* ── Action buttons ── */
.ahnira-bsw-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.ahnira-bsw-card:hover .ahnira-bsw-actions {
  opacity: 1;
  transform: translateX(0);
}

/* Wishlist button */
.ahnira-bsw-wishlist .tinvwl-loop-btn-wrapper,
.ahnira-bsw-wishlist a {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.92) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  cursor: pointer !important;
  text-decoration: none !important;
  color: var(--secondary-color, #1a1a1a) !important;
  font-size: 15px !important;
  transition: var(--transition, all 0.3s ease) !important;
  padding: 0 !important;
}
.ahnira-bsw-wishlist a:hover {
  color: var(--primary-color, #65378b) !important;
  background: var(--bg-light, #fbf9fe) !important;
}

/* Add-to-cart button */
.ahnira-bsw-atc .button,
.ahnira-bsw-atc a.add_to_cart_button {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.92) !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
  cursor: pointer !important;
  color: var(--secondary-color, #1a1a1a) !important;
  font-size: 0 !important;
  padding: 0 !important;
  transition: var(--transition, all 0.3s ease) !important;
}
.ahnira-bsw-atc .button::before,
.ahnira-bsw-atc a.add_to_cart_button::before {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 14px;
  content: '\f290';
}
.ahnira-bsw-atc .button:hover,
.ahnira-bsw-atc a.add_to_cart_button:hover {
  background: var(--primary-color, #65378b) !important;
  color: #fff !important;
}

/* ── Review badge ── */
.ahnira-bsw-review-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 5;
}
.ahnira-bsw-review-inner {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary-color, #1a1a1a);
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  font-family: var(--font-family, 'Montserrat', sans-serif);
}
.ahnira-bsw-review-inner svg {
  width: 11px;
  height: 11px;
  fill: var(--gold, #d4af37);
}

/* ── Product info – mirrors .product-info from content-product.php ── */
.ahnira-bsw-info {
  padding: 5px 0 14px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Price – matches .product-info .price (18px bold, flex row) */
.ahnira-bsw-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--secondary-color, #1a1a1a);
  font-family: var(--font-family, 'Montserrat', sans-serif);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ahnira-bsw-price del {
  color: #999;
  font-size: 14px;
  font-weight: 400;
  margin-right: 4px;
}
.ahnira-bsw-price del .woocommerce-Price-amount {
  color: #999;
  font-size: 14px;
  font-weight: 400;
}
.ahnira-bsw-price ins {
  text-decoration: none;
}

/* Title – matches .product-title (16px, weight 400) */
.ahnira-bsw-title {
  font-family: var(--font-family, 'Montserrat', sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  margin: 0 0 8px;
  color: var(--secondary-color, #1a1a1a);
}
.ahnira-bsw-title a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition, all 0.3s ease);
}
.ahnira-bsw-title a:hover {
  color: var(--primary-color, #65378b);
}

/* Mobile ATC CTA – mirrors .add-to-cart-cta, hidden on desktop */
.ahnira-bsw-atc-cta {
  margin-top: auto;
  padding-top: 10px;
  display: none;
}
.ahnira-bsw-atc-cta .button,
.ahnira-bsw-atc-cta a.add_to_cart_button {
  display: block !important;
  width: 100% !important;
  background-color: var(--primary-color, #65378b) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 10px 5px !important;
  border-radius: 2px !important;
  border: none !important;
  text-align: center !important;
  box-shadow: none !important;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition, all 0.3s ease) !important;
}
.ahnira-bsw-atc-cta .button:hover,
.ahnira-bsw-atc-cta a.add_to_cart_button:hover {
  background: var(--secondary-color, #1a1a1a) !important;
}

/* ── No-products message ── */
.ahnira-bsw-no-products {
  text-align: center;
  padding: 40px;
  color: var(--text-muted, #8c7a7d);
  font-size: 0.9rem;
  font-family: var(--font-family, 'Montserrat', sans-serif);
}

/* ── Swiper pagination ── */
.ahnira-bsw-pagination {
  margin-top: 20px !important;
  position: static !important;
  text-align: center;
}
.ahnira-bsw-pagination .swiper-pagination-bullet {
  background: var(--border-color, #e5e1eb);
  opacity: 1;
  width: 7px;
  height: 7px;
  transition: all 0.25s ease;
}
.ahnira-bsw-pagination .swiper-pagination-bullet-active {
  background: var(--gold, #d4af37);
  width: 20px;
  border-radius: 4px;
}

/* ── Swiper arrows ── */
.ahnira-bsw-prev,
.ahnira-bsw-next {
  color: var(--primary-color, #65378b) !important;
}
.ahnira-bsw-prev::after,
.ahnira-bsw-next::after {
  font-size: 18px !important;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .ahnira-bsw-section { padding: 36px 0 44px; }
}

/* Below desktop: hide icon ATC, show full-width CTA button (mirrors .add-to-cart-cta) */
@media (max-width: 1199px) {
  .ahnira-bsw-atc { display: none !important; }
  .ahnira-bsw-atc-cta { display: block !important; }
}

/* Desktop: keep icon ATC, hide CTA button */
@media (min-width: 1200px) {
  .ahnira-bsw-atc-cta { display: none !important; }
}

@media (max-width: 767px) {
  .ahnira-bsw-section { padding: 28px 0 36px; }
  .ahnira-bsw-slider-wrap { padding: 0 4px; }

  /* Always show wishlist button on mobile (no hover) */
  .ahnira-bsw-actions {
    opacity: 1;
    transform: translateX(0);
  }
  /* Disable hover thumbnail swap on touch devices */
  .ahnira-bsw-card:hover .ahnira-bsw-hover-wrap { opacity: 0; }
  .ahnira-bsw-card:hover .ahnira-bsw-main-img   { opacity: 1; transform: none; }
  .ahnira-bsw-card:hover .ahnira-bsw-main-img img { transform: none; }

  .ahnira-bsw-tab  { padding: 6px 14px; font-size: 0.78rem; }
  .ahnira-bsw-section-title { font-size: 1.3rem; }
  .ahnira-bsw-price { font-size: 16px; }
  .ahnira-bsw-title { font-size: 14px; }
}
