/**
 * Dropdown filter bar UI — layout, drawer, and native select styling.
 * Scoped to .wpc-has-dropdown-ui to limit impact on other filter types.
 * Drawer shell is appended to body; use .wpc-is-open on the shell.
 */

html.wpc-flrt-dropdown-drawer-scroll-lock {
    overflow: hidden;
}

.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .wpc-filter-header .wpc-filter-title,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .wpc-filter-header .wpc-filter-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 6px;
    line-height: 1.2;
}

.wpc-has-dropdown-ui .wpc-filter-layout-dropdown .wpc-filter-content {
    margin-bottom: 0;
}

/* Native <select> — rounded control */
.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 14px;
    font-size: 15px;
    line-height: 1.3;
    color: #111827;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239ca3af' d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3af' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select:hover,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select:hover {
    border-color: #cbd5e1;
}

.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select:focus,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select:focus {
    outline: none;
    border: 2px solid #111827;
    box-shadow: none;
}

/* Select2 single — align with native look */
.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default .select2-selection--single,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default .select2-selection--single {
    min-height: 44px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 0 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, border-width 0.15s ease;
}

.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default.select2-container--focus .select2-selection--single,
body .wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default.select2-container--focus .select2-selection--single,
.wpc-dropdown-ui-drawer-body .select2-container--default.select2-container--focus .select2-selection--single,
.wpc-dropdown-ui-drawer-body .select2-container--default.select2-container--open .select2-selection--single {
    border: 2px solid #111827;
    box-shadow: none;
}

.wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 6px;
    color: #1f2937;
}

.wpc-has-dropdown-ui .wpc-filter-layout-dropdown .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
    right: 10px;
}

/* Desktop toolbar */
.widget_wpc_filters_widget .wpc-has-dropdown-ui .wpc-dropdown-ui-toolbar,
body .wpc-has-dropdown-ui .wpc-dropdown-ui-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    align-content: center;
    gap: 12px 18px;
    width: 100%;
    flex: 1 1 100%;
    padding: 18px 20px;
    margin-bottom: 18px;
    box-sizing: border-box;
    background: #fff;
    border: none;
    box-shadow: none;
}

.wpc-has-dropdown-ui .wpc-dropdown-ui-primary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    flex: 1 1 auto;
    min-width: 0;
}

.wpc-has-dropdown-ui .wpc-dropdown-ui-primary > .wpc-filter-layout-dropdown {
    flex: 1 1 140px;
    min-width: 120px;
    max-width: 220px;
    margin-bottom: 0;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    min-height: 52px;
    padding: 14px 40px 14px 14px;
    margin-bottom: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2937;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-btn:hover {
    border-color: #cbd5e1;
    background: #f9fafb;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-btn:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-btn.wpc-dropdown-more-hidden {
    display: none;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-icon {
    display: inline-block;
    width: 18px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='14' viewBox='0 0 18 14'%3E%3Cpath stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' d='M2 2h14M2 7h14M5 12h8'/%3E%3Ccircle cx='5' cy='2' r='1.2' fill='%236b7280'/%3E%3Ccircle cx='13' cy='7' r='1.2' fill='%236b7280'/%3E%3C/svg%3E") center / contain no-repeat;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #697861;
    border-radius: 999px;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-count.wpc-is-zero {
    display: none;
}

.wpc-has-dropdown-ui .wpc-dropdown-more-filters-paren {
    display: none;
}

/* Right drawer (desktop) — shell is direct child of body */
body > .wpc-dropdown-ui-drawer-shell {
    position: fixed;
    inset: 0;
    z-index: 10000000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

body > .wpc-dropdown-ui-drawer-shell.wpc-is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-desktop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(40vw, 520px);
    min-width: 280px;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    transform: translate3d(100%, 0, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body > .wpc-dropdown-ui-drawer-shell.wpc-is-open .wpc-dropdown-ui-drawer-panel {
    transform: translate3d(0, 0, 0);
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
    color: #4b5563;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-close:hover {
    background: #f3f4f6;
    color: #111827;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-body > .wpc-filter-layout-dropdown {
    max-width: 100%;
    margin-bottom: 22px;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-body > .wpc-filter-layout-dropdown:last-child {
    margin-bottom: 0;
}

.rtl body > .wpc-dropdown-ui-drawer-shell .wpc-dropdown-ui-drawer-panel {
    right: auto;
    left: 0;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
    transform: translate3d(-100%, 0, 0);
}

.rtl body > .wpc-dropdown-ui-drawer-shell.wpc-is-open .wpc-dropdown-ui-drawer-panel {
    transform: translate3d(0, 0, 0);
}

.rtl .wpc-has-dropdown-ui .wpc-filter-layout-dropdown select.wpc-filters-widget-select {
    padding: 10px 14px 10px 40px;
    background-position: left 14px center;
}

/* Drawer: same label + field styling as primary bar */
body > .wpc-dropdown-ui-drawer-shell .wpc-filter-layout-dropdown .wpc-filter-header .wpc-filter-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
}

body > .wpc-dropdown-ui-drawer-shell .wpc-filter-layout-dropdown select.wpc-filters-widget-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 14px;
    font-size: 15px;
    color: #111827;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239ca3af' d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3af' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
}

body > .wpc-dropdown-ui-drawer-shell .select2-container {
    z-index: 1000000 !important;
}
