/* ==========================================================================
   MSW Mobile Filters - Amazon-style mobile filter layout
   ========================================================================== */

/* Hide original filter and its sidebar on mobile/tablet */
.msw-mf-original-hidden {
    display: none !important;
}

.msw-mf-sidebar-hidden {
    display: none !important;
}

/* Make the products area full width when sidebar is hidden */
.msw-mf-sidebar-hidden ~ .elementor-column,
.msw-mf-sidebar-hidden ~ [class*="content-col"],
.msw-mf-sidebar-hidden ~ #primary {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

/* When sidebar is hidden, make remaining Elementor columns full width */
/* Direct sibling: .e-con-inner > .e-child */
.e-con-inner:has(> .msw-mf-sidebar-hidden) > .e-con:not(.msw-mf-sidebar-hidden),
.e-con-inner:has(> .msw-mf-sidebar-hidden) > .e-child:not(.msw-mf-sidebar-hidden) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Parent e-con with direct children */
.e-con:has(> .msw-mf-sidebar-hidden) > .e-con:not(.msw-mf-sidebar-hidden),
.e-con:has(> .msw-mf-sidebar-hidden) > .e-child:not(.msw-mf-sidebar-hidden) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Classic Elementor columns */
.elementor-row:has(.msw-mf-sidebar-hidden) > .elementor-column:not(.msw-mf-sidebar-hidden),
.elementor-section:has(.msw-mf-sidebar-hidden) > .elementor-container > .elementor-column:not(.msw-mf-sidebar-hidden) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Mobile wrapper */
.msw-mf-mobile-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #fff;
    position: relative;
    z-index: 100;
}

/* ==========================================================================
   1. SEARCH BAR
   ========================================================================== */
.msw-mf-search-bar {
    width: 100%;
    padding: 8px 12px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    box-sizing: border-box;
}

/* WLPF search input styling */
.msw-mf-search-bar .wlpf-search-input {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.msw-mf-search-bar .wlpf-search-field {
    flex: 1;
    height: 42px;
    padding: 0 42px 0 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
    color: #333;
}

.msw-mf-search-bar .wlpf-search-field:focus {
    border-color: #f0a030;
    box-shadow: 0 0 0 2px rgba(240, 160, 48, 0.2);
}

.msw-mf-search-bar .wlpf-search-icon {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 10px;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* Woolentor (non-wlpf) search form */
.msw-mf-search-bar form {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
}

.msw-mf-search-bar .woolentor-search-input-box,
.msw-mf-search-bar .wl_product_search_form {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
}

.msw-mf-search-bar input[type="search"],
.msw-mf-search-bar input[type="text"] {
    flex: 1;
    height: 42px;
    padding: 0 42px 0 14px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
    color: #333;
}

.msw-mf-search-bar input[type="search"]:focus,
.msw-mf-search-bar input[type="text"]:focus {
    border-color: #f0a030;
    box-shadow: 0 0 0 2px rgba(240, 160, 48, 0.2);
}

.msw-mf-search-bar button[type="submit"],
.msw-mf-search-bar .input-inner-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px 10px;
    cursor: pointer;
    color: #888;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.msw-mf-search-bar:empty {
    display: none;
}

/* ==========================================================================
   2. PILLS ROW
   ========================================================================== */
.msw-mf-pills-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
}

.msw-mf-pills-row::-webkit-scrollbar {
    display: none;
}

.msw-mf-pills-row:empty {
    display: none;
}

/* ==========================================================================
   3. PILL BUTTONS
   ========================================================================== */
.msw-mf-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid #d5d5d5;
    border-radius: 20px;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    font-family: inherit;
}

.msw-mf-pill:active {
    background: #f0f0f0;
    transform: scale(0.97);
}

.msw-mf-pill.msw-mf-pill-active {
    background: #fff3e0;
    border-color: #f0a030;
    color: #c57600;
}

.msw-mf-pill.msw-mf-pill-expanded {
    background: #f5f5f5;
    border-color: #999;
}

.msw-mf-pill.msw-mf-pill-expanded .msw-mf-pill-arrow {
    transform: rotate(180deg);
}

.msw-mf-pill-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msw-mf-pill-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.5;
}

/* ==========================================================================
   4. DROPDOWN PANELS
   ========================================================================== */
.msw-mf-dropdown-panel {
    display: none;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 0;
    box-sizing: border-box;
    z-index: 101;
    animation: mswSlide 0.2s ease;
}

