/**
 * P22 WooCommerce Product Filter — Frontend Styles
 */

/* ============ Shop Page Override ============ */
.p22wf-shop-page-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ============ Layout ============ */
.p22wf-wrapper {
    display: flex;
    gap: 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
}
.p22wf-sidebar-desktop {
    width: 240px;
    min-width: 240px;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 28px 24px;
    align-self: flex-start;
    position: sticky;
    top: 120px!important;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
.p22wf-sidebar-desktop::-webkit-scrollbar {
    width: 5px;
}
.p22wf-sidebar-desktop::-webkit-scrollbar-track {
    background: transparent;
}
.p22wf-sidebar-desktop::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}
.p22wf-sidebar-desktop::-webkit-scrollbar-thumb:hover {
    background: #666;
}
.p22wf-content {
    flex: 1;
    min-width: 0;
}

/* ============ Sidebar Title ============ */
.p22wf-sidebar-title {
    font-family: "Marcellus", Sans-serif;
    font-style: normal;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #C48F56;
    margin: 0 0 22px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}
.p22wf-price-title {
    margin-top: 28px;
}

/* ============ Checkboxes ============ */
.p22wf-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.p22wf-checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    position: relative;
}
.p22wf-checkbox-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.p22wf-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.p22wf-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: #3a3a3a;
    border: 1px solid #555;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.p22wf-checkbox-item input:checked ~ .p22wf-checkmark {
    background: #C48F56;
    border-color: #C48F56;
}
.p22wf-checkbox-item input:checked ~ .p22wf-checkmark::after {
    content: "";
    display: block;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.p22wf-label-text {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.3;
}

/* ============ Price Range Slider ============ */
.p22wf-price-filter {
    margin-top: 4px;
}
.p22wf-price-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}
.p22wf-price-label-min,
.p22wf-price-label-max {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 600;
}
.p22wf-range-slider {
    position: relative;
    width: 100%;
    height: 6px;
    margin: 10px 0 6px;
}
.p22wf-range-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: #3a3a3a;
    border-radius: 3px;
}
.p22wf-range-fill {
    position: absolute;
    top: 0;
    height: 6px;
    background: #C48F56;
    border-radius: 3px;
    pointer-events: none;
}
.p22wf-range-input {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: -17px;
    width: 100%;
    height: 20px;
    margin: 0;
    padding: 0;
    background: transparent;
    pointer-events: none;
    outline: none;
    z-index: 2;
}
/* Hide native track (prevents double bar) */
.p22wf-range-input::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    appearance: none;
    height: 0;
    background: transparent;
    border: none;
}
.p22wf-range-min {
    z-index: 2;
}
.p22wf-range-max {
    z-index: 3;
}
/* Webkit thumb */
.p22wf-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #C48F56;
    border: 3px solid #1a1a1a;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.p22wf-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(196, 143, 86, 0.4);
}
.p22wf-range-input::-webkit-slider-thumb:active {
    transform: scale(1.2);
}
/* Firefox thumb */
.p22wf-range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #C48F56;
    border: 3px solid #1a1a1a;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.p22wf-range-input::-moz-range-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(196, 143, 86, 0.4);
}
.p22wf-range-input::-moz-range-track {
    background: transparent;
    border: none;
}
/* Firefox focus */
.p22wf-range-input::-moz-focus-outer {
    border: 0;
}

/* ============ Search Button (mobile only) ============ */
.p22wf-search-btn {
    display: block;
    width: 100%;
    margin-top: 24px;
    padding: 10px 20px;
    background: transparent;
    color: #e0e0e0;
    border: 1px solid #666666;
    border-radius: 0px !important;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.25s;
    text-transform: uppercase;
}
.p22wf-search-btn:hover {
    background: transparent;
    border-color: #C48F56;
    color: #C48F56;
}

/* ============ Toolbar (Results + Sort) ============ */
.p22wf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 0 4px;
    min-height: 36px;
    flex-wrap: wrap;
    gap: 12px;
}
.p22wf-results-count {
    font-size: 14px;
    color: #999;
}
.p22wf-sort-wrap {
    position: relative;
}
.p22wf-sort-select {
    appearance: none;
    -webkit-appearance: none;
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.p22wf-sort-select:focus {
    border-color: #C48F56;
}
.p22wf-sort-select option {
    background: #2a2a2a;
    color: #e0e0e0;
}

/* ============ Grid ============ */
.p22wf-grid {
    display: grid;
    gap: 24px;
}
.p22wf-cols-1 { grid-template-columns: 1fr; }
.p22wf-cols-2 { grid-template-columns: repeat(2, 1fr); }
.p22wf-cols-3 { grid-template-columns: repeat(3, 1fr); }
.p22wf-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============ Product Card ============ */
.p22wf-card {
    border-radius: 0;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
    transition: transform 0.25s;
    max-width: 400px;
}
.p22wf-card:hover {
    transform: translateY(-4px);
}
.p22wf-card-image-wrap {
    position: relative;
    overflow: hidden;
}
.p22wf-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.p22wf-card-image {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #222;
}
.p22wf-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s;
}
.p22wf-card:hover .p22wf-card-image img {
    transform: scale(1.05);
}
.p22wf-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 14px;
}

/* ============ Hover Add to Cart ============ */
.p22wf-hover-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px 20px;
    font-family: "Marcellus", Sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s;
    transform: translateY(100%);
    opacity: 0;
    z-index: 2;
}
.p22wf-card:hover .p22wf-hover-btn {
    transform: translateY(0);
    opacity: 1;
}
.p22wf-atc-btn {
    background: #C48F56;
    color: #000;
}
.p22wf-atc-btn:hover {
    background: #d4a066;
}
.p22wf-atc-btn.p22wf-adding {
    pointer-events: none;
    opacity: 0.7;
}
.p22wf-atc-btn.p22wf-added {
    background: #4caf50;
    color: #fff;
}
.p22wf-view-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}
.p22wf-view-btn:hover {
    background: #fff;
}
.p22wf-oos-btn {
    background: rgba(100, 100, 100, 0.9);
    color: #ccc;
    cursor: default;
}

/* ============ Card Info ============ */
.p22wf-card-info {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 14px 4px 4px;
}
.p22wf-card-title {
    margin: 0;
    font-family: "Marcellus", Sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #ffffff;
    background: transparent;
}
.p22wf-card-price {
    margin-top: 6px;
    font-size: 14px;
    color: #C48F56;
}
.p22wf-card-price del {
    color: #888;
    margin-right: 6px;
}
.p22wf-card-price ins {
    text-decoration: none;
    color: #C48F56;
}

/* ============ Toast Notification ============ */
.p22wf-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    background: #1a1a1a;
    color: #e0e0e0;
    padding: 14px 24px;
    border-radius: 6px;
    border-left: 4px solid #C48F56;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.35s;
    pointer-events: none;
}
.p22wf-toast.p22wf-toast-show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.p22wf-toast a {
    color: #C48F56;
    text-decoration: underline;
    margin-left: 8px;
}

/* ============ Loader ============ */
.p22wf-loader {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.p22wf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #C48F56;
    border-radius: 50%;
    animation: p22wf-spin 0.7s linear infinite;
}
@keyframes p22wf-spin {
    to { transform: rotate(360deg); }
}
.p22wf-no-products {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

/* ============ Mobile Bar — hidden on desktop ============ */
.p22wf-mobile-bar {
    display: none;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .p22wf-cols-3,
    .p22wf-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .p22wf-sidebar-desktop {
        display: none !important;
    }
    .p22wf-wrapper {
        flex-direction: column;
    }
    .p22wf-content {
        padding-bottom: 70px;
    }
    .p22wf-cols-2,
    .p22wf-cols-3,
    .p22wf-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Toolbar stacks on small screens */
    .p22wf-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .p22wf-sort-wrap {
        width: 100%;
    }
    .p22wf-sort-select {
        width: 100%;
    }

    /* Always show add-to-cart on mobile */
    .p22wf-hover-btn {
        transform: translateY(0);
        opacity: 1;
    }

    /* ---- Mobile sticky bottom bar ---- */
    .p22wf-mobile-bar {
        display: block;
    }
    .p22wf-mobile-trigger {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 16px 20px;
        background-color: #c48f56!important;
        color: #000!important;
        border: none!important;
        border-radius: 0px!important;
        font-size: 14px;
        font-weight: 600;
        letter-spacing: 2px;
        cursor: pointer;
        text-transform: uppercase;
    }
    .p22wf-mobile-trigger svg {
        stroke: #000;
    }
    .p22wf-mobile-trigger:hover,
    .p22wf-mobile-trigger:active {
        background-color: #c48f56!important;;
        border: none!important;
        border-radius: 0px!important;
        opacity: 0.9;
        color: #000!important;
    }
    .p22wf-mobile-badge {
        background: #000;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        min-width: 20px;
        height: 20px;
        border-radius: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0 6px;
    }

    .p22wf-mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    .p22wf-mobile-bar.p22wf-open .p22wf-mobile-overlay {
        opacity: 1;
        visibility: visible;
    }

    .p22wf-mobile-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: #1a1a1a;
        border-radius: 16px 16px 0 0;
        padding: 24px 24px 32px;
        max-height: 70vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .p22wf-mobile-bar.p22wf-open .p22wf-mobile-panel {
        transform: translateY(0);
    }
    .p22wf-mobile-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 18px;
        padding-bottom: 14px;
        border-bottom: 1px solid #333;
    }
    .p22wf-mobile-close {
        background-color: #C48F56!important;
        border: none!important;
        outline: none!important;
        color: #000000!important;
        font-size: 22px!important;
        width: 32px!important;
        height: 32px!important;
        border-radius: 50%!important;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        cursor: pointer;
        transition: opacity 0.2s;
        padding:15px!important;
    }
    .p22wf-mobile-close:hover,
    .p22wf-mobile-close:focus {
        background-color: #C48F56!important;
        color: #000000!important;
        border: none!important;
        outline: none!important;
        border-radius: 50%!important;
        opacity: 0.85;
        padding:15px!important;
    }
    .p22wf-mobile-checkbox-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    .p22wf-mobile-search-btn {
        margin-top: 20px;
    }

    .p22wf-toast {
        bottom: 70px;
        right: 16px;
        left: 16px;
    }
}

@media (max-width: 480px) {
    .p22wf-cols-2,
    .p22wf-cols-3,
    .p22wf-cols-4 {
        grid-template-columns: 1fr;
    }
    .p22wf-card {
        max-width: 100%;
    }
    .p22wf-card-image {
        max-width: 100%;
    }
    .p22wf-mobile-checkbox-list {
        grid-template-columns: 1fr;
    }
}
