/* =========================================================================
   PP SHOP PAGE — Consolidated & Optimized (v4)
   This file handles Shop-specific layout, Hero, Filters, and AJAX UI.
   Product Card styles are handled in assets/css/pp-cards.css.
   Global utilities are handled in assets/css/pp-global.css.
   ========================================================================= */

/* 1. SHOP HERO & CATEGORY DESCRIPTION */
.pp-shop-hero {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    padding: 28px 0 24px;
    margin-bottom: 32px;
}

.pp-shop-hero-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 15px;
}

.pp-shop-hero-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-top: 12px;
}

.pp-shop-hero-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-primary, #059669);
    margin-bottom: 4px;
}

.pp-cat-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.pp-cat-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.pp-cat-stat svg {
    color: #94a3b8;
}

.pp-shop-hero-title {
    font-family: var(--font-heading, 'Manrope', sans-serif);
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 800;
    color: var(--color-dark, #0f172a);
    margin: 0 0 16px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.pp-cat-desc {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 15px;
    line-height: 1.75;
    color: #475569;
}

.pp-cat-desc--collapsible {
    max-height: 78px;
    overflow: hidden;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.pp-cat-desc--collapsible.pp-cat-expanded {
    max-height: 2000px;
}

.pp-cat-desc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary, #059669);
}

/* 2. MAIN LAYOUT & SIDEBAR */
.pp-shop-main-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 15px;
}

.pp-shop-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.pp-sidebar-sticky {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.03);
}

@media (min-width: 850px) {
    .pp-sidebar-sticky {
        position: sticky;
        top: 100px;
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* 3. FILTER GROUPS & ITEMS */
.pp-filter-group {
    border-bottom: 1px solid #f1f5f9;
}

.pp-filter-group:last-child {
    border-bottom: none;
}

.pp-filter-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    user-select: none;
}

.pp-filter-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #1e293b;
    margin: 0;
}

.pp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.pp-checkbox-label:hover {
    background: #f8fafc;
}

.pp-checkbox-custom {
    width: 16px;
    height: 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.pp-checkbox-label input:checked~.pp-checkbox-custom {
    background: var(--pp-primary, #059669);
    border-color: var(--pp-primary, #059669);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Swatches with labels */
.pp-filter-swatch-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 8px 0;
}

.flex-swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 99px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flex-swatch:has(input:checked) {
    background: #fff;
    border-color: #10b981;
    box-shadow: 0 2px 12px rgba(16, 185, 129, 0.15);
}

.pp-swatch-visual {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.flex-swatch:has(input:checked) .pp-swatch-visual {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #10b981;
}

/* 4. SHOP TOOLBAR & SORTING */
.pp-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

/* 5. ACTIVE FILTERS */
.pp-active-filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.pp-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

.pp-active-filter-chip:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

/* 6. AJAX UI & SKELETONS */
.pp-products-grid-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 10;
}

#pp-ajax-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff;
    padding: 20px 28px;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    align-items: center;
    gap: 12px;
}

#pp-ajax-spinner.is-visible {
    display: flex;
}

.pp-spinner-ring {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: ppSpin 0.7s linear infinite;
}

@keyframes ppSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeletons */
.pp-skeleton-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.pp-skeleton-card {
    background: #fff;
    border-radius: 12px;
    flex: 1 1 calc(25% - 20px);
    min-width: 200px;
    aspect-ratio: 3/4;
    animation: ppPulse 1.5s infinite;
}

@keyframes ppPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* 7. PAGINATION */
.woocommerce-pagination ul {
    display: flex;
    justify-content: center;
    gap: 8px;
    border: none !important;
}

.woocommerce-pagination ul li {
    border: none !important;
}

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-weight: 700;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.woocommerce-pagination ul li span.current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* 8. MOBILE DRAWER & BOTTOM SHEET */
@media (max-width: 849px) {
    #pp-shop-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 85%;
        max-width: 320px;
        height: 100dvh;
        background: #fff;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    #pp-shop-sidebar.pp-drawer-open {
        transform: translateX(0);
    }
}

/* 9. QUANTITY INPUT */
.pp-std-qty-wrapper {
    display: flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    height: 50px;
    width: 140px;
}

.pp-qty-btn {
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f9fafb;
    cursor: pointer;
}

.pp-std-qty-wrapper input {
    flex: 1;
    border: none;
    text-align: center;
    font-weight: bold;
}

/* HIDE DEFAULTS */
.shop-page-title,
.page-title-inner,
.woocommerce-products-header {
    display: none !important;
}