/**
 * Shop Archive Redesign
 *
 * Loaded AFTER style.css on shop / product-category / product-tag archives so
 * it wins the cascade. Uses existing design tokens only — no new colours/fonts.
 * Calm, category-first tone that echoes the homepage `.kr-home-workshop` cards.
 *
 * Sections:
 *   1. Category chips
 *   2. Trust strip
 *   3. Product card (stock, cart, second-image hover)
 *   4. Sidebar cleanup + tags show-more
 *   5. Mobile sticky filter bar + drawer apply bar
 *   6. Load more
 *
 * @package KauplusRattapood
 */

/* =========================================================================
   1. Category chips
   ========================================================================= */
/* One wrapping row on desktop, horizontally scrollable strip on mobile. */
.kr-shop-chips {
    margin: 0 0 14px;
}

.kr-shop-chips__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kr-shop-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: 999px;
    font-size: 0.78rem;
    line-height: 1.5;
    font-weight: var(--font-weight-medium);
    color: var(--color-black);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.kr-shop-chip:hover {
    border-color: var(--color-primary-light);
    background: var(--color-gray-50);
}

.kr-shop-chip__count {
    font-size: 0.68rem;
    color: var(--color-gray-500);
}

@media (max-width: 968px) {
    .kr-shop-chips__list {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .kr-shop-chips__list::-webkit-scrollbar {
        display: none;
    }
}

/* =========================================================================
   2. Trust strip
   ========================================================================= */
.kr-shop-trust {
    margin: 32px 0 8px;
    padding: 22px;
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--border-radius-lg);
}

.kr-shop-trust__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.kr-shop-trust__item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--color-gray-700);
    line-height: 1.35;
}

.kr-shop-trust__icon {
    flex-shrink: 0;
    color: var(--color-primary);
    display: inline-flex;
}

@media (min-width: 900px) {
    .kr-shop-trust__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* =========================================================================
   3. Product card — stock, cart, second-image hover
   ========================================================================= */

/* Second-image hover swap (desktop only) */
.product-card .product-image-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.product-card .product-image-hover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
    .product-card:hover .product-image-hover {
        opacity: 1;
    }
}

/* Card chrome: flat at rest, soft shadow on the image on hover */
.product-card .product-card-inner {
    border: none;
    box-shadow: none;
    background: transparent;
    transition: none;
}

.product-card:hover .product-card-inner {
    transform: none;
    box-shadow: none;
}

.product-card .product-image-wrapper {
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}

.product-card:hover .product-image-wrapper {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Name: 14px, two-line clamp */
.product-card .product-title,
.product-card .product-title a {
    font-size: 14px !important;
    font-weight: var(--font-weight-medium);
    color: var(--color-black);
    line-height: 1.35;
}

.product-card .product-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price: quiet supporting element — dark, 15px, never blue */
.product-card .product-price .price,
.product-card .product-price .price ins,
.product-card .product-price .price bdi {
    color: var(--color-black) !important;
    font-size: 15px !important;
    font-weight: var(--font-weight-semibold) !important;
    text-decoration: none;
}

.product-card .product-price .price del,
.product-card .product-price .price del bdi {
    color: var(--color-gray-400) !important;
    font-size: 13px !important;
    font-weight: var(--font-weight-regular, 400) !important;
}

/* Badges: small, dark, grouped with the image corner */
.product-card .product-badges .badge {
    font-size: 10.5px;
    font-weight: var(--font-weight-medium);
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--color-black);
    color: var(--color-white);
    text-transform: none;
    letter-spacing: 0;
}

.product-card .product-badges .out-of-stock-badge {
    background: var(--color-gray-500);
}

/* Stock: 12px with a green dot */
.product-card .product-stock {
    display: block;
    margin: 6px 0 0;
    font-size: 12px;
    font-weight: var(--font-weight-regular, 400);
}

.product-card .product-stock .stock-icon {
    display: none;
}

.product-card .product-stock .in-stock,
.product-card .product-stock .out-of-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.product-card .product-stock .in-stock {
    color: #15803d;
}

.product-card .product-stock .in-stock::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.product-card .product-stock .out-of-stock {
    color: var(--color-gray-400);
}

.product-card .product-stock .out-of-stock::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-gray-300);
}

/* Financing line: 11.5px muted */
.product-card .product-esto-info {
    font-size: 11.5px;
    color: var(--color-gray-400);
}

/* No in-grid cart buttons — card click goes to the product page */
.product-card .product-cart {
    display: none !important;
}

/* =========================================================================
   4. Sidebar cleanup + tags show-more
   ========================================================================= */
.shop-sidebar .filter-section {
    padding: 18px 0;
    border-bottom: 1px solid var(--color-gray-200);
}

.shop-sidebar .filter-section:last-child {
    border-bottom: none;
}

.shop-sidebar .filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-black);
    margin: 0 0 12px;
    cursor: pointer;
}

.shop-sidebar .filter-title .filter-toggle {
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--color-gray-500);
    cursor: pointer;
}

.tags-show-more {
    margin-top: 10px;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
}

.tags-show-more:hover {
    text-decoration: underline;
}

/* =========================================================================
   5. Mobile sticky filter bar + drawer apply bar
   ========================================================================= */
/* The new sticky bar supersedes the old top toggle — hide it everywhere */
.mobile-filter-toggle {
    display: none !important;
}

.mobile-filter-bar {
    display: none;
}

.sidebar-apply-bar {
    display: none;
}

/* Breakpoint matches the drawer-mode sidebar in style.css (max-width: 968px) */
@media (max-width: 968px) {
    /* Sticky "Filtreeri ja sorteeri" bar while scrolling the grid.
       Offset by the sticky site header height (set by shop-filters.js). */
    .mobile-filter-bar {
        display: block;
        position: sticky;
        top: var(--kr-header-h, 60px);
        z-index: 30;
        margin: 0 0 16px;
        padding: 8px 0;
        background: var(--color-white);
    }

    .mobile-filter-bar__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px 16px;
        background: var(--color-white);
        border: 1px solid var(--color-gray-300);
        border-radius: var(--border-radius);
        font-size: 0.95rem;
        font-weight: var(--font-weight-semibold);
        color: var(--color-black);
        box-shadow: var(--shadow-sm);
        cursor: pointer;
    }

    .mobile-filter-bar__btn .filter-count {
        min-width: 20px;
        padding: 1px 6px;
        border-radius: 999px;
        background: var(--color-gray-200);
        color: var(--color-gray-700);
        font-size: 0.75rem;
    }

    .mobile-filter-bar__btn .filter-count.active {
        background: var(--color-primary);
        color: var(--color-white);
    }

    /* Batched-apply footer pinned at the bottom of the drawer.
       The drawer container has no side padding, so no negative margins. */
    .sidebar-apply-bar {
        display: block;
        position: sticky;
        bottom: 0;
        margin: 16px 0 0;
        padding: 14px 20px;
        background: var(--color-white);
        border-top: 1px solid var(--color-gray-200);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    }

    .sidebar-apply-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================================
   6. Load more
   ========================================================================= */
.shop-loadmore {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 32px 0 8px;
    text-align: center;
}

.shop-loadmore__progress {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-gray-500);
}

.shop-loadmore__btn {
    min-width: 240px;
}

.shop-loadmore__btn.is-loading {
    opacity: 0.6;
    cursor: progress;
}

/* When JS load-more is active the native numbered pagination is hidden */
.shop-pagination[hidden] {
    display: none;
}
