/* ============================================
   TABBED CATEGORY PRODUCTS
   ============================================ */

/* ---------- Section Header Ovveride ---------- */
.tabbed-products-section .section-header {
  margin-bottom: var(--spacing-lg);
}

/* ---------- Tab Navigation Wrapper ---------- */
/* ---------- Tab Navigation Wrapper ---------- */
.tabbed-products-nav-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: var(--spacing-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  position: relative;
  padding: 12px 0;
  margin-left: calc(-1 * var(--container-padding));
  margin-right: calc(-1 * var(--container-padding));
}

.tabbed-products-nav-wrapper::-webkit-scrollbar {
  display: none;
}

/* ---------- Tab Navigation ---------- */
.tabbed-products-nav {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  position: relative;
  flex-shrink: 0;
}

/* ---------- Individual Tab ---------- */
.tabbed-products-tab {
  position: relative;
  padding: 0.7rem 1.75rem;
  font-family: var(--font-primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  outline: none;
  z-index: 1;
}

.tabbed-products-tab:hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

.tabbed-products-tab.is-active {
  color: var(--color-white);
  background-color: var(--color-black);
  box-shadow: var(--shadow-sm);
}

.tabbed-products-tab:active {
  transform: scale(0.98);
}

/* ---------- Tab Panels Container ---------- */
.tabbed-products-panels {
  position: relative;
  min-height: 400px; /* Prevent layout jump */
}

/* ---------- Individual Panel — Crossfade with overlap ---------- */
.tabbed-products-panel {
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.tabbed-products-panel[hidden] {
  display: none !important;
}

.tabbed-products-panel.is-entering {
  display: block !important;
  opacity: 0;
}

.tabbed-products-panel.is-active {
  display: block !important;
  opacity: 1;
  pointer-events: auto;
}

.tabbed-products-panel.is-leaving {
  display: block !important;
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Staggered Product Card Animations ---------- */
.tabbed-products-panel .product-card {
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity;
}

.tabbed-products-panel.is-active .product-card {
  opacity: 1;
}

/* Silky staggered opacity for a premium smooth flow */
.tabbed-products-panel.is-active .product-card:nth-child(1) { transition-delay: 0.04s; }
.tabbed-products-panel.is-active .product-card:nth-child(2) { transition-delay: 0.08s; }
.tabbed-products-panel.is-active .product-card:nth-child(3) { transition-delay: 0.12s; }
.tabbed-products-panel.is-active .product-card:nth-child(4) { transition-delay: 0.16s; }
.tabbed-products-panel.is-active .product-card:nth-child(5) { transition-delay: 0.2s; }
.tabbed-products-panel.is-active .product-card:nth-child(6) { transition-delay: 0.24s; }
.tabbed-products-panel.is-active .product-card:nth-child(7) { transition-delay: 0.28s; }
.tabbed-products-panel.is-active .product-card:nth-child(8) { transition-delay: 0.32s; }
.tabbed-products-panel.is-active .product-card:nth-child(9) { transition-delay: 0.36s; }
.tabbed-products-panel.is-active .product-card:nth-child(10) { transition-delay: 0.4s; }
.tabbed-products-panel.is-active .product-card:nth-child(11) { transition-delay: 0.44s; }
.tabbed-products-panel.is-active .product-card:nth-child(12) { transition-delay: 0.48s; }

/* ---------- View All Button animation ---------- */
.tabbed-products-panel .view-all-wrapper {
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

.tabbed-products-panel.is-active .view-all-wrapper {
  opacity: 1;
}

/* ---------- Category First Card ---------- */
.category-first-card {
  aspect-ratio: 2/3;
  position: relative;
  display: flex;
  align-items: flex-end;
  background-color: #1a1a1a;
  background-size: cover;
  background-position: center;
  color: #fff;
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease;
}

.category-first-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.15) 50%,
    rgba(0, 0, 0, 0.02) 100%
  );
  z-index: 1;
  transition: background 0.4s ease;
}

.category-first-card:hover .category-card-overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0.2) 50%,
    rgba(0, 0, 0, 0.05) 100%
  );
}

.category-card-link {
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  position: relative;
  z-index: 2;
  gap: 0.5rem;
}

