/* Shop feed enhancements: quick categories, API skeletons, and pagination. */

.shop-quick-cats-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: min(var(--main-width), 100%);
    margin: 0 auto;
    /* Logical: top | inline (start+end) | bottom */
    padding-block: 0 var(--spacing-xs);
    padding-inline: var(--spacing-xl);
}

.shop-quick-cats {
    display: flex;
    gap: var(--spacing-sm);
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-padding-inline: var(--spacing-xl);
}

.shop-quick-cats.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

.shop-quick-cats-nav {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: opacity var(--transition-fast),
        transform var(--transition-fast),
        background-color var(--transition-fast);
}

.shop-quick-cats-nav:hover:not(:disabled) {
    background: var(--primary-more-light);
    color: var(--primary-color);
    transform: scale(1.05);
}

.shop-quick-cats-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.shop-quick-cats-nav svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* RTL: mirror the nav arrows so "prev" points right and "next" points left.
   This assumes the template renders a single right-pointing chevron for
   the "next" button and lets CSS flip it in RTL. If your JS already swaps
   the SVG per direction, drop this block. */
[dir="rtl"] .shop-quick-cats-nav svg {
    transform: scaleX(-1);
}

.shop-quick-cats::-webkit-scrollbar {
    display: none;
}

.shop-quick-cat {
    flex: 0 0 auto;
    min-height: 38px;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-align: start;
    transition: background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.shop-quick-cat:hover {
    border-color: var(--primary-light);
    background: var(--primary-more-light);
    color: var(--primary-color);
}

.shop-quick-cat.is-selected {
    border-color: var(--primary-color);
    background: var(--primary-more-light);
    color: var(--primary-color);
}

.shop-quick-cat:focus-visible,
.shop-load-more:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 2px;
}

.shop-feed-footer {
    display: grid;
    justify-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-xl) 0 var(--spacing-2xl);
}

/* ── Load more button (classic outline, static) ── */
.shop-load-more {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 700;
    cursor: pointer;
}

.shop-load-more:disabled {
    cursor: wait;
}

/* Loading: text is hidden (it keeps the button's size), spinner only */
.shop-load-more.is-loading {
    color: transparent;
}

.shop-load-more.is-loading::after {
    position: absolute;
    content: "";
    color: var(--primary-color);
}

/* ── Spinner (shared) ──
   `border-inline-end-color` is already direction-aware, so the gap in
   the ring flips automatically in RTL. No extra rule needed. */
.shop-load-more.is-loading::after,
.shop-feed-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-inline-end-color: transparent;
    border-radius: var(--radius-full);
    animation: shop-feed-spin 0.7s linear infinite;
}

.shop-feed-spinner {
    display: inline-block;
    color: var(--primary-color);
}

/* ── Feed states ── */
.shop-feed-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shop-end-message {
    margin: 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    text-align: center;
}

.shop-load-more[hidden],
.shop-feed-loading[hidden],
.shop-end-message[hidden] {
    display: none;
}

@keyframes shop-feed-spin {
    to {
        transform: rotate(1turn);
    }
}

@media (max-width: 700px) {
    .shop-quick-cats-wrap {
        margin-top: var(--spacing-md);
        padding-inline: var(--spacing-md);
    }

    .shop-quick-cats-nav {
        display: none;
    }

    .shop-quick-cat {
        min-height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #products-container .product-skeleton .sk {
        animation: none;
    }

    .shop-load-more.is-loading::after,
    .shop-feed-spinner {
        animation: none;
    }

    .shop-quick-cat,
    .shop-load-more {
        transition: none;
    }
}
/* =============================================================
   store.css — desktop filter sidebar collapse / expand
   Paste at the very END of store.css.
   Works for both dir="ltr" and dir="rtl".
   Replaces the old "Desktop-only: sidebar collapse" block and
   rule 2 of store-ltr.css (you can delete those).
   ============================================================= */

@media (min-width: 769px) {

  .product-container {
    /* sidebar width lives in ONE variable, used by column + content */
    --filter-w: 272px;
    --filter-slide: -18px;                       /* LTR: slides to the left  */
    --filter-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    grid-template-columns: var(--filter-w) minmax(0, 1fr);
    transition:
      grid-template-columns 0.36s var(--filter-ease),
      gap 0.36s var(--filter-ease);
  }

  [dir="rtl"] .product-container {
    --filter-slide: 18px;                        /* RTL: slides to the right */
  }

  .product-container.filters-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
    gap: 0;
  }

  /* ---- Keep the content at full width while the column shrinks ----
     The sidebar box clips it (overflow-x hidden), so nothing re-wraps
     or gets squeezed during the animation. */
  #filter-section-main {
    overflow-x: hidden;
  }

  #filter-section-main > * {
    min-width: var(--filter-w);
  }

  /* ---- Expanded (opening): width opens first, content fades in slightly later ---- */
  .product-container:not(.filters-collapsed) #filter-section-main {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition:
      opacity 0.24s ease 0.08s,
      transform 0.36s var(--filter-ease),
      visibility 0s linear 0s;
  }

  /* ---- Collapsed (closing): content fades out fast, column closes behind it ---- */
  .product-container.filters-collapsed #filter-section-main {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(var(--filter-slide));
    transition:
      opacity 0.16s ease,
      transform 0.36s var(--filter-ease),
      visibility 0s linear 0.36s;              /* hide only after the animation */
  }

  /* ---- Toggle button shows its state ---- */
  .toggle-filters-desktop svg {
    transition: transform 0.3s var(--filter-ease);
  }

  .product-container.filters-collapsed .toggle-filters-desktop {
    background: var(--primary-more-light);
    border-color: var(--primary-light);
    color: var(--primary-color);
  }
}

/* tablet: narrower sidebar */
@media (min-width: 769px) and (max-width: 900px) {
  .product-container {
    --filter-w: 230px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-container,
  #filter-section-main {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}