/**
 * Zahab Glass — unified professional dropdown styling
 * Nice Select (simple) + Select2 (searchable)
 */
:root {
    --erp-sel-brand: #2f6d93;
    --erp-sel-brand-dark: #1e4a62;
    --erp-sel-brand-light: #e8f3f9;
    --erp-sel-border: #cbd5e1;
    --erp-sel-bg: #ffffff;
    --erp-sel-text: #1e293b;
    --erp-sel-muted: #64748b;
    --erp-sel-radius: 10px;
    --erp-sel-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    --erp-sel-focus: 0 0 0 3px rgba(47, 109, 147, 0.18);
}

/* ── Nice Select widget (visible control) ── */
.nice-select,
div.nice-select,
.nice-select.form-select,
.nice-select.wide,
.nice-select.form-control,
.nice-select.glass-type-row-select {
    background-color: var(--erp-sel-bg) !important;
    background-image: none !important;
    border: 1.5px solid var(--erp-sel-border) !important;
    border-radius: var(--erp-sel-radius) !important;
    box-sizing: border-box;
    color: var(--erp-sel-text) !important;
    cursor: pointer;
    display: block !important;
    float: none !important;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    height: 42px;
    line-height: 40px;
    min-height: 42px;
    outline: none;
    padding-left: 12px;
    padding-right: 34px;
    position: relative;
    text-align: left !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    white-space: nowrap;
    width: 100% !important;
}

.nice-select:hover {
    border-color: #94a3b8 !important;
}

.nice-select:focus,
.nice-select.open {
    border-color: var(--erp-sel-brand) !important;
    box-shadow: var(--erp-sel-focus);
}

.nice-select:after {
    border-bottom: 2px solid var(--erp-sel-brand) !important;
    border-right: 2px solid var(--erp-sel-brand) !important;
    content: '';
    display: block;
    height: 7px !important;
    margin-top: -4px;
    pointer-events: none;
    position: absolute;
    right: 14px !important;
    top: 50% !important;
    transform: rotate(45deg);
    width: 7px !important;
    transition: transform 0.15s ease;
}

.nice-select.open:after {
    transform: rotate(-135deg);
    margin-top: -2px;
}

.nice-select .current {
    color: var(--erp-sel-text) !important;
    display: block;
    line-height: 40px;
    overflow: hidden;
    padding-right: 4px;
    text-overflow: ellipsis;
}

.nice-select .list {
    background: var(--erp-sel-bg);
    border: 1px solid var(--erp-sel-border);
    border-radius: 12px;
    box-shadow: var(--erp-sel-shadow);
    margin-top: 6px;
    max-height: 280px;
    min-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 0;
    z-index: 10050;
}

.nice-select .option {
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    min-height: 38px;
    padding: 9px 14px;
    transition: background 0.12s ease, color 0.12s ease;
}

.nice-select .option:hover,
.nice-select .option.focus,
.nice-select .option.selected.focus {
    background: var(--erp-sel-brand) !important;
    color: #fff !important;
}

.nice-select .option.selected {
    background: var(--erp-sel-brand-light);
    color: var(--erp-sel-brand-dark);
    font-weight: 700;
}

.nice-select .option.selected:hover {
    background: var(--erp-sel-brand) !important;
    color: #fff !important;
}

.nice-select.disabled {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: var(--erp-sel-muted) !important;
    pointer-events: none;
}

.nice-select.disabled:after {
    border-color: #cbd5e1 !important;
}

.modal-header .nice-select .current,
.dashboard-card .dashboard-card-header .nice-select .current,
.erp-graph-box .graph-header .nice-select .current,
.add-suplier-wrapper .nice-select .current {
    color: #ffffff !important;
}

#erp-table .nice-select,
#erp-table .nice-select.glass-type-row-select {
    font-size: 0.72rem;
    height: 34px;
    line-height: 32px;
    min-height: 34px;
    padding-left: 6px;
    padding-right: 26px;
    border-radius: 8px !important;
}

#erp-table .nice-select .current {
    line-height: 32px;
    font-size: 0.72rem;
}

#erp-table .nice-select:after {
    height: 6px !important;
    right: 9px !important;
    width: 6px !important;
}

#erp-table .nice-select .list {
    border-radius: 10px;
    font-size: 0.72rem;
}

#erp-table .nice-select .option {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 0.72rem;
}

select.form-select,
select.form-control:not([multiple]):not([size]),
select.glass-type-row-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--erp-sel-bg);
    background-image: none !important;
    border: 1.5px solid var(--erp-sel-border);
    border-radius: var(--erp-sel-radius);
    color: var(--erp-sel-text);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    width: 100%;
}

