/**
 * Nekavo Category Enhancer - Frontend Stylesheet
 *
 * Provides responsive styling for horizontal quick-pills navigation carousel,
 * faceted filter sidebar & widgets, collector rarity badges, zero-CLS shimmer skeleton
 * loaders, and WoodMart theme harmony.
 *
 * @package Nekavo\Enhancer\Assets
 */

:root {
  --nekavo-primary: var(--wd-primary-color, var(--primary-color, #83b735));
  --nekavo-primary-hover: #72a32d;
  --nekavo-text: var(--wd-text-color, #333333);
  --nekavo-text-muted: #6b7280;
  --nekavo-bg: var(--wd-main-bgcolor, #ffffff);
  --nekavo-surface: #f9fafb;
  --nekavo-border: var(--wd-border-color, #e5e7eb);
  --nekavo-radius: var(--wd-border-radius, 6px);
  --nekavo-pill-bg: #f3f4f6;
  --nekavo-pill-text: #374151;
  --nekavo-pill-active-bg: var(--nekavo-primary);
  --nekavo-pill-active-text: #ffffff;
  --nekavo-badge-box-bg: #1f2937;
  --nekavo-badge-box-text: #ffffff;
  --nekavo-badge-chase: #f59e0b;
  --nekavo-badge-gitd: #10b981;
  --nekavo-badge-exclusive: #8b5cf6;
  --nekavo-badge-flocked: #ec4899;
  --nekavo-badge-metallic: #6366f1;
  --nekavo-badge-diamond: #06b6d4;
  --nekavo-badge-special: #3b82f6;
}

/* ==========================================================================
   1. Quick-Pills Navigation Carousel Bar
   ========================================================================== */

.nekavo-quick-pills-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
  box-sizing: border-box;
}

.nekavo-quick-pills-track {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  scroll-behavior: smooth;
  cursor: grab;
  user-select: none;
  width: 100%;
  padding: 0.25rem 0;
}

.nekavo-quick-pills-track::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Blink */
}

.nekavo-quick-pills-track.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.nekavo-quick-pills-list {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.nekavo-pill-item {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.nekavo-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--nekavo-pill-text);
  background-color: var(--nekavo-pill-bg);
  border: 1px solid var(--nekavo-border);
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.nekavo-pill-link:hover {
  background-color: #e5e7eb;
  color: var(--nekavo-text);
  border-color: #d1d5db;
  transform: translateY(-1px);
}

.nekavo-pill-item.is-active .nekavo-pill-link,
.nekavo-pill-item.active .nekavo-pill-link {
  background-color: var(--nekavo-pill-active-bg);
  color: var(--nekavo-pill-active-text);
  border-color: var(--nekavo-pill-active-bg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nekavo-pill-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.nekavo-pill-count {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 600;
}

.nekavo-pills-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 32px;
  height: 32px;
  background: var(--nekavo-bg);
  border: 1px solid var(--nekavo-border);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  color: var(--nekavo-text);
  transition: background 0.2s ease;
}

.nekavo-pills-nav:hover {
  background: var(--nekavo-surface);
}

.nekavo-pills-prev {
  left: 0;
}

.nekavo-pills-next {
  right: 0;
}

/* ==========================================================================
   2. Faceted Filter Sidebar Panel & Controls
   ========================================================================== */

.nekavo-filter-sidebar {
  background: var(--nekavo-bg);
  border: 1px solid var(--nekavo-border);
  border-radius: var(--nekavo-radius);
  padding: 1.25rem;
  margin-bottom: 2rem;
  box-sizing: border-box;
}

.nekavo-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--nekavo-border);
}

.nekavo-filter-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--nekavo-text);
}

.nekavo-reset-filters-btn {
  background: none;
  border: none;
  color: var(--nekavo-text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.nekavo-reset-filters-btn:hover {
  color: #ef4444;
}

/* Active Chips */
.nekavo-active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--nekavo-border);
}

.nekavo-active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid #bae6fd;
}

.nekavo-chip-remove {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-left: 0.25rem;
  opacity: 0.7;
}

.nekavo-chip-remove:hover {
  opacity: 1;
}

/* Facet Sections */
.nekavo-facet-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--nekavo-border);
}

.nekavo-facet-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.nekavo-facet-heading {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: var(--nekavo-text);
}

.nekavo-facet-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nekavo-scrollable-options {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.nekavo-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--nekavo-text);
  user-select: none;
}