.category-card-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category-card-title {
  font-size: 1.35rem;
  font-weight: var(--fw-bold, 700);
  margin: 0;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.category-card-description {
  font-size: var(--fs-xs, 0.8rem);
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card-cta {
  font-size: var(--fs-xs, 0.8rem);
  font-weight: var(--fw-semibold, 600);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  transition:
    transform 0.3s ease,
    color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.category-first-card:hover .category-card-cta {
  color: #fff;
  transform: translateX(4px);
}

[dir="rtl"] .category-first-card:hover .category-card-cta {
  transform: translateX(-4px);
  transform: translateX(-4px);
}

/* ---------- Responsive Grid ---------- */
.responsive-product-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols-desktop, 4), 1fr);
  gap: var(--spacing-md, 1rem);
  width: 100%;
}

@media (max-width: 1024px) {
  .responsive-product-grid {
    grid-template-columns: repeat(var(--grid-cols-tablet, 3), 1fr);
  }
}

@media (max-width: 768px) {
  .responsive-product-grid {
    grid-template-columns: repeat(var(--grid-cols-mobile, 2), 1fr);
  }
}

/* ---------- View All Button ---------- */

.view-all-wrapper {
  display: flex;
  justify-content: center;
  margin-top: var(--spacing-xl, 2rem);
  width: 100%;
}

.view-all-btn {
  cursor: pointer;
}


/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 1024px) {
  .tabbed-products-nav {
    gap: 4px;
    padding: 5px;
  }

  .tabbed-products-tab {
    padding: 0.6rem 1.4rem;
    font-size: var(--fs-xs);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .tabbed-products-nav-wrapper {
    justify-content: flex-start;
    margin-bottom: var(--spacing-xl);
    padding: 10px 8%;
    /* Default: Both edges faded */
    -webkit-mask-image: linear-gradient(
      to right,
      transparent,
      black 15%,
      black 85%,
      transparent
    );
    mask-image: linear-gradient(
      to right,
      transparent,
      black 15%,
      black 85%,
      transparent
    );
    transition: mask-image 0.3s ease, -webkit-mask-image 0.3s ease;
  }

  /* At Start: Hide Left Fade (LTR) */
  .tabbed-products-nav-wrapper.is-at-start {
    -webkit-mask-image: linear-gradient(
      to right,
      black,
      black 85%,
      transparent
    );
    mask-image: linear-gradient(
      to right,
      black,
      black 85%,
      transparent
    );
  }

  /* At End: Hide Right Fade (LTR) */
  .tabbed-products-nav-wrapper.is-at-end {
    -webkit-mask-image: linear-gradient(
      to right,
      transparent,
      black 15%,
      black
    );
    mask-image: linear-gradient(
      to right,
      transparent,
      black 15%,
      black
    );
  }

  /* Both: No Fade */
  .tabbed-products-nav-wrapper.is-at-start.is-at-end {
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* RTL Variant */
  [dir="rtl"] .tabbed-products-nav-wrapper {
    -webkit-mask-image: linear-gradient(
      to left,
      transparent,
      black 15%,
      black 85%,
      transparent
    );
    mask-image: linear-gradient(
      to left,
      transparent,
      black 15%,
      black 85%,
      transparent
    );
  }

  [dir="rtl"] .tabbed-products-nav-wrapper.is-at-start {
    -webkit-mask-image: linear-gradient(
      to left,
      black,
      black 85%,
      transparent
    );
    mask-image: linear-gradient(
      to left,
      black,
      black 85%,
      transparent
    );
  }

  [dir="rtl"] .tabbed-products-nav-wrapper.is-at-end {
    -webkit-mask-image: linear-gradient(
      to left,
      transparent,
      black 15%,
      black
    );
    mask-image: linear-gradient(
      to left,
      transparent,
      black 15%,
      black
    );
  }

  [dir="rtl"] .tabbed-products-nav-wrapper.is-at-start.is-at-end {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .tabbed-products-nav {
    padding: 4px;
    gap: 4px;
  }

  .tabbed-products-tab {
    padding: 0.6rem 1.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
  }

  .tabbed-products-tab.is-active {
    box-shadow: var(--shadow-md);
  }
}
