/* ================================================================
   THW Shop Filter — Stylesheet
   Matches fivemsupply.com sidebar design
   ================================================================ */

:root {
    --thwsf-accent:     #0d6efd;
    --thwsf-accent-dk:  #0b5ed7;
    --thwsf-tebex:      #1a9f6e;
    --thwsf-bg:         #fff;
    --thwsf-sidebar-bg: #f8f9fa;
    --thwsf-border:     #e9ecef;
    --thwsf-text:       #212529;
    --thwsf-muted:      #6c757d;
    --thwsf-radius:     6px;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.thwsf-wrap {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 860px) {
    .thwsf-wrap { grid-template-columns: 1fr; }
}

/* ── Sidebar Panel ───────────────────────────────────────────────────────── */

.thwsf-panel {
    background: var(--thwsf-bg);
    border: 1px solid var(--thwsf-border);
    border-radius: var(--thwsf-radius);
    overflow: hidden;
    position: sticky;
    top: 1.5rem;
}

/* ── Filter Group ────────────────────────────────────────────────────────── */

.thwsf-group {
    border-bottom: 1px solid var(--thwsf-border);
}
.thwsf-group:last-of-type { border-bottom: none; }

.thwsf-group__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.1rem;
    cursor: pointer;
}

.thwsf-group__title {
    font-size: .9rem;
    font-weight: 600;
    color: var(--thwsf-text);
}

.thwsf-group__toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--thwsf-muted);
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.thwsf-group__body {
    padding: 0 1.1rem .9rem;
}

/* ── Term List ───────────────────────────────────────────────────────────── */

.thwsf-term-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.thwsf-term-item { margin: 0; }
.thwsf-term-item--hidden { display: none; }

/* ── Checkbox ────────────────────────────────────────────────────────────── */

.thwsf-check {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .3rem 0;
    cursor: pointer;
    font-size: .875rem;
    color: var(--thwsf-text);
    line-height: 1.4;
}
.thwsf-check input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }

.thwsf-check__box {
    width: 18px;
    height: 18px;
    border: 1.5px solid #adb5bd;
    border-radius: 3px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .12s, background .12s;
}
.thwsf-check input:checked ~ .thwsf-check__box {
    border-color: var(--thwsf-accent);
    background: var(--thwsf-accent);
}
.thwsf-check input:checked ~ .thwsf-check__box::after {
    content: '';
    display: block;
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}

/* Radio */
.thwsf-check__box--radio {
    border-radius: 50%;
}
.thwsf-check input[type="radio"]:checked ~ .thwsf-check__box--radio {
    border-color: var(--thwsf-accent);
    background: var(--thwsf-accent);
}
.thwsf-check input[type="radio"]:checked ~ .thwsf-check__box--radio::after {
    width: 6px;
    height: 6px;
    background: #fff;
    border: none;
    border-radius: 50%;
    transform: none;
}

.thwsf-check__label {
    flex: 1;
    font-size: .875rem;
    color: var(--thwsf-text);
}

.thwsf-check__count {
    font-size: .8rem;
    color: var(--thwsf-muted);
}

/* ── Show More ───────────────────────────────────────────────────────────── */

.thwsf-show-more {
    background: none;
    border: none;
    padding: .35rem 0 0;
    font-size: .82rem;
    color: var(--thwsf-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .2rem;
    font-weight: 500;
}
.thwsf-show-more:hover { text-decoration: underline; }

/* ── Stars ───────────────────────────────────────────────────────────────── */

.thwsf-stars { display: flex; gap: 1px; }
.thwsf-star  { font-size: .95rem; color: #dee2e6; line-height: 1; }
.thwsf-star.filled { color: #ffc107; }
.thwsf-star.half   { color: #ffc107; opacity: .5; }

/* ── Price Slider ────────────────────────────────────────────────────────── */

.thwsf-price-track {
    position: relative;
    height: 4px;
    background: #dee2e6;
    border-radius: 4px;
    margin: 1.2rem .4rem .6rem;
}
.thwsf-price-range {
    position: absolute;
    height: 100%;
    background: var(--thwsf-accent);
    border-radius: 4px;
}
.thwsf-range {
    position: absolute;
    width: 100%;
    top: -8px;
    height: 20px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    outline: none;
}
.thwsf-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--thwsf-accent);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.thwsf-range::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--thwsf-accent);
    cursor: pointer;
    pointer-events: all;
}
.thwsf-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    color: var(--thwsf-text);
    margin-top: .3rem;
}

/* ── Panel Actions ───────────────────────────────────────────────────────── */

.thwsf-panel__actions {
    padding: .85rem 1.1rem;
    border-top: 1px solid var(--thwsf-border);
}
.thwsf-reset {
    background: none;
    border: 1px solid var(--thwsf-border);
    border-radius: var(--thwsf-radius);
    padding: .4rem .85rem;
    font-size: .82rem;
    color: var(--thwsf-muted);
    cursor: pointer;
    transition: border-color .12s, color .12s;
    width: 100%;
}
.thwsf-reset:hover { border-color: #adb5bd; color: var(--thwsf-text); }

/* ── Results Area ────────────────────────────────────────────────────────── */

.thwsf-results { position: relative; }

.thwsf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--thwsf-border);
    flex-wrap: wrap;
    gap: .5rem;
}
.thwsf-count {
    font-size: .875rem;
    color: var(--thwsf-muted);
}
.thwsf-sort {
    border: 1px solid var(--thwsf-border);
    border-radius: var(--thwsf-radius);
    padding: .4rem .75rem;
    font-size: .875rem;
    color: var(--thwsf-text);
    background: #fff;
    cursor: pointer;
    outline: none;
    min-width: 160px;
}
.thwsf-sort:focus { border-color: var(--thwsf-accent); }

/* ── Active Tags ─────────────────────────────────────────────────────────── */

.thwsf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .75rem;
}
.thwsf-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: #e7f1ff;
    color: var(--thwsf-accent);
    border: 1px solid #b6d4fe;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 500;
    padding: .2em .65em .2em .75em;
}
.thwsf-tag__remove {
    background: none;
    border: none;
    font-size: .95rem;
    cursor: pointer;
    color: var(--thwsf-accent);
    padding: 0;
    line-height: 1;
    opacity: .7;
}
.thwsf-tag__remove:hover { opacity: 1; }

/* ── Product Grid ────────────────────────────────────────────────────────── */

.thwsf-grid {
    display: grid;
    gap: 1.25rem;
    min-height: 200px;
    transition: opacity .2s;
}
.thwsf-grid.is-loading { opacity: .4; pointer-events: none; }

.thwsf-grid--2 { grid-template-columns: repeat(2, 1fr); }
.thwsf-grid--3 { grid-template-columns: repeat(3, 1fr); }
.thwsf-grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) { .thwsf-grid--4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px)  { .thwsf-grid--3, .thwsf-grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .thwsf-grid--2, .thwsf-grid--3, .thwsf-grid--4 { grid-template-columns: 1fr; } }

/* ── Product Card ────────────────────────────────────────────────────────── */

.thwsf-card {
    background: var(--thwsf-bg);
    border: 1px solid var(--thwsf-border);
    border-radius: var(--thwsf-radius);
    overflow: hidden;
    transition: box-shadow .2s;
    opacity: 0;
    transform: translateY(6px);
}
.thwsf-card.is-visible {
    opacity: 1;
    transform: none;
    transition: opacity .2s ease, transform .2s ease, box-shadow .2s;
}
.thwsf-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }

.thwsf-card__image-wrap {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
    background: #f1f3f5;
}
.thwsf-card__image-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.thwsf-card:hover .thwsf-card__image-wrap img { transform: scale(1.04); }

.thwsf-card__no-image {
    width: 100%; height: 100%;
    background: #f1f3f5;
}

/* Badges */
.thwsf-card__badge {
    position: absolute;
    top: .5rem; left: .5rem;
    font-size: .68rem;
    font-weight: 700;
    padding: .2em .55em;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .04em;
    pointer-events: none;
}
.thwsf-card__badge--tebex { background: #0d6efd; color: #fff; }
.thwsf-card__badge--sale  { background: #dc3545; color: #fff; }

.thwsf-card__body {
    padding: .8rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.thwsf-card__category {
    font-size: .75rem;
    color: var(--thwsf-muted);
    font-weight: 400;
}

.thwsf-card__name {
    margin: 0;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
}
.thwsf-card__name a { color: var(--thwsf-text); text-decoration: none; }
.thwsf-card__name a:hover { color: var(--thwsf-accent); }

.thwsf-card__rating {
    display: flex;
    align-items: center;
    gap: .25rem;
}
.thwsf-card__rcount { font-size: .75rem; color: var(--thwsf-muted); }

.thwsf-card__footer {
    /*display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .5rem;*/

    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 5px;
    margin-top: 5px;
    flex-direction: column;
}

.thwsf-card__price {
    font-size: .95rem;
    font-weight: 600;
    color: var(--thwsf-text);
}
.thwsf-card__price .woocommerce-Price-amount { color: inherit; }

/* Buy buttons */
.thwsf-card__btn {
    display: inline-block;
    padding: .45em 1.1em;
    border-radius: var(--thwsf-radius);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background .15s;
    white-space: nowrap;
    line-height: 1.4;
}
.thwsf-card__btn--tebex {
    background: var(--thwsf-accent);
    color: #fff !important;
}
.thwsf-card__btn--tebex:hover { background: var(--thwsf-accent-dk); }

.thwsf-card__btn--cart {
    background: var(--thwsf-accent);
    color: #fff !important;
}
.thwsf-card__btn--cart:hover { background: var(--thwsf-accent-dk); color: #fff !important; }

/* ── Pagination ──────────────────────────────────────────────────────────── */

.thwsf-pagination { text-align: center; margin-top: 1.5rem; }
.thwsf-load-more {
    background: var(--thwsf-accent);
    color: #fff;
    border: none;
    border-radius: var(--thwsf-radius);
    padding: .65rem 2.5rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.thwsf-load-more:hover { background: var(--thwsf-accent-dk); }

/* ── Loader ──────────────────────────────────────────────────────────────── */

.thwsf-loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.65);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    z-index: 10;
}
.thwsf-loader.is-active { opacity: 1; pointer-events: all; }

.thwsf-spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(13,110,253,.2);
    border-top-color: var(--thwsf-accent);
    border-radius: 50%;
    animation: thwsfSpin .7s linear infinite;
}
@keyframes thwsfSpin { to { transform: rotate(360deg); } }

.thwsf-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--thwsf-muted);
    font-size: .9rem;
}

/* ================================================================
   Sidebar Widgets (Appearance → Widgets)
   ================================================================ */

.thwsf-widget { margin-bottom: 1.5rem; }

.thwsf-widget__title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--thwsf-text);
    margin: 0 0 .75rem;
}

.thwsf-widget-form { margin: 0; }

.thwsf-widget-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
}

.thwsf-widget-list li { margin: 0; padding: 0; }

.thwsf-widget-apply {
    display: block;
    width: 100%;
    margin-top: .9rem;
    padding: .5rem 1rem;
    background: var(--thwsf-accent);
    color: #fff;
    border: none;
    border-radius: var(--thwsf-radius);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.thwsf-widget-apply:hover { background: var(--thwsf-accent-dk); }

.thwsf-widget-clear {
    display: inline-block;
    margin-top: .5rem;
    font-size: .75rem;
    color: var(--thwsf-muted);
    text-decoration: underline;
    cursor: pointer;
}
.thwsf-widget-clear:hover { color: var(--thwsf-accent); }

/* ================================================================
   Shop Page AJAX Wrapper
   ================================================================ */

#thwsf-shop-results {
    position: relative;
}

.thwsf-shop-toolbar {
    margin-bottom: .75rem;
    font-size: .875rem;
    color: #6c757d;
    min-height: 1.2em;
}

.thwsf-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    min-height: 200px;
    transition: opacity .2s;
}
.thwsf-shop-grid.is-loading { opacity: .4; pointer-events: none; }

@media (max-width: 1024px) { .thwsf-shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .thwsf-shop-grid { grid-template-columns: 1fr; } }

.thwsf-shop-pagination {
    text-align: center;
    margin-top: 1.5rem;
}

/* ================================================================
   Sidebar Price Slider — matches WooCommerce native style
   ================================================================ 

.thwsf-sidebar-price {
    padding: .5rem 0;
}

.thwsf-sp-track {
    position: relative;
    height: 5px;
    background: #e0e0e0;
    border-radius: 5px;
    margin: 1.75rem .5rem 1.25rem;
}

.thwsf-sp-range-fill {
    position: absolute;
    height: 100%;
    background: var(--thwsf-accent);
    border-radius: 5px;
    left: 0;
    right: 0;
    pointer-events: none;
}

.thwsf-sp-input {
    position: absolute;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 5px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin: 0;
    padding: 0;
}

.thwsf-sp-min { z-index: 3; pointer-events: none; }
.thwsf-sp-max { z-index: 4; pointer-events: none; }

.thwsf-sp-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--thwsf-accent);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: transform .1s;
}
.thwsf-sp-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.thwsf-sp-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--thwsf-accent);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

.thwsf-sp-labels {
    display: flex;
    justify-content: space-between;
    font-size: .82rem;
    color: #555;
    margin-top: .5rem;
    font-weight: 500;
}*/

.thwsf-sidebar-price {
    padding: .5rem 0;
}

.thwsf-sp-track {
    position: relative;
    height: 2px;
    background: #e0e0e0;
    border-radius: 0;
    margin: 1.75rem .5rem 1.25rem;
}

.thwsf-sp-range-fill {
    position: absolute;
    height: 100%;
    background: #1a73e8;
    left: 0;
    right: 0;
    pointer-events: none;
}

.thwsf-sp-input {
    position: absolute;
    width: 100%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    margin: 0;
    padding: 0;
}

.thwsf-sp-min { z-index: 3; pointer-events: none; }
.thwsf-sp-max { z-index: 4; pointer-events: none; }

.thwsf-sp-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #212121;
    border: none;
    cursor: pointer;
    pointer-events: all;
    box-shadow: none;
}
.thwsf-sp-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #212121;
    border: none;
    cursor: pointer;
    pointer-events: all;
    box-shadow: none;
}

.thwsf-sp-labels {
    display: flex;
    justify-content: space-between;
    font-size: .82rem;
    color: #555;
    margin-top: .5rem;
    font-weight: 400;
}
/* ================================================================
   Shop Page AJAX Grid
   ================================================================ */

#thwsf-shop-results {
    position: relative;
}

.thwsf-shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--thwsf-border);
    flex-wrap: wrap;
    gap: .5rem;
    min-height: 2rem;
}

.thwsf-shop-count {
    font-size: .875rem;
    color: var(--thwsf-muted);
}

.thwsf-shop-sort {
    border: 1px solid var(--thwsf-border);
    border-radius: var(--thwsf-radius);
    padding: .4rem .75rem;
    font-size: .875rem;
    color: var(--thwsf-text);
    background: #fff;
    cursor: pointer;
    outline: none;
    min-width: 160px;
}
.thwsf-shop-sort:focus { border-color: var(--thwsf-accent); }

.thwsf-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    min-height: 100px;
    transition: opacity .2s;
}
.thwsf-shop-grid.is-loading { opacity: .4; pointer-events: none; }

@media (max-width: 1200px) { .thwsf-shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .thwsf-shop-grid { grid-template-columns: 1fr; } }

.thwsf-shop-pagination {
    text-align: center;
    margin-top: 1.5rem;
}

.ast-woocommerce-container > li.product, .woocommerce-products-header{
    display: none !important; 
}

/* jQuery UI price slider */
.thwsf-jqui-slider {
    position: relative;
    height: 4px;
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    margin: 1rem 8px;
}
.thwsf-jqui-slider .ui-slider-range {
    background: #0d6efd;
    border: none;
    border-radius: 4px;
    height: 4px;
}
.thwsf-jqui-slider .ui-slider-handle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #111;
    border: none;
    top: -6px;
    margin-left: -8px;
    cursor: pointer;
    outline: none;
    box-shadow: none;
}
.thwsf-jqui-slider .ui-slider-handle:focus,
.thwsf-jqui-slider .ui-slider-handle:hover {
    background: #333;
    outline: none;
}

.thwsf-card__footer .add_to_cart_button{
    display: inline-flex !important;
    align-items: center;
    gap: .45em;
    background: #0274be !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    padding: .65em 1.4em !important;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease !important;
    text-decoration: none !important;
    font-size: .95rem !important;
    line-height: 1.4 !important;
    white-space: nowrap;
}

/* ── Shop page pagination ─────────────────────────────────────────────── */
.thwsf-shop-pagination {
    display: flex;
    justify-content: center;
    gap: .35rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}
.thwsf-page-btn {
    background: #fff;
    border: 1px solid #3a3a3a;
    border-radius: 0px;
    padding: .45rem .9rem;
    font-size: .875rem;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    min-width: 38px;
    text-align: center;
    color: #3a3a3a;
    margin: 0;
    text-decoration: none;
    padding: 0;
    line-height: 1;
    font-size: 1em;
    font-weight: 400;
    padding: .75em;
    text-align: center;
    display: block;
    min-width: 2.5em;
}
.thwsf-page-btn:hover {
    background: #3a3a3a2b;
    color: #3a3a3a;
    border-color: #3a3a3a;
}
.thwsf-page-btn.is-active {
    background: #3a3a3a;
    color: #fff;
    border-color: #3a3a3a;
    cursor: default;
}
.woocommerce-pagination{
	display: none;
}
/*.thwsf-page-btn {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: .45rem .85rem;
    font-size: .875rem;
    cursor: pointer;
    margin: 0 .15rem;
    transition: background .15s, color .15s;
}
.thwsf-page-btn:hover { background: #f0eeff; color: #6c63ff; border-color: #6c63ff; }
.thwsf-page-btn.is-active { background: #0d6efd; color: #fff; border-color: #0d6efd; }*/
