/* =============================================================================
   WooCommerce Subcategory Grid — Carousel with gradient-edge navigation
   Shortcode: [wc_subcategories]
   ============================================================================= */

/* ── Outer wrapper (full-bleed background) ───────────────────────────────── */

.wc-subcategory-grid-wrapper {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 36px 0 32px;
}

.wc-subcategory-grid-wrapper__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

/* ── Section title ───────────────────────────────────────────────────────── */

.wc-subcategory-grid__title {
    font-size: 1.35rem !important;
    font-weight: 700;
    margin: 0 0 18px 4px !important;
    color: #1a1a1a;
}

/* ── Carousel shell ──────────────────────────────────────────────────────── */

.wc-subcategory-carousel {
    position: relative;
}

/* Gradient fade hints — show there is more content left/right */
.wc-subcategory-carousel::before,
.wc-subcategory-carousel::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 28px;          /* stop above the progress bar */
    width: 64px;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.wc-subcategory-carousel::before {
    left: 0;
    background: linear-gradient(to right, var(--scg-bg, #f5f5f5) 20%, transparent);
}

.wc-subcategory-carousel::after {
    right: 0;
    background: linear-gradient(to left, var(--scg-bg, #f5f5f5) 20%, transparent);
}

/* Hide the corresponding fade when at the scroll boundary */
.wc-subcategory-carousel.is-at-start::before { opacity: 0; }
.wc-subcategory-carousel.is-at-end::after    { opacity: 0; }

/* ── Scrollable row ──────────────────────────────────────────────────────── */

.wc-subcategory-grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 6px 4px 8px;
    cursor: grab;
}

.wc-subcategory-grid:active {
    cursor: grabbing;
}

.wc-subcategory-grid::-webkit-scrollbar {
    display: none;
}

/* ── Nav buttons — live in the gradient zone, clearly separate from cards ── */

.wc-subcategory-nav {
    position: absolute;
    top: 50%;
    transform: translateY(calc(-50% - 14px)); /* offset above progress bar */
    width: 36px;
    height: 36px;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.12);
    transition: background 0.2s, box-shadow 0.2s, border-color 0.2s, opacity 0.25s;
}

.wc-subcategory-nav:hover {
    background: #5a189a;
    border-color: #5a189a;
    box-shadow: 0 4px 16px rgba(90,25,154,0.25);
}

.wc-subcategory-nav:hover svg {
    fill: #fff;
}

.wc-subcategory-nav--prev { left: 12px; }
.wc-subcategory-nav--next { right: 12px; }

.wc-subcategory-nav svg {
    width: 18px;
    height: 18px;
    fill: #444;
    transition: fill 0.2s;
}

.wc-subcategory-nav--hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── Scroll progress indicator ───────────────────────────────────────────── */

.wc-subcategory-progress {
    height: 3px;
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    margin-top: 10px;
    overflow: hidden;
}

.wc-subcategory-progress__thumb {
    height: 100%;
    background: #5a189a;
    border-radius: 99px;
    transition: width 0.15s ease, transform 0.15s ease;
    min-width: 32px;
}

/* ── Category card ───────────────────────────────────────────────────────── */

.wc-subcategory-grid__item {
    flex: 0 0 auto;
    width: 190px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid #ebebeb;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    text-decoration: none;
    display: block;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    user-select: none;          /* prevent text selection while dragging */
}

.wc-subcategory-grid__item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border-color: #5a189a;
}

/* ── Image area ──────────────────────────────────────────────────────────── */

.wc-subcategory-grid__image-wrapper {
    width: 100%;
    height: 150px;
    background: #fff;
    overflow: hidden;
    position: relative;
}

.wc-subcategory-grid__image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* fill the space — no more tiny padded icons */
    display: block;
    transition: transform 0.35s ease;
}

.wc-subcategory-grid__item:hover .wc-subcategory-grid__image-wrapper img {
    transform: scale(1.07);
}

.wc-subcategory-grid__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ede7f6 0%, #d1c4e9 100%);
}

/* ── Text area ───────────────────────────────────────────────────────────── */

.wc-subcategory-grid__content {
    padding: 11px 12px 12px;
}

.wc-subcategory-grid__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.wc-subcategory-grid__item:hover .wc-subcategory-grid__name {
    color: #5a189a;
}

.wc-subcategory-grid__count {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #888;
    margin: 0;
    letter-spacing: 0.01em;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .wc-subcategory-grid__item { width: 165px; }
    .wc-subcategory-grid__image-wrapper { height: 130px; }
}

@media (max-width: 600px) {
    .wc-subcategory-grid-wrapper__inner { padding: 0 16px; }
    .wc-subcategory-grid__item { width: 140px; }
    .wc-subcategory-grid__image-wrapper { height: 110px; }
    .wc-subcategory-grid__title { font-size: 1.1rem !important; }

    /* Hide nav arrows on touch — users swipe natively */
    .wc-subcategory-nav { display: none; }
    .wc-subcategory-carousel::before,
    .wc-subcategory-carousel::after { width: 32px; }
}
