/* Estilos personalizados para Select2 */

/* Placeholder styling for type_operation and location selects */
#type_operation ~ .select2-container .select2-selection--multiple .select2-selection__placeholder,
#location ~ .select2-container .select2-selection--multiple .select2-selection__placeholder,
#country ~ .select2-container .select2-selection--multiple .select2-selection__placeholder {
    font-size: 20px !important;
    color: #999 !important;
    opacity: 1 !important;
    display: block !important;
}

.col-lg {
    min-width: 200px; /* Ajusta este valor según necesites */
    flex: 1 1 200px; /* Flex grow, flex shrink, flex basis */
}

/* Overlay específico para tipo de operación cuando está vacío */
#type_operation ~ .select2-container .select2-selection--multiple.empty::before {
    content: "Operación";
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Overlay para tipo de propiedad cuando está vacío */
#type_property ~ .select2-container .select2-selection--multiple.empty::before {
    content: "Tipo de Propiedad";
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Mostrar placeholder cuando no hay selección */
#location ~ .select2-container .select2-selection--multiple::before {
    content: "Ubicación" !important;
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Mostrar placeholder cuando no hay selección */
#location ~ .select2-container .select2-selection--multiple::before {
    content: "Ubicación" !important;
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Ocultar placeholder cuando hay selección */
#location ~ .select2-container .select2-selection--multiple.has-selection::before {
    display: none !important;
}

/* Overlay para país cuando está vacío */
#country + .select2-container .select2-selection--multiple.empty::before {
    content: "País";
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

/* Ocultar el placeholder original cuando hay overlay personalizado */
#type_operation ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder,
#type_property ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder,
#location ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder,
#country ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder {
    display: none !important;
}

#type_operation ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder,
#type_property ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder,
#location ~ .select2-container .select2-selection--multiple.empty .select2-selection__placeholder {
    display: none !important;
}

/* Margen superior solo para los filtros principales */
#type_operation + .select2-container,
#type_property + .select2-container,
#location + .select2-container,
#country ~ .select2-container {
    margin-top: 3px;
}

/* Ajustes para el ícono en el select de tipo de propiedad */
.form-group {
    position: relative;
}

/* Estilos para los íconos de los selects */
.form-group .select2-custom-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    display: flex;
    align-items: center;
    color: #aaa;
    font-size: 16px;
    width: 16px;
    pointer-events: none;
    z-index: 12;
}

.select2-container--default .select2-selection--multiple {
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    min-height: 46px;
    height: 46px !important;
    padding: 8px 10px 5px 35px !important;
    background-color: #fff;
    line-height: 1.2;
    /* NO pongas overflow-x aquí, solo en __rendered */
    display: flex;
    /* flex-wrap: wrap; */
    align-items: center !important;
    justify-content: flex-start;
    position: relative;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE y Edge */
}

.select2-container--default .select2-selection--multiple::-webkit-scrollbar {
    display: none; /* Chrome, Safari y Opera */
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #999;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    border: none !important;
    box-shadow: none !important;
    background-color: #f5f5f5;
    border-radius: 3px;
    padding: 0 10px 0 22px !important;
    margin-right: 5px;
    margin-bottom: 0 !important;
    margin-top: -2px !important;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    display: flex !important;
    align-items: center !important;
    min-height: 32px !important;
    line-height: 1 !important;
    position: relative;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #333;
}


.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #999;
    margin-right: 5px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #333;
}

.select2-container--default .select2-search--inline .select2-search__field {
    font-size: 20px !important;
    margin-top: 0;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #f6f6f6;
    color: #333;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #f0f0f0;
    color: #333;
}

.select2-dropdown {
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    box-shadow: 0 0 0 1px rgba(68,68,68,.11);
}

/* Estilos para el contenedor del select */
.select2-container {
    width: 100% !important;
    outline: none !important;
    position: relative;
    font-size: 16px !important;
}

/* Estilos para el icono de la flecha */
.select2-container--default .select2-selection--multiple:after {
    content: "\f078";
    font-family: 'Font Awesome 6 Pro';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-55%);
    pointer-events: none;
    color: #999;
    font-size: 16px;
    z-index: 20;
    background: #fff;
    padding: 0 4px;
    border-radius: 3px;
    height: 24px;
    line-height: 24px;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 0 44px 5px 0 !important; /* más espacio para la flecha */
}

/* Forzar el dropdown siempre hacia abajo, incluso si Select2 agrega --above */
.select2-container--open .select2-dropdown {
    top: 100% !important;
    bottom: auto !important;
}
.select2-container--above .select2-dropdown {
    top: 100% !important;
    bottom: auto !important;
}

/* Ajuste para el placeholder */
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
    position: absolute !important;
    left: 35px !important;
    top: 0 !important;
    right: 15px !important;
    width: auto !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    pointer-events: none !important;
    background: transparent !important;
    z-index: 2 !important;
    font-size: 20px !important;
    line-height: 40px !important;
    color: #999 !important;
    align-self: flex-start !important;
}


/* --- Fix chips Select2: scroll horizontal y sin recorte de texto --- */

/* Floating label styles for Select2 */
.floating-label {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    z-index: 10;
    background: #fff;
    padding: 0 4px;
    font-size: 20px;
    line-height: 1.2;
}

/* Desactivado: no hay efecto flotante ni cambio de posición/tamaño */
.floating-label.active,
.floating-label-group .select2-container--focus ~ .floating-label,
.floating-label-group .select2-container--open ~ .floating-label {
    top: 50%;
    left: 35px;
    font-size: 16px;
    color: #aaa;
    background: #fff;
    padding: 0 4px;
    z-index: 10;
    transform: translateY(-50%);
}

/* Oculta el placeholder si hay al menos un chip seleccionado */
.select2-container--default .select2-selection--multiple .select2-selection__rendered:not(:empty) + .select2-selection__placeholder {
    display: none !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered:not(:empty) {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important; /* SIEMPRE mostrar barra si hay overflow */
    white-space: nowrap !important;
    width: 100%;
    align-items: center;
    padding: 0 36px 5px 0 !important; /* Deja espacio a la derecha para el caret */
    line-height: 1.5;
    margin-left: 0 !important;
    scrollbar-width: thin; /* Firefox: barra fina siempre visible */
}

/* Gradiente y flechita cuando hay overflow horizontal */
.select2-container--default .select2-selection--multiple.has-overflow::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 36px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255,255,255,0), #fff 80%);
    z-index: 2;
    display: block;
}


/* Asegurar que el contenedor de chips tenga position: relative */
.select2-container--default .select2-selection--multiple {
    position: relative;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    max-width: none !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    border: none !important;
    box-shadow: none !important;
    background-color: #f5f5f5;
    border-radius: 12px;
    padding: 0 10px 0 22px !important;
    margin-right: 5px;
    margin-bottom: 0 !important;
    margin-top: -2px !important;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
    display: flex !important;
    align-items: center !important;
    min-height: 32px !important;
    line-height: 1 !important;
    position: relative;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #333;
}

/* Estilos para el campo de búsqueda dentro del select */
.select2-container--default .select2-selection--multiple .select2-search--inline {
    margin: 0;
    float: left;
    line-height: 1.2;
}

.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    margin: 0 0 0 5px;
    padding-top: 1.9px;
    line-height: 1.2;
    width: 100% !important;
    color: #495057;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 14px;
    height: 24px;
}

/* Ocultar el campo de búsqueda en el input principal para todos los selects con búsqueda */
#type_operation ~ .select2-container .select2-selection--multiple .select2-search--inline,
#type_property ~ .select2-container .select2-selection--multiple .select2-search--inline,
#location ~ .select2-container .select2-selection--multiple .select2-search--inline,
#country ~ .select2-container .select2-selection--multiple .select2-search--inline {
    display: none !important;
}

/* Forzar que aparezca el campo de búsqueda en el dropdown */
.select2-dropdown-with-search .select2-search--dropdown {
    display: block !important;
    padding: 8px !important;
    border-bottom: 1px solid #ddd !important;
}

.select2-dropdown-with-search .select2-search--dropdown .select2-search__field {
    width: 100% !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    background: white !important;
    box-sizing: border-box !important;
}

.select2-dropdown-with-search .select2-search--dropdown .select2-search__field:focus {
    outline: none !important;
    border-color: #999 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

/* Asegurar que el campo de búsqueda aparezca en el dropdown */
.select2-container--open .select2-dropdown .select2-search--dropdown {
    display: block !important;
    padding: 8px;
}

.select2-container--open .select2-dropdown .select2-search--dropdown .select2-search__field {
    width: 100% !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    background: white !important;
}

.select2-container--open .select2-dropdown .select2-search--dropdown .select2-search__field:focus {
    outline: none !important;
    border-color: #999 !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

.select2-search__field:focus {
    outline: none !important;
    box-shadow: none !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice{
    padding: 0px 6px 0px 18px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display{
    font-size: 14px;
    line-height: 28px;
}


/* Ajuste SOLO para selects de offices */
.select2-offices ~ .select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin-top: 1px !important;
    margin-bottom: 1px !important;
    /* Ajusta el valor si es necesario */
}

/* Estilo para el hover en las opciones */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #f6f6f6;
    color: #333;
}

ul.select2-selection__rendered:empty {
    display: none !important
}