.nekavo-filter-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--nekavo-primary);
}

.nekavo-facet-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--nekavo-text-muted);
}

/* Box Range Inputs */
.nekavo-box-range-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nekavo-box-range-inputs .nekavo-input-group {
  flex: 1;
}

.nekavo-box-range-inputs input[type="number"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-size: 0.875rem;
  border: 1px solid var(--nekavo-border);
  border-radius: var(--nekavo-radius);
  box-sizing: border-box;
}

.nekavo-range-divider {
  color: var(--nekavo-text-muted);
  font-weight: 600;
}

/* In-Stock iOS Switch */
.nekavo-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.nekavo-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.nekavo-slider {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  background-color: #d1d5db;
  border-radius: 9999px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nekavo-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.nekavo-switch input:checked + .nekavo-slider {
  background-color: var(--nekavo-primary);
}

.nekavo-switch input:checked + .nekavo-slider:before {
  transform: translateX(20px);
}

/* ==========================================================================
   3. Collector Badges in Product Cards
   ========================================================================== */

.nekavo-product-thumb-wrap {
  position: relative;
  overflow: hidden;
}

.nekavo-badge-box {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  background-color: var(--nekavo-badge-box-bg);
  color: var(--nekavo-badge-box-text);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.nekavo-badge-rarity {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.nekavo-badge-rarity.chase {
  background-color: var(--nekavo-badge-chase);
}

.nekavo-badge-rarity.glow-in-the-dark,
.nekavo-badge-rarity.gitd {
  background-color: var(--nekavo-badge-gitd);
}

.nekavo-badge-rarity.target-exclusive,
.nekavo-badge-rarity.walmart-exclusive,
.nekavo-badge-rarity.sdcc-exclusive,
.nekavo-badge-rarity.exclusive {
  background-color: var(--nekavo-badge-exclusive);
}

.nekavo-badge-rarity.flocked {
  background-color: var(--nekavo-badge-flocked);
}

.nekavo-badge-rarity.metallic {
  background-color: var(--nekavo-badge-metallic);
}

.nekavo-badge-rarity.diamond-collection {
  background-color: var(--nekavo-badge-diamond);
}

.nekavo-badge-rarity.special-edition {
  background-color: var(--nekavo-badge-special);
}

/* ==========================================================================
   4. Shimmer Skeleton Placeholder Grid (Zero CLS)
   ========================================================================== */

.nekavo-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  list-style: none;
  margin: 0 0 2rem 0;
  padding: 0;
}

@media (max-width: 991px) {
  .nekavo-skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .nekavo-skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

.nekavo-skeleton-card {
  background: var(--nekavo-bg);
  border: 1px solid var(--nekavo-border);
  border-radius: var(--nekavo-radius);
  overflow: hidden;
  padding: 0.75rem;
}

.nekavo-skeleton-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  overflow: hidden;
}

.nekavo-skeleton-shimmer {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e0e0e0 50%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: nekavo-shimmer 1.5s infinite linear;
}

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

.nekavo-skeleton-img {
  width: 100%;
  height: 100%;
}

.nekavo-skeleton-badge-box {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 36px;
  height: 18px;
  border-radius: 3px;
}

.nekavo-skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nekavo-skeleton-category {
  width: 40%;
  height: 12px;
  border-radius: 3px;
}

.nekavo-skeleton-title {
  width: 90%;
  height: 14px;
  border-radius: 3px;
}

.nekavo-skeleton-title-short {
  width: 60%;
  height: 14px;
  border-radius: 3px;
}

.nekavo-skeleton-price {
  width: 30%;
  height: 16px;
  margin-top: 0.25rem;
  border-radius: 3px;
}

/* ==========================================================================
   5. No Products Found Empty State
   ========================================================================== */

.nekavo-no-products-found {
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--nekavo-surface);
  border: 1px dashed var(--nekavo-border);
  border-radius: var(--nekavo-radius);
  margin-bottom: 2rem;
}

.nekavo-no-products-message {
  font-size: 1rem;
  color: var(--nekavo-text-muted);
  margin: 0 0 1rem 0;
}

.nekavo-clear-all-filters-btn,
.nekavo-clear-all-filters {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  background-color: var(--nekavo-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--nekavo-radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.nekavo-clear-all-filters-btn:hover,
.nekavo-clear-all-filters:hover {
  background-color: var(--nekavo-primary-hover);
}
