/* 1. El contenedor padre ahora controla la posición en la pantalla */
#back-top {
    position: fixed;
    right: 30px;
    bottom: 20px;
    z-index: 99999;
    display: flex;
    align-items: center;
}

/* 2. El diseño del botón verde */
#back-top>a {
    background-color: #25D366;
    color: #fff !important;
    height: 70px;
    width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
}

#back-top>a i {
    font-size: 45px !important;
}

#back-top>a:hover {
    background-color: #1ebe57;
    transform: scale(1.1);
    color: #fff !important;
}

/* 3. El diseño del Globo de Mensaje (Tooltip) */
.whatsapp-tooltip {
    position: absolute;
    right: 75px;
    background-color: #fff;
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    white-space: nowrap;

    opacity: 0;
    visibility: hidden;
    transform: translateX(15px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #fff;
}

#back-top:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}


/* >>> ============================================== */
/* >>>              INICIO MULTISELECT                */
/* >>> ============================================== */

/* 1. MATA EL BLOQUEO DE ALTURA DE BOOTSTRAP (form-control y form-select) */
span.select2.select2-container.form-select,
span.select2.select2-container.form-control {
    height: auto !important;
    min-height: 42px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    background-image: none !important;
    /* Quita la flechita nativa del select de Bootstrap */
}

/* 2. LA CAJA GRIS REAL (Donde está el borde) */
.select2-container--default .select2-selection--multiple {
    display: block !important;
    height: auto !important;
    min-height: 42px !important;
    padding: 4px 6px !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    background-color: #fff !important;
    overflow: hidden !important;
    /* CRÍTICO: Fuerza a la caja gris a envolver absolutamente todo su contenido */
}

/* 3. EL CONTENEDOR INTERNO UL (Flexbox) */
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 0 2px 0 !important;
    /* Respiro en la parte inferior para que el textarea no choque */
    gap: 6px !important;
    list-style: none !important;
}

/* 4. LAS ETIQUETAS (Pastillas) */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    margin: 0 !important;
    padding: 3px 8px !important;
    display: inline-flex !important;
    flex-direction: row-reverse !important;
    /* MAGIA: Mueve la "x" a la derecha */
    align-items: center !important;
    background-color: #f0f2f5 !important;
    /* Fondo gris claro limpio */
    border: 1px solid #ced4da !important;
    border-radius: 4px !important;
    gap: 12px !important;
    /* Espacio perfecto entre el nombre y la X */
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    color: #495057 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: relative !important;
    color: #6c757d !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    font-weight: bold !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #dc3545 !important;
    background: transparent !important;
}

/* 4.3 Ocultar iconos rotos o pseudo-elementos fantasma de la plantilla */
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove::before,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove::after,
.select2-container--default .select2-selection--multiple .select2-selection__choice__display::before,
.select2-container--default .select2-selection--multiple .select2-selection__choice__display::after {
    display: none !important;
}

/* 5. EL ESPACIO DEL TEXTAREA */
.select2-container--default .select2-selection--multiple .select2-search--inline {
    display: inline-flex !important;
    flex: 1 1 10px !important;
    height: 26px !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    align-items: center !important;
}

/* 6. EL TEXTAREA (CURSOR) */
.select2-container--default .select2-selection--multiple .select2-search__field,
.modal .select2-search__field {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 24px !important;
    line-height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    color: #495057 !important;
    -webkit-text-fill-color: #495057 !important;
    caret-color: #000 !important;
    resize: none !important;
    text-align: left !important;
    direction: ltr !important;
    box-shadow: none !important;
}

/* 7. PLACEHOLDER */
.select2-container--default .select2-selection--multiple .select2-search__field::placeholder {
    color: #adb5bd !important;
    -webkit-text-fill-color: #adb5bd !important;
    text-align: left !important;

}

/* 8. Borde de la caja de búsqueda SOLO afectará al modal de Plazas */
#modalPlaza .select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da !important;
    border-radius: 5px !important;
    padding: 6px 10px !important;
    background-color: #fdfdfd !important;
}

/* 9. Efecto Focus SOLO afectará al modal de Plazas */
#modalPlaza .select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #17c653 !important;
    box-shadow: 0 0 0 0.25rem rgba(23, 198, 83, 0.25) !important;
    outline: none !important;
}

/* 10. Engrosar la caja principal SOLO dentro de las tablas de partidas */
#tab_logic .select2-container--bootstrap-5 .select2-selection--single,
#tab_logic_edit .select2-container--bootstrap-5 .select2-selection--single {
    min-height: 42px !important; 
    padding: 4px 12px !important;
    border: 1px solid #ced4da !important;
    border-radius: 5px !important;
}

/* 11. Centrar verticalmente el texto y EVITAR QUE TAPE LA FLECHA (Puntos suspensivos) */
#tab_logic .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered,
#tab_logic_edit .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    color: #495057 !important;
    padding-right: 35px !important; /* 👈 Muro de contención para proteger la flecha */
    text-overflow: ellipsis !important; /* 👈 Agrega los ... al final */
    white-space: nowrap !important; /* 👈 Impide que la tabla se haga gruesa */
    overflow: hidden !important;
    display: block !important;
}

/* 12. Centrar verticalmente la flecha de la derecha */
#tab_logic .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow,
#tab_logic_edit .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    top: 0 !important;
}

/* 13. Forzar borde gris en el cuadro de búsqueda EXCLUSIVAMENTE dentro del modal de edición */
#modalEditarCotizacion .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da !important;
    border-radius: 5px !important;
    padding: 6px 12px !important;
    background-color: #ffffff !important;
}
#modalEditarCotizacion .select2-search--dropdown .select2-search__field:focus {
    border-color: #86b7fe !important;
    outline: 0 !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* 14. Listado Multilínea: Permitir leer todo el texto en las opciones al desplegar */
.select2-container--bootstrap-5 .select2-dropdown .select2-results__option {
    white-space: normal !important;
    word-wrap: break-word !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    line-height: 1.4 !important;
}