/* ============================================================
   PPST Product Filter — Stylesheet
   Compatible with: Woostify + WooCommerce
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
.ppst-filter-wrapper {
    --ppst-navy:       #0c2d57;
    --ppst-navy-mid:   #1a4175;
    --ppst-blue:       #1565c0;
    --ppst-blue-light: #1976d2;
    --ppst-accent:     #0288d1;
    --ppst-border:     #dde3ec;
    --ppst-bg:         #f4f6fb;
    --ppst-card-bg:    #ffffff;
    --ppst-text:       #1a2535;
    --ppst-muted:      #6b7a99;
    --ppst-check:      #1565c0;
    --ppst-radius:     6px;
    --ppst-shadow:     0 2px 12px rgba(12,45,87,.08);
    --ppst-shadow-hover: 0 6px 24px rgba(12,45,87,.15);
    --ppst-transition: 0.22s ease;
    --ppst-sidebar-w:  290px;
    font-family: inherit;
    color: var(--ppst-text);
}

/* ── Layout ────────────────────────────────────────────────── */
.ppst-layout {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    position: relative;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.ppst-sidebar {
    width: var(--ppst-sidebar-w);
    min-width: var(--ppst-sidebar-w);
    background: var(--ppst-card-bg);
    border: 1px solid var(--ppst-border);
    border-radius: var(--ppst-radius);
    box-shadow: var(--ppst-shadow);
    position: sticky;
    top: 100px;
    flex-shrink: 0;
    overflow: hidden;
}

.ppst-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--ppst-navy);
    color: #fff;
}

.ppst-sidebar-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 7px;
}

.ppst-sidebar-title svg {
    opacity: .85;
}

.ppst-clear-all {
    background: transparent;
    border: 1px solid rgba(255,255,255,.45);
    color: rgba(255,255,255,.9);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--ppst-transition);
    letter-spacing: .03em;
}

.ppst-clear-all:hover {
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.8);
    color: #fff;
}

/* ── Filter Groups ─────────────────────────────────────────── */
.ppst-filter-group {
    border-bottom: 1px solid var(--ppst-border);
}

.ppst-filter-group:last-child {
    border-bottom: none;
}

.ppst-filter-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--ppst-transition);
}

.ppst-filter-group-header:hover {
    background: var(--ppst-bg);
}

.ppst-filter-group-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ppst-navy);
    line-height: 1.3;
}

.ppst-chevron {
    color: var(--ppst-navy);
    flex-shrink: 0;
    transition: transform var(--ppst-transition);
}

.ppst-filter-group-header[aria-expanded="false"] .ppst-chevron {
    transform: rotate(180deg);
}

.ppst-filter-group-body {
    padding: 2px 18px 12px;
    overflow: hidden;
    transition: none;
}

.ppst-filter-group-body.ppst-collapsed {
    display: none;
}

/* ── Checkboxes ────────────────────────────────────────────── */
.ppst-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
}

.ppst-checkbox-label:hover .ppst-checkbox-text {
    color: var(--ppst-blue);
}

.ppst-filter-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ppst-checkbox-custom {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #b0bdd6;
    border-radius: 3px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ppst-transition);
    position: relative;
}

.ppst-filter-checkbox:checked + .ppst-checkbox-custom {
    background: var(--ppst-check);
    border-color: var(--ppst-check);
}

.ppst-filter-checkbox:checked + .ppst-checkbox-custom::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(42deg) translateY(-1px);
}

.ppst-filter-checkbox:focus-visible + .ppst-checkbox-custom {
    outline: 2px solid var(--ppst-accent);
    outline-offset: 2px;
}

.ppst-checkbox-text {
    font-size: 13px;
    color: var(--ppst-text);
    line-height: 1.35;
    transition: color var(--ppst-transition);
}

/* ── Products Column ───────────────────────────────────────── */
.ppst-products-column {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* ── Toolbar ───────────────────────────────────────────────── */
.ppst-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--ppst-border);
}

.ppst-result-count {
    font-size: 15px;
    color: var(--ppst-muted);
    font-weight: 400;
}

.ppst-result-count span {
    font-weight: 700;
    color: var(--ppst-navy);
    font-size: 17px;
}

.ppst-sort-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
}

.ppst-sort-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ppst-muted);
    white-space: nowrap;
}

.ppst-sort-select {
    border: 1px solid var(--ppst-border);
    border-radius: var(--ppst-radius);
    padding: 7px 32px 7px 12px;
    font-size: 13px;
    color: var(--ppst-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230c2d57' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: border-color var(--ppst-transition);
}

.ppst-sort-select:focus {
    outline: none;
    border-color: var(--ppst-accent);
}

/* ── Active Filter Tags ────────────────────────────────────── */
.ppst-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
    min-height: 0;
}

.ppst-active-filters:empty {
    margin-bottom: 0;
}

.ppst-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f0fe;
    color: var(--ppst-blue);
    border: 1px solid #bdd0f8;
    border-radius: 20px;
    padding: 4px 10px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    animation: ppst-tag-in 0.18s ease;
}