/* Hide native select when Nice Select widget is active — prevents double arrows */
select.form-select:has(+ .nice-select),
select.form-control:has(+ .nice-select),
select.glass-type-row-select:has(+ .nice-select) {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 0 !important;
}

select.keep-native-select {
    appearance: auto;
    -webkit-appearance: menulist;
}

[dir="rtl"] .nice-select {
    text-align: right !important;
    padding-left: 34px;
    padding-right: 12px;
}

[dir="rtl"] .nice-select:after {
    left: 14px;
    right: auto !important;
}

.select2-container {
    max-width: 100%;
    font-size: 0.875rem;
}

.select2-container--default .select2-selection--single,
.select2-container--bootstrap-5 .select2-selection--single,
.select2-container--default .select2-selection--multiple,
.select2-container--bootstrap-5 .select2-selection--multiple {
    background: var(--erp-sel-bg) !important;
    background-image: none !important;
    border: 1.5px solid var(--erp-sel-border) !important;
    border-radius: var(--erp-sel-radius) !important;
    min-height: 42px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--bootstrap-5.select2-container--focus .select2-selection--single,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single {
    border-color: var(--erp-sel-brand) !important;
    box-shadow: var(--erp-sel-focus);
}

.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--erp-sel-text);
    font-weight: 500;
    line-height: 40px;
    padding-left: 10px;
    padding-right: 32px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder {
    color: var(--erp-sel-muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 6px;
    width: 22px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow b {
    border-color: var(--erp-sel-brand) transparent transparent transparent;
    border-width: 5px 4px 0;
    margin-left: -4px;
    margin-top: -2px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b,
.select2-container--bootstrap-5.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--erp-sel-brand) transparent;
    border-width: 0 4px 5px;
}

.select2-dropdown {
    border: 1px solid var(--erp-sel-border);
    border-radius: 12px;
    box-shadow: var(--erp-sel-shadow);
    overflow: hidden;
    z-index: 10050;
}

.select2-container--default .select2-search--dropdown .select2-search__field,
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border: 1.5px solid var(--erp-sel-border);
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 8px 10px;
}

.select2-results__option {
    font-size: 0.875rem;
    padding: 9px 12px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
.select2-container--bootstrap-5 .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--erp-sel-brand);
    color: #fff;
}

.select2-container--default .select2-results__option--selected,
.select2-container--bootstrap-5 .select2-results__option--selected {
    background: var(--erp-sel-brand-light);
    color: var(--erp-sel-brand-dark);
    font-weight: 600;
}

#erp-table .select2-container--default .select2-selection--single,
#erp-table .select2-container--bootstrap-5 .select2-selection--single {
    min-height: 34px;
}

#erp-table .select2-container--default .select2-selection--single .select2-selection__rendered,
#erp-table .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    font-size: 0.75rem;
    line-height: 32px;
    padding-left: 6px;
}

/* ── Dark mode ── */
html[data-theme="dark"] {
    --erp-sel-bg: #0f172a;
    --erp-sel-border: #475569;
    --erp-sel-text: #e2e8f0;
    --erp-sel-muted: #94a3b8;
    --erp-sel-brand-light: rgba(47, 109, 147, 0.28);
    --erp-sel-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .nice-select,
html[data-theme="dark"] div.nice-select,
html[data-theme="dark"] .nice-select.form-select {
    background-color: var(--erp-sel-bg) !important;
    border-color: var(--erp-sel-border) !important;
    color: var(--erp-sel-text) !important;
}

html[data-theme="dark"] .nice-select .current {
    color: var(--erp-sel-text) !important;
}

html[data-theme="dark"] .nice-select .list {
    background: #1e293b;
    border-color: #475569;
}

html[data-theme="dark"] .nice-select .option {
    color: #cbd5e1;
}

html[data-theme="dark"] .nice-select .option.selected {
    background: rgba(47, 109, 147, 0.35);
    color: #7dd3fc;
}

html[data-theme="dark"] .select2-container--default .select2-selection--single,
html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single {
    background: var(--erp-sel-bg) !important;
    border-color: var(--erp-sel-border) !important;
}

html[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[data-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: var(--erp-sel-text);
}

html[data-theme="dark"] .select2-dropdown {
    background: #1e293b;
    border-color: #475569;
}

html[data-theme="dark"] .select2-container--default .select2-results__option,
html[data-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: #cbd5e1;
}

html[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field,
html[data-theme="dark"] .select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    background: #0f172a;
    border-color: #475569;
    color: #e2e8f0;
}

html[data-theme="dark"] select.form-select,
html[data-theme="dark"] select.form-control:not([multiple]):not([size]),
html[data-theme="dark"] select.glass-type-row-select {
    background-color: var(--erp-sel-bg);
    border-color: var(--erp-sel-border);
    color: var(--erp-sel-text);
}
