/* Container */
.apex-wrapper {
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e1e4e8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: #333333;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.apex-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}
.apex-head h3 { margin: 0; font-size: 18px; font-weight: 800; color: #1E4DB7; }

/* Reset Button */
.apex-reset-all {
    background: #f8f9fa; color: #333; border: 1px solid #e1e4e8;
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease;
}
.apex-reset-all:hover {
    background: #F4A261; color: white; border-color: #F4A261; transform: translateY(-1px);
}

/* Items Groups */
.apex-group { margin-bottom: 12px; }

/* Search Input */
.apex-input-search {
    width: 100%; padding: 12px 16px;
    border: 2px solid #f8f9fa; border-radius: 10px;
    font-size: 14px; background: #f8f9fa; box-sizing: border-box;
    transition: all 0.3s;
}
.apex-input-search:focus {
    outline: none; background: #fff; border-color: #1E4DB7;
    box-shadow: 0 0 0 4px rgba(30, 77, 183, 0.1);
}

/* Accordion Trigger (The "Parent Button") */
.apex-accordion-trigger {
    width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px; font-weight: 700; color: #333;
    transition: all 0.2s ease;
    text-align: left;
}
.apex-accordion-trigger:hover {
    border-color: #2CC1B2; color: #2CC1B2;
}
.apex-accordion.active .apex-accordion-trigger {
    background: #f8f9fa; color: #1E4DB7; border-color: #1E4DB7;
}
.apex-accordion-trigger .icon { font-size: 18px; font-weight: 400; }

/* Accordion Content (The "Nested Children") */
.apex-accordion-content {
    display: none;
    padding: 15px 10px;
    border: 1px solid #f8f9fa;
    border-top: none;
    background: #fff;
    border-radius: 0 0 8px 8px;
    animation: slideDown 0.3s ease;
}
.apex-accordion.active .apex-accordion-content { display: block; }

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

/* Tags/Terms Buttons */
.apex-tag-group { display: flex; flex-wrap: wrap; gap: 8px; }
.apex-term {
    padding: 6px 14px;
    border: 1px solid #e1e4e8; background: #fff; border-radius: 50px;
    cursor: pointer; font-size: 13px; font-weight: 500; color: #555;
    transition: all 0.2s;
}
.apex-term:hover { border-color: #2CC1B2; color: #2CC1B2; }
.apex-term.active {
    background: #1E4DB7; color: white; border-color: #1E4DB7;
}

/* Price Slider */
.apex-price-flex { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; }
.apex-price-flex input {
    width: 100%; padding: 8px; border: 1px solid #e1e4e8; border-radius: 6px;
    text-align: center; color: #1E4DB7; font-weight: 700;
}
.apex-dual-slider { position: relative; height: 6px; background: #f1f3f5; border-radius: 10px; margin: 15px 5px; }
.slider-track { position: absolute; height: 100%; background: linear-gradient(90deg, #1E4DB7, #2CC1B2); z-index: 1; border-radius: 10px; }
.apex-dual-slider input[type=range] { position: absolute; width: 100%; pointer-events: none; appearance: none; top: -7px; z-index: 2; margin: 0; background: none; }
.apex-dual-slider input[type=range]::-webkit-slider-thumb {
    height: 20px; width: 20px; border-radius: 50%; background: #fff; border: 3px solid #1E4DB7;
    cursor: pointer; pointer-events: auto; appearance: none; -webkit-appearance: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

/* Mobile & Loading */
.apex-grid-filtering { opacity: 0.6; pointer-events: none; }
.apex-mobile-trigger { display: none; margin-bottom: 15px; }
.apex-open-filter {
    display: inline-flex; align-items: center; gap: 10px; padding: 12px 24px;
    background: #1E4DB7; color: white; border: none; border-radius: 50px;
    font-weight: 700; cursor: pointer; box-shadow: 0 6px 20px rgba(30,77,183,0.25);
}
.apex-mobile-head { display: none; }
.apex-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.5);
    z-index: 9998; display: none;
}
.apex-overlay.active { display: block; }

@media (max-width: 768px) {
    .apex-mobile-trigger { display: block; }
    .apex-wrapper {
        position: fixed; top: 0; left: -100%; width: 85%; max-width: 320px; height: 100vh;
        z-index: 9999; margin: 0; padding: 20px; border-radius: 0;
        overflow-y: auto; transition: left 0.3s ease;
    }
    .apex-wrapper.active { left: 0; }
    .apex-mobile-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
    .apex-close-filter { font-size: 24px; background: none; border: none; cursor: pointer; }
    .apex-head { display: none; } /* Hide desktop header in mobile */
}