@keyframes ppst-tag-in {
    from { opacity: 0; transform: scale(.85); }
    to   { opacity: 1; transform: scale(1); }
}

.ppst-tag-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    color: var(--ppst-blue);
    opacity: .7;
    transition: opacity var(--ppst-transition);
}

.ppst-tag-remove:hover { opacity: 1; }

/* ── Product Grid ──────────────────────────────────────────── */
.ppst-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    transition: opacity 0.2s ease;
}

.ppst-products-grid.ppst-grid-loading {
    opacity: 0.3;
    pointer-events: none;
}

/* ── Product Card ──────────────────────────────────────────── */
.ppst-product-card {
    background: var(--ppst-card-bg);
    border: 1px solid var(--ppst-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--ppst-shadow);
    transition: box-shadow var(--ppst-transition), transform var(--ppst-transition);
    animation: ppst-card-in 0.3s ease;
}

@keyframes ppst-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ppst-product-card:hover {
    box-shadow: var(--ppst-shadow-hover);
    transform: translateY(-2px);
}

/* Card Image */
.ppst-card-image-link {
    display: block;
    text-decoration: none;
}

.ppst-card-image-wrap {
    position: relative;
    background: var(--ppst-bg);
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--ppst-border);
}

.ppst-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    transition: transform var(--ppst-transition);
}

.ppst-product-card:hover .ppst-card-image {
    transform: scale(1.03);
}

.ppst-card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #c5cee0;
}

.ppst-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--ppst-navy);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 3px;
}

/* Card Body */
.ppst-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ppst-card-title-link {
    text-decoration: none;
}

.ppst-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ppst-navy);
    margin: 0 0 7px;
    line-height: 1.4;
    transition: color var(--ppst-transition);
}

.ppst-card-title-link:hover .ppst-card-title {
    color: var(--ppst-blue-light);
}

.ppst-card-desc {
    font-size: 12.5px;
    color: var(--ppst-muted);
    line-height: 1.55;
    margin: 0 0 12px;
}

/* Specs List */
.ppst-card-specs {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    border-top: 1px solid var(--ppst-border);
    padding-top: 10px;
}

.ppst-card-specs li {
    display: flex;
    font-size: 12px;
    padding: 2.5px 0;
    gap: 6px;
    align-items: baseline;
}

.ppst-spec-label {
    font-weight: 700;
    color: var(--ppst-navy);
    white-space: nowrap;
    min-width: 72px;
}

.ppst-spec-value {
    color: var(--ppst-text);
}

/* Learn More Button */
.ppst-learn-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ppst-blue);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--ppst-radius);
    margin-top: auto;
    transition: background var(--ppst-transition), transform var(--ppst-transition);
    align-self: flex-start;
}

.ppst-learn-more-btn:hover {
    background: var(--ppst-navy);
    color: #fff;
    text-decoration: none;
    transform: translateX(2px);
}

/* ── Loading Overlay ───────────────────────────────────────── */
.ppst-loading {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    justify-content: center;
    padding: 40px;
    z-index: 10;
}

.ppst-loading.ppst-loading-visible {
    display: flex;
}

.ppst-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ppst-border);
    border-top-color: var(--ppst-blue);
    border-radius: 50%;
    animation: ppst-spin 0.75s linear infinite;
}

@keyframes ppst-spin {
    to { transform: rotate(360deg); }
}

/* ── No Results ────────────────────────────────────────────── */
.ppst-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--ppst-muted);
}

.ppst-no-results svg {
    color: #c5cee0;
    margin-bottom: 16px;
}

.ppst-no-results p {
    font-size: 16px;
    margin: 0 0 16px;
}

.ppst-clear-all-btn {
    background: var(--ppst-blue);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--ppst-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--ppst-transition);
}

.ppst-clear-all-btn:hover {
    background: var(--ppst-navy);
}

/* ── Mobile Toggle ─────────────────────────────────────────── */
.ppst-mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--ppst-navy);
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: var(--ppst-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    width: 100%;
    justify-content: center;
}

.ppst-active-count {
    background: #ff5252;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .ppst-mobile-filter-toggle {
        display: flex;
    }

    .ppst-layout {
        flex-direction: column;
    }

    .ppst-sidebar {
        width: 100%;
        min-width: 0;
        position: static;
        display: none;
    }

    .ppst-sidebar.ppst-sidebar-open {
        display: block;
    }

    .ppst-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 560px) {
    .ppst-products-grid {
        grid-template-columns: 1fr;
    }

    .ppst-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Woostify Theme Compatibility ──────────────────────────── */
.ppst-filter-wrapper *,
.ppst-filter-wrapper *::before,
.ppst-filter-wrapper *::after {
    box-sizing: border-box;
}

.ppst-filter-wrapper h3 {
    margin-top: 0;
}

.ppst-filter-wrapper ul {
    margin: 0;
    padding: 0;
}

.ppst-filter-wrapper button {
    line-height: 1;
}

/* Override Woostify's global link underline on cards */
.ppst-product-card a {
    text-decoration: none;
}

.ppst-product-card a:hover {
    text-decoration: none;
}
