/**
 * Select2 Custom Styles — copied verbatim từ EPL prod
 *   https://fpt.vn/frontend_layout_2025_vibecode/assets/css/select2-custom.css?v=v1.45.01
 * (file local trong source EPL clone bị stale — thiếu 67 dòng)
 *
 * Flatsome injection: theme set rules `.select-resize-ghost, .select2-container
 * .select2-selection, select { background-image: <svg arrow>; box-shadow: ...;
 * padding-right: 1.4em }` ở specificity (0,2,0). Khi cộng dồn với chevron
 * native của Select2 (.select2-selection__arrow > b) → 2 mũi tên.
 * Reset bên dưới scope trong .location-form-group để chỉ neutralize
 * trong modal, không leak.
 */

/* ─── Flatsome reset trong modal scope ──────────────────────────────── */
.location-form-group .select2-container .select2-selection,
.location-form-group select {
    background-image: none;
    box-shadow: none;
    padding-right: 0;
}

/* Flatsome `li { margin-bottom: .6em }` đè vào option list (option = <li>).
 * Dropdown render ở body scope (dropdownParent: #locationModalOverlay) nên
 * không thể scope qua .location-form-group → target trực tiếp class Select2. */
.select2-container--default .select2-results__option {
    margin: 0;
}


/* Select2 Container */
.location-form-group .select2-container {
    width: 100% !important;
}

/* Select2 Selection (Main input area) */
.location-form-group .select2-container--default .select2-selection--single {
    height: auto;
    padding: 14px 40px 14px 16px;
    font-size: 15px;
    color: #1A1A1A;
    border: 1px solid #E7E7E7;
    border-radius: 8px;
    background-color: #FFFFFF;
    transition: all 0.2s ease;
}

/* Remove default arrow */
.location-form-group .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 12px;
    top: 0;
}

.location-form-group .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;
    width: 16px;
    height: 16px;
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Rendered text */
.location-form-group .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: normal;
    color: #1A1A1A;
}

/* Placeholder text */
.location-form-group .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999999;
}

/* Hover state */
.location-form-group .select2-container--default .select2-selection--single:hover {
    border-color: #CCCCCC;
}

/* Focus state */
.location-form-group .select2-container--default.select2-container--focus .select2-selection--single,
.location-form-group .select2-container--default.select2-container--open .select2-selection--single {
    outline: none;
    border-color: #4F75FB;
    box-shadow: 0 0 0 3px rgba(79, 117, 251, 0.1);
}

/* Keep border radius when dropdown is open below */
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Dropdown below - remove top border and keep top radius */
.select2-container--open .select2-dropdown--below {
    border-top: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid #E7E7E7;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    margin-top: 4px;
    /* Clip option hover/selected backgrounds to dropdown's rounded corners
     * — fix Select2 default UL overflow tràn cạnh vuông ra ngoài border. */
    overflow: hidden;
}

/* Search field */
.select2-container--default .select2-search--dropdown .select2-search__field {
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #E7E7E7;
    border-radius: 6px;
    outline: none;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #4F75FB;
}

/* Dropdown options */
.select2-container--default .select2-results__option {
    padding: 12px 16px;
    font-size: 15px;
    color: #1A1A1A;
}

/* Hover option */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #F5F7FF;
    color: #1A1A1A;
}

/* Selected option */
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #4F75FB;
    color: #FFFFFF;
}

/* Disabled select */
.location-form-group .select2-container--disabled .select2-selection--single {
    background-color: #F5F5F5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loading state */
.location-form-group .select2-container.select2-loading .select2-selection--single {
    position: relative;
    padding-right: 60px;
}

.location-form-group .select2-container.select2-loading .select2-selection--single::after {
    content: '';
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #E7E7E7;
    border-top: 2px solid #4F75FB;
    border-radius: 50%;
    animation: select2-spin 0.8s linear infinite;
}

@keyframes select2-spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Province option with 2 rows (Name + Description) */
.select2-province-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.select2-province-option .province-name {
    font-weight: 600;
    color: #1A1A1A;
    font-size: 15px;
    line-height: 1.4;
}

.select2-province-option .province-desc {
    font-size: 13px;
    color: #888888;
    line-height: 1.3;
}

/* Adjust padding for 2-row options */
.select2-container--default .select2-results__option:has(.select2-province-option) {
    padding: 10px 16px;
}

/* Selected state */
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #E7E7E7;
    color: #1A1A1A;
}

.select2-container--default .select2-results__option[aria-selected=true] .province-name {
    color: #1A1A1A;
}

.select2-container--default .select2-results__option[aria-selected=true] .province-desc {
    color: #666666;
}

/* Hover state */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #E7E7E7;
    color: #1A1A1A;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] .province-name {
    color: #1A1A1A;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] .province-desc {
    color: #666666;
}

.select2-container--default .select2-selection--single .select2-selection__clear{
    height: auto;
    margin-right: unset;
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .location-form-group .select2-container--default .select2-selection--single {
        padding: 12px 36px 12px 14px;
        font-size: 14px;
    }

    .select2-container--default .select2-results__option {
        padding: 10px 14px;
        font-size: 14px;
    }

    .select2-province-option .province-name {
        font-size: 14px;
    }

    .select2-province-option .province-desc {
        font-size: 12px;
    }
}