.msw-mf-dropdown-panel.msw-mf-open {
    display: block;
}

@keyframes mswSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.msw-mf-panel-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    box-sizing: border-box;
    display: block !important;
}

/* Hide header/labels inside panels (already in pill) */
.msw-mf-panel-content .wlpf-filter-header,
.msw-mf-panel-content .wlpf-filter-label,
.msw-mf-panel-content > label,
.msw-mf-panel-content > h2,
.msw-mf-panel-content > h3 {
    display: none !important;
}

/* ==========================================================================
   5. WLPF CHECKBOX / RADIO LIST inside panels
   ========================================================================== */
.msw-mf-dropdown-panel .wlpf-terms-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.msw-mf-dropdown-panel .wlpf-term-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.msw-mf-dropdown-panel .wlpf-term-item > label,
.msw-mf-dropdown-panel .wlpf-term-item > a {
    display: flex;
    align-items: center;
    padding: 11px 6px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    gap: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.msw-mf-dropdown-panel .wlpf-term-item > label:active,
.msw-mf-dropdown-panel .wlpf-term-item > a:active {
    background: #f8f8f8;
}

.msw-mf-dropdown-panel .wlpf-term-item:last-child > label,
.msw-mf-dropdown-panel .wlpf-term-item:last-child > a {
    border-bottom: none;
}

/* Checkbox / radio inputs */
.msw-mf-dropdown-panel .wlpf-term-item input[type="checkbox"],
.msw-mf-dropdown-panel .wlpf-term-item input[type="radio"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #f0a030;
    cursor: pointer;
}

/* Selected items */
.msw-mf-dropdown-panel .wlpf-term-item-selected > label,
.msw-mf-dropdown-panel .wlpf-term-item-selected > a {
    color: #c57600;
    font-weight: 600;
}

/* Count/badge */
.msw-mf-dropdown-panel .wlpf-term-item-count {
    margin-left: auto;
    color: #999;
    font-size: 12px;
}

/* Subcategories */
.msw-mf-dropdown-panel .wlpf-term-item .wlpf-terms-list {
    padding-left: 20px;
}

/* Collapse buttons inside terms */
.msw-mf-dropdown-panel .wlpf-term-item-collapse {
    margin-left: auto;
}

/* ==========================================================================
   6. WLPF SELECT inside panels
   ========================================================================== */
.msw-mf-dropdown-panel .wlpf-terms-select,
.msw-mf-dropdown-panel select {
    width: 100% !important;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #333;
    -webkit-appearance: none;
    appearance: none;
}

/* ==========================================================================
   7. WLPF PRICE RANGE inside panels
   ========================================================================== */
.msw-mf-dropdown-panel .wlpf-price-range {
    padding: 8px 0;
}

.msw-mf-dropdown-panel .wlpf-price-range input[type="number"],
.msw-mf-dropdown-panel .wlpf-price-range input[type="text"] {
    width: 45%;
    padding: 8px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
    box-sizing: border-box;
}

.msw-mf-dropdown-panel .wlpf-price-slider {
    margin: 12px 4px;
}

/* ==========================================================================
   8. ACTION BUTTONS inside panels (Apply / Clear)
   ========================================================================== */
.msw-mf-dropdown-panel .wlpf-filter-action {
    display: flex;
    gap: 8px;
    padding: 8px 0 4px;
}

.msw-mf-dropdown-panel .wlpf-filter-apply-action-button,
.msw-mf-dropdown-panel .wlpf-filter-clear-action-button {
    flex: 1;
    padding: 10px;
    border: 1px solid #d5d5d5;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
}

.msw-mf-dropdown-panel .wlpf-filter-apply-action-button {
    background: #333;
    color: #fff;
    border-color: #333;
}

.msw-mf-dropdown-panel .wlpf-filter-clear-action-button {
    background: #fff;
    color: #333;
}

/* ==========================================================================
   9. Woolentor non-wlpf content in panels (fallback)
   ========================================================================== */
.msw-mf-dropdown-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.msw-mf-dropdown-panel ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.msw-mf-dropdown-panel ul li:last-child a {
    border-bottom: none;
}

.msw-mf-dropdown-panel ul li.wlchosen > a {
    color: #c57600;
    font-weight: 600;
}

/* ==========================================================================
   10. Desktop safety
   ========================================================================== */
@media (min-width: 1025px) {
    .msw-mf-mobile-wrap { display: none !important; }
    .msw-mf-original-hidden { display: block !important; }
}
