/* ============================================
   BuyBuyKart — Categories Page Styles
   Only for: categories.php
   ============================================ */

/* ---------- Category Hero Banner ---------- */
.cat-hero {
  background: linear-gradient(135deg, var(--ink) 0%, #2A2D4A 50%, #3B2D4A 100%);
  color: var(--paper);
  padding: 56px 0 48px;
  position: relative;
  overflow: hidden;
}

.cat-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 99, 85, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.cat-hero::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -5%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 178, 56, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: rgba(255, 255, 255, 0.6);
  transition: color var(--transition);
}

.breadcrumbs a:hover {
  color: var(--coral);
}

.breadcrumbs .sep {
  font-size: 10px;
  opacity: 0.5;
}

.breadcrumbs .current {
  color: #fff;
  font-weight: 600;
}

.cat-hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 12px;
  position: relative;
}

.cat-hero h1 em {
  font-style: normal;
  color: var(--coral);
}

.cat-hero .hero-desc {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  max-width: 550px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.cat-hero .hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
}

.hero-stat .stat-val {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: var(--coral);
}

.hero-stat .stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ---------- Hero Grid ---------- */
.cat-hero .wrap.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  position: relative;
  z-index: 2;
}

/* ---------- Fan Cards Hero Visual ---------- */
.hero-fan-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 340px;
  position: relative;
}

.fan-stack {
  position: relative;
  width: 200px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fan-card {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.25);
  overflow: hidden;
  border: 4px solid #fff;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
  cursor: pointer;
}

.fan-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fan positioning */
.fan-card:nth-child(1) {
  transform: translateX(-70px) translateY(10px) rotate(-12deg) scale(0.85);
  z-index: 1;
}

.fan-card:nth-child(2) {
  transform: translateX(0) translateY(-10px) scale(1.05);
  z-index: 3;
  box-shadow: 0 25px 45px rgba(0,0,0,0.4);
}

.fan-card:nth-child(3) {
  transform: translateX(70px) translateY(10px) rotate(12deg) scale(0.85);
  z-index: 2;
}

/* Hover effect */
.fan-stack:hover .fan-card:nth-child(1) {
  transform: translateX(-100px) translateY(5px) rotate(-18deg) scale(0.9);
}
.fan-stack:hover .fan-card:nth-child(2) {
  transform: translateX(0) translateY(-20px) scale(1.1);
}
.fan-stack:hover .fan-card:nth-child(3) {
  transform: translateX(100px) translateY(5px) rotate(18deg) scale(0.9);
}

@media (max-width: 960px) {
  .cat-hero .wrap.hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-stats {
    justify-content: center;
  }
  .hero-fan-visual {
    height: 260px;
    margin-top: 10px;
  }
  .fan-stack {
    width: 160px;
    height: 220px;
  }
  .fan-card:nth-child(1) { transform: translateX(-50px) translateY(10px) rotate(-12deg) scale(0.85); }
  .fan-card:nth-child(2) { transform: translateX(0) translateY(-10px) scale(1.05); }
  .fan-card:nth-child(3) { transform: translateX(50px) translateY(10px) rotate(12deg) scale(0.85); }
}


.subcat-bar {
  background: #fff;
  border-bottom: 1px solid var(--stitch);
  padding: 10px 0;
  position: relative;
  z-index: 10;
}

.subcat-bar:has(#subcatScroll:empty),
#subcatScroll:empty {
  display: none !important;
}

.subcat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.subcat-scroll::-webkit-scrollbar {
  display: none;
}

.subcat-pill {
  flex-shrink: 0;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--stitch);
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-70);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.subcat-pill:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.subcat-pill.active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.subcat-pill .pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
  font-size: 11px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  margin-left: 6px;
  padding: 0 6px;
}

.subcat-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.3);
}

.subcat-pill:not(.active) .pill-count {
  background: var(--paper-soft);
}

/* ---------- Shop Layout ---------- */
.shop-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 32px;
  padding: 32px 0 64px;
}

@media (max-width: 960px) {
  .shop-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Sidebar Filters ---------- */
.sidebar {
  position: sticky;
  top: 160px;
  align-self: start;
}

.sidebar-close {
  display: none;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 20px;
  background: var(--paper-soft);
  border: none;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  cursor: pointer;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 10001;
    overflow-y: auto;
    padding: 0 0 24px 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 20px rgba(0,0,0,0.1);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .filter-section {
    padding: 0 20px;
  }
  
  .sidebar-close {
    display: flex;
  }
  
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  
  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: all;
  }
}

.filter-section {
  margin-bottom: 28px;
}

.filter-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-section h4 .toggle-icon {
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-40);
  transition: transform var(--transition), color var(--transition);
  background: none;
  border: none;
  font-family: inherit;
}

.filter-section h4 .toggle-icon:hover {
  color: var(--ink);
}

.filter-section h4 .toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.filter-body {
  transition: max-height .3s ease, opacity .3s ease;
  overflow: hidden;
}

.filter-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
}

/* ---------- Filter Checkboxes ---------- */
.filter-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-70);
  transition: color var(--transition);
}

.filter-check:hover {
  color: var(--ink);
}

.filter-check input[type="checkbox"] {
  display: none;
}

.check-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--stitch);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.filter-check input:checked+.check-box {
  background: var(--coral);
  border-color: var(--coral);
}

.filter-check input:checked+.check-box::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.filter-check .check-label {
  flex: 1;
}

.filter-check .check-count {
  font-size: 12px;
  color: var(--ink-40);
  font-family: 'Space Mono', monospace;
}

/* ---------- Color Swatches ---------- */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 22, 46, 0.15);
}

.color-swatch.active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- Price Range Slider ---------- */
.price-range-container {
  padding: 8px 0;
}

.price-display {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--ink);
}

.range-slider {
  position: relative;
  height: 6px;
  background: var(--paper-soft);
  border-radius: 3px;
}

.range-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  position: absolute;
  top: 0;
  pointer-events: none;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--coral);
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.range-track {
  position: absolute;
  height: 6px;
  background: var(--coral);
  border-radius: 3px;
  top: 0;
}

/* ---------- Sidebar Reset ---------- */
.filter-reset {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--paper-soft);
  border: 1.5px solid var(--stitch);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-70);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-reset:hover {
  background: var(--coral-light);
  border-color: var(--coral);
  color: var(--coral);
}

/* ---------- Mobile Filter Toggle ---------- */
.mobile-filter-btn {
  display: none;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1.5px solid var(--stitch);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  font-family: inherit;
}

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100vh;
    background: #fff;
    z-index: 999;
    padding: 24px;
    overflow-y: auto;
    transition: left .3s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
  }

  .sidebar-overlay.show {
    display: block;
  }

  .mobile-filter-btn {
    display: flex;
  }

  .sidebar-close {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 700;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
  }
}

@media (min-width: 961px) {
  .sidebar-close {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* ---------- Products Area ---------- */
.products-area {
  min-height: 400px;
}

.products-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.results-count {
  font-size: 14px;
  color: var(--ink-70);
}

.results-count strong {
  color: var(--ink);
}

.sort-select {
  padding: 10px 36px 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stitch);
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A4C63' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ---------- Products Grid ---------- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* ---------- Product Card ---------- */
.product-card {
  background: #fff;
  border: 1.5px solid var(--stitch);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.product-card .card-thumb {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}

.product-card .card-thumb svg {
  width: 80px;
  height: 80px;
  transition: transform .4s ease;
}

.product-card:hover .card-thumb svg {
  transform: scale(1.1) rotate(-3deg);
}

.product-card .card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--coral);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.product-card .card-badge.new {
  background: var(--teal);
}

.product-card .card-wishlist {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  opacity: 0;
  transform: translateY(-4px);
}

.product-card:hover .card-wishlist {
  opacity: 1;
  transform: translateY(0);
}

.card-wishlist:hover {
  background: var(--coral);
  color: #fff;
}

.card-wishlist.liked {
  opacity: 1;
  background: var(--coral);
  color: #fff;
}

.product-card .card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card .card-cat {
  font-size: 11px;
  font-weight: 600;
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.product-card .card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .card-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.card-stars {
  display: flex;
  gap: 2px;
  color: var(--marigold);
  font-size: 13px;
}

.card-rating-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-70);
}

.product-card .card-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.card-price {
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
}

.card-price-old {
  font-size: 13px;
  color: var(--ink-40);
  text-decoration: line-through;
}

.card-discount {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  background: #E6F7F5;
  padding: 2px 8px;
  border-radius: 999px;
}

.product-card .card-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
}

.product-card .card-btn:hover {
  background: var(--coral);
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}

.empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 22px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--ink-70);
  font-size: 15px;
  margin-bottom: 20px;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 0 20px;
}

.page-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--stitch);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.page-btn:hover {
  border-color: var(--coral);
  color: var(--coral);
}

.page-btn.active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card.animate-in {
  animation: fadeInUp .4s ease forwards;
}

/* ---------- Shimmer Loading ---------- */
.shimmer-card {
  background: #fff;
  border: 1.5px solid var(--stitch);
  border-radius: var(--radius);
  overflow: hidden;
}

.shimmer {
  background: linear-gradient(90deg, var(--paper-soft) 25%, #e8e4db 50%, var(--paper-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.shimmer-thumb {
  height: 220px;
}

.shimmer-body {
  padding: 16px;
}

.shimmer-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 10px;
}

.shimmer-line.w60 {
  width: 60%;
}

.shimmer-line.w80 {
  width: 80%;
}

.shimmer-line.w40 {
  width: 40%;
}

.shimmer-btn {
  height: 42px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* ---------- Active Filters Bar ---------- */
.active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.active-filters:empty {
  display: none;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--coral-light);
  color: var(--coral-dark);
  font-size: 12.5px;
  font-weight: 600;
}

.filter-tag .remove-tag {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.7;
  transition: opacity var(--transition);
  background: none;
  border: none;
  color: var(--coral-dark);
  font-family: inherit;
}

.filter-tag .remove-tag:hover {
  opacity: 1;
}

.clear-all-filters {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-40);
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  font-family: inherit;
  transition: color var(--transition);
}

.clear-all-filters:hover {
  color: var(--coral);
}