/* ==================================================================
   Toolbar Strip
   ==================================================================
   Persistent toolbar that sits between the theme header and the
   brands / data-table content.  No JS DOM manipulation — the HTML
   stays in its natural position in index.php.

   Desktop (≥ 1025px):  search + filter pills always visible inline.
                         No toggle button needed.
   Mobile  (< 1025px):  compact bar with toggle button.
                         Tap to expand search + pills.
   ================================================================== */

/* ------------------------------------------------------------------
   1. Toolbar container — full-width strip below header
   ------------------------------------------------------------------ */
.filters-container {
    width: 100vw;
    margin: 0 -20px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid #ebebeb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 10;
}

/* ------------------------------------------------------------------
   2. Content wrapper
   ------------------------------------------------------------------ */
.filters-content-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0;
    max-width: 100%;
}

.filters-content {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------------
   3. Search field — sits at the left of the toolbar
   ------------------------------------------------------------------ */
.header-item-search-advanced {
    width: auto !important;
    max-width: 300px !important;
    flex-shrink: 1;
    min-width: 180px;
}

.header-item-search-advanced .search-form {
    margin: 0 !important;
}

.header-item-search-advanced .search-form input.search-field {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    color: #333;
    background-color: #f7f7f7;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    -webkit-appearance: none;
}

.header-item-search-advanced .search-form input.search-field:focus {
    border-color: #bbb;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.header-item-search-advanced .search-form input.search-field::placeholder {
    color: #aaa;
}

/* ------------------------------------------------------------------
   4. Filter pills row (New / Pre-Owned / No Box / With Box)
   ------------------------------------------------------------------ */
.filters-content .filters {
    display: none;
}

.filters-content .filters.visible {
    display: block !important;
}

.items {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.items button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.15s ease;
    line-height: 1.3;
}

.items button:hover {
    background: #333;
}

.items button:active {
    transform: scale(0.97);
}

.items button.disabled {
    background: #555;
}

.items button svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* The add icon is shown by default, remove icon is hidden */
.items button .remove { display: none; }
.items button .add    { display: inline-flex; }

/* When a pill is active (disabled), show the X and hide the + */
.items button.disabled .remove { display: inline-flex; }
.items button.disabled .add    { display: none; }

/* ------------------------------------------------------------------
   5. Toggle button (mobile only — hidden on desktop)
   ------------------------------------------------------------------ */
.filter-toggle-btn {
    position: relative;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background-color: #111;
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
    z-index: 10;
}

.filter-toggle-btn.hidden {
    display: none !important;
}

.filter-toggle-btn:hover {
    background-color: #333;
}

.filter-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* ------------------------------------------------------------------
   6. Filter count badge (overlays the toggle button)
   ------------------------------------------------------------------ */
.filter-count-badge {
    position: absolute !important;
    top: -4px;
    right: -4px;
    background-color: #1A5EDD;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    z-index: 11;
}

.filter-count-badge:empty {
    display: none !important;
}

.filter-count-badge.has-count {
    display: flex !important;
}

/* ==================================================================
   7. DESKTOP  (≥ 1025px)
   ==================================================================
   - Search + pills are always visible inline.
   - No toggle button.
   - Search on the left, pills on the right.
   ================================================================== */
@media (min-width: 1025px) {
    .filters-container {
        padding: 0 20px;
    }

    .filters-content-wrapper {
        display: flex !important;
        padding: 10px 0;
    }

    .filters-content {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 16px;
    }

    /* Search stays at leading position */
    .header-item-search-advanced {
        order: -1;
        flex-shrink: 1;
        min-width: 200px;
        max-width: 320px !important;
    }

    /* Filter pills sit next to search */
    .filters-content .filters {
        flex-shrink: 0;
    }

    .items {
        flex-wrap: nowrap;
    }

    /* Toggle button — not needed on desktop */
    .filter-toggle-btn {
        display: none !important;
    }
}

/* ==================================================================
   8. TABLET & MOBILE  (< 1025px)
   ==================================================================
   - Toggle button visible in the toolbar bar.
   - Search + pills hidden by default, expand on toggle.
   ================================================================== */
@media (max-width: 1024px) {
    .filters-container {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        padding: 8px 16px;
    }

    /* Toggle button — shown */
    .filter-toggle-btn.visible {
        display: inline-flex !important;
        order: 0;
    }

    /* Label next to the toggle for scannability */
    .filter-toggle-btn::after {
        content: 'Filters';
        display: inline-block;
        position: absolute;
        left: calc(100% + 8px);
        font-size: 13px;
        font-weight: 500;
        color: #333;
        white-space: nowrap;
        pointer-events: none;
    }

    /* Content hidden by default */
    .filters-content-wrapper {
        display: none !important;
        width: 100%;
        flex-basis: 100%;
        padding: 12px 0 8px;
    }

    /* Expanded state — toggled by JS */
    .filters-content-wrapper.toolbar-expanded {
        display: flex !important;
    }

    .filters-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-item-search-advanced {
        max-width: none !important;
        min-width: 0;
        width: 100% !important;
    }

    .items {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 468px) {
    .items button {
        font-size: 12px;
        padding: 7px 14px;
    }

    .filter-toggle-btn::after {
        font-size: 12px;
    }
}

/* ==================================================================
   BRANDS SECTION
   ================================================================== */
.brands-section {
    width: 100%;
    margin-top: 20px;
}

.brands-section-title {
    font-style: normal;
    font-weight: 700;
    font-size: 18px;
    line-height: 29px;
    letter-spacing: 0.4px;
    color: #000000;
    margin-bottom: 16px;
    text-align: center;
    justify-content: center;
}

.brands-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #EBEBEB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 48px;
    width: 88px;
    box-sizing: border-box;
}

.brand-card:hover {
    border-color: #ccc;
}

.brand-card.active {
    border: 1px solid black;
}

.brand-card-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.brand-card-image-placeholder {
    width: 100%;
    height: auto;
    border-radius: 4px;
    font-size: 10px;
    text-align: center;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .brands-grid {
        gap: 12px;
    }
}

/* ==================================================================
   JEWELRY CATEGORIES SECTION
   ================================================================== */
.jewelry-categories-section {
    width: 100%;
    margin-top: 20px;
}

.jewelry-categories-section-title {
    font-style: normal;
    font-weight: 700;
    font-size: 18px;
    line-height: 29px;
    letter-spacing: 0.4px;
    color: #000000;
    margin-bottom: 16px;
    text-align: center;
    justify-content: center;
}

.jewelry-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.category-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #EBEBEB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    min-width: 88px;
    box-sizing: border-box;
    gap: 8px;
}

.category-card:hover {
    border-color: #ccc;
}

.category-card.active {
    border: 1px solid #000;
    background: #f8f8f8;
}

.category-card-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.category-card-title {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    white-space: nowrap;
}

.category-card-image-placeholder {
    width: 100%;
    height: auto;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    word-wrap: break-word;
    color: #333;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .jewelry-categories-grid {
        gap: 12px;
    }

    .category-card {
        min-width: 100px;
        padding: 10px 12px;
    }

    .category-card-image {
        width: 28px;
        height: 28px;
    }

    .category-card-title {
        font-size: 11px;
    }

    .category-card-image-placeholder {
        font-size: 11px;
    }
}
