/* apnet-wc-category.css */
:root {
    --apnet-primary: #75A47F;    /* Botanical Green */
    --apnet-secondary: #62544C;  /* Warm Charcoal/Brown */
    --apnet-tertiary: #DC7F74;   /* Coral Pink */
    --apnet-surface: #FFFFFF;
    --apnet-on-surface: #62544C; /* Using secondary as primary text for high contrast */
    --apnet-muted: #F3F4F6;
    --apnet-success: #75A47F;
    --apnet-error: #DC7F74;
    --apnet-font-family: "Josefin Sans", sans-serif;
}

.jb-category-page {
    margin-bottom: 60px;
}

/* Layout Constraints */
.jb-container {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Custom Header / Banner */
.jb-category-page .jb-category-header {
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    padding: 80px 0;
    text-align: center;
    margin-bottom: 40px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Breadcrumbs (Screenshot 2) */
.jb-category-page .jb-category-header .woocommerce-breadcrumb,
.jb-category-page .jb-category-header .woocommerce-breadcrumb a {
    font-family: var(--apnet-font-family) !important;
    font-size: 16px !important;
    color: rgba(33, 33, 33, 0.65) !important;
    text-align: center;
    letter-spacing: 0.2px;
    line-height: 16px;
    margin-bottom: 15px;
    text-transform: none;
    text-decoration: none;
    transition: color 0.2s ease;
    display: inline-flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.jb-category-page .jb-category-header .woocommerce-breadcrumb a:hover {
    color: rgb(117, 164, 127) !important;
}

/* Page Title (Screenshot 1) */
.jb-category-page .jb-category-header h1.jb-page-title {
    font-family: var(--apnet-font-family) !important;
    font-size: 48px !important;
    font-weight: 400 !important;
    color: rgb(117, 164, 127) !important;
    text-align: center !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    line-height: 48px !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .jb-category-page .jb-category-header {
        padding: 50px 0;
        min-height: auto;
    }

    .jb-category-page .jb-category-header h1.jb-page-title {
        font-size: 32px !important;
        line-height: 36px !important;
    }
}

/* Toolbar & Filters Base */
.jb-cat-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--apnet-muted);
}

.jb-cat-filters-wrap {
    display: flex;
    align-items: center;
}

.jb-mobile-filter-toggle {
    display: flex;
    /* Now visible on all platforms */
    font-family: var(--apnet-font-family);
    background: var(--apnet-primary);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.jb-mobile-filter-toggle:hover {
    background: var(--apnet-secondary);
}

/* Drawer Backdrop */
.jb-drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.jb-drawer-backdrop.show {
    display: block;
    opacity: 1;
}

/* Category Links */
.jb-filter-categories {
    width: 100%;
}

.jb-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.jb-cat-link {
    font-family: var(--apnet-font-family);
    font-size: 13px;
    color: var(--apnet-secondary);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: 20px;
    background-color: var(--apnet-muted);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.jb-cat-link:hover,
.jb-cat-link.active {
    background-color: var(--apnet-primary);
    color: white;
    border-color: var(--apnet-primary);
}

/* Base Drawer Styles (Shared Desktop & Mobile) */
.jb-filters-drawer {
    position: fixed;
    background: var(--apnet-surface);
    z-index: 99999;
    display: flex;
    flex-direction: column;
}

.jb-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--apnet-muted);
}

.jb-drawer-header h3 {
    margin: 0;
    font-family: var(--apnet-font-family);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--apnet-secondary); /* Darker text */
    font-weight: 600;
}

.jb-drawer-close {
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--apnet-secondary);
    transition: color 0.2s ease;
}

.jb-drawer-close:hover {
    color: var(--apnet-primary);
}

.jb-drawer-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.jb-filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
}

.jb-filter-title {
    font-family: var(--apnet-font-family);
    font-size: 13px;
    color: var(--apnet-secondary);
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jb-filter-title-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.jb-price-display {
    font-size: 13px;
    color: #6b7280;
}

/* Sorting Select */
.jb-sort-select {
    font-family: var(--apnet-font-family) !important;
    font-size: 14px !important;
    padding: 8px 16px !important;
    border: 1px solid var(--apnet-success) !important;
    border-radius: 4px !important;
    color: var(--apnet-on-surface) !important;
    background-color: #fff !important;
    cursor: pointer;
    outline: none;
    appearance: auto;
    width: 100%;
}

.jb-sort-select:focus {
    border-color: var(--apnet-primary) !important;
}

/* Price Slider (Dual Range) */
.jb-price-slider-wrap {
    position: relative;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
}

.jb-price-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background-color: var(--apnet-muted);
    border-radius: 2px;
    z-index: 1;
}

.jb-price-slider-wrap input[type=range] {
    position: absolute;
    width: 100%;
    height: 4px;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    z-index: 2;
    margin: 0;
}

.jb-price-slider-wrap input[type=range]::-webkit-slider-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--apnet-primary);
    cursor: pointer;
    -webkit-appearance: none;
    pointer-events: auto;
}

.jb-price-slider-wrap input[type=range]::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--apnet-primary);
    cursor: pointer;
    pointer-events: auto;
    border: none;
}

/* Color Swatches */
.jb-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.jb-swatch-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jb-swatch-circle {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.jb-swatch-btn:hover,
.jb-swatch-btn.active {
    border-color: var(--apnet-primary);
}

/* Filter Actions (Sticky Footer) */
.jb-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-top: 1px solid var(--apnet-muted);
    background: var(--apnet-surface);
    gap: 16px;
    position: sticky;
    bottom: 0;
    margin-top: auto; /* Push to bottom */
    z-index: 10;
}

.jb-clear-filters {
    font-family: var(--apnet-font-family);
    background: none;
    border: none;
    color: var(--apnet-error);
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    white-space: nowrap;
}

.jb-clear-filters:hover {
    color: #b91c1c;
}

.jb-apply-filters {
    font-family: var(--apnet-font-family);
    background: var(--apnet-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    flex-grow: 1;
    transition: background 0.2s ease;
}

.jb-apply-filters:hover {
    background: var(--apnet-secondary);
}

.jb-cat-count {
    font-family: var(--apnet-font-family) !important;
    font-size: 14px !important;
    color: #6b7280 !important;
}

/* Responsive Overrides */
@media (max-width: 992px) {
    .jb-cat-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 0 20px;
    }

    .jb-filters-drawer {
        bottom: -100%;
        /* Hidden state */
        left: 0;
        width: 100%;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
    }

    .jb-filters-drawer.drawer-open {
        bottom: 0;
    }
}

@media (min-width: 993px) {
    .jb-filters-drawer {
        top: 0;
        right: -400px;
        /* Hidden state */
        width: 380px;
        height: 100vh;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }

    .jb-filters-drawer.drawer-open {
        right: 0;
    }
}