﻿@layer modern {
/* ==========================================================================
   SpeedyBook Modern Select2 Dropdowns Overrides
   ========================================================================== */

html body .select2-container {
    width: 100%; /* Prevent Select2 from squishing in flex layouts like 'Услуги и цены' */
}

/* Base Select2 Selection styling */
html body .select2-container--default .select2-selection--single,
html body .select2-container--default .select2-selection--multiple {
    border: 1px solid var(--sb-border, #dfe6e9);
    border-radius: var(--sb-radius, 12px);
    min-height: 42px;
    background-color: var(--sb-white, #ffffff);
    background-image: none !important; /* Prevent double arrows from style.css */
    box-shadow: none;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

html body .select2-container--default .select2-selection--single {
    position: relative !important;
}

/* Selection Hover State */
html body .select2-container--default .select2-selection--single:hover,
html body .select2-container--default .select2-selection--multiple:hover {
    border-color: var(--sb-border-hover, #cbd5e1);
}

/* Focus and Open State styling */
html body .select2-container--default.select2-container--open .select2-selection--single,
html body .select2-container--default.select2-container--open .select2-selection--multiple,
html body .select2-container--default.select2-container--focus .select2-selection--single,
html body .select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--sb-primary, #2563eb);
    background-color: var(--sb-white, #ffffff);
    box-shadow: 0 0 0 4px var(--sb-primary-soft, rgba(37, 99, 235, 0.1));
    border-radius: var(--sb-radius, 12px); /* Keep rounded when open */
}

/* Centered single text rendering inside input */
html body .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--sb-text-main, #2d3436);
    line-height: 40px; /* 40px + 2px borders = 42px min-height, perfectly centered without clipping */
    padding-left: 14px; /* Align with standard text inputs (14px) */
    padding-right: 40px;
    font-size: 15px;
    font-family: inherit;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Single custom vector arrow icon positioning */
html body .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    height: 100% !important;
    width: 40px !important;
    background-image: var(--sb-dropdown-arrow) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px !important;
}

/* RTL Support for Select2 Arrow and Rendered padding */
html body[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    right: auto !important;
    left: 0 !important;
}

html body[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 40px !important;
    padding-right: 14px !important;
}

html body .select2-container--default .select2-selection--single .select2-selection__arrow b {
    display: none !important; /* Hide old CSS triangle */
}

/* Select2 Dropdown Menu Popup - Floating Modern Look */
html body .select2-dropdown {
    border: 1px solid var(--sb-border, #dfe6e9);
    border-radius: var(--sb-radius, 12px);
    box-shadow: var(--sb-shadow-md, 0 8px 24px rgba(0, 0, 0, 0.12));
    z-index: 9999;
    margin-top: 6px; /* Detach from input */
    padding: 6px 0;
    background-color: var(--sb-white, #ffffff);
}

/* Select2 Search Box Inside Menu */
html body .select2-search--dropdown {
    padding: 8px 12px 12px 12px;
    border-bottom: 1px solid var(--sb-border, #dfe6e9);
}

html body .select2-search--dropdown .select2-search__field {
    border: 1px solid var(--sb-border, #dfe6e9);
    border-radius: 8px;
    padding: 10px 14px;
    outline: none;
    box-shadow: none;
}

html body .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--sb-primary, #2563eb);
    box-shadow: 0 0 0 4px var(--sb-primary-soft, rgba(37, 99, 235, 0.1));
}

/* Select2 List Items */
html body .select2-results__option {
    padding: 11px 16px !important;
    color: var(--sb-text-main, #2d3436) !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    margin: 2px 6px !important;
    transition: all 0.15s ease !important;
}

/* Select2 Hover Highlight (Soft Modern Green) */
html body .select2-container--default .select2-results__option--highlighted[aria-selected],
html body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--sb-primary-soft, rgba(37, 99, 235, 0.1)) !important; /* Soft green hover */
    color: var(--sb-primary, #2563eb) !important; /* Green text */
}

/* Select2 Selected Item (Override old Flynax colors) */
html body .select2-container--default .select2-results__option[aria-selected="true"],
html body .select2-container--default .select2-results__option--selected {
    background-color: var(--sb-bg-soft, #f8f9fa) !important; /* Soft background */
    color: var(--sb-primary, #2563eb) !important; /* Green text */
    font-weight: 500 !important;
}

}