/* Fix specifici per dropdown su dispositivi mobili (Android + iOS) */

/* Assicura che il dropdown sia sempre visibile sopra altri elementi */
.chosen-container.chosen-with-drop .chosen-drop {
    z-index: 9999 !important;
    left: 0 !important;
    position: fixed !important;
}

/* Fix per il touch scrolling su Android */
.chosen-container {
    -webkit-touch-callout: auto !important;
    touch-action: auto !important;
}

.chosen-container .chosen-drop {
    touch-action: auto !important;
    -webkit-touch-callout: auto !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.chosen-container .chosen-results {
    -webkit-overflow-scrolling: touch !important;
    touch-action: manipulation !important;
}

/* Miglioramenti per la selezione su mobile */
.chosen-container .chosen-results li {
    min-height: 44px !important;
    padding: 10px 6px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.chosen-container .chosen-results li:active,
.chosen-container .chosen-results li:hover {
    background-color: #3875d7 !important;
    color: #fff !important;
}

/* Fix per il dropdown singolo */
.chosen-container-single .chosen-single {
    height: auto !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    touch-action: manipulation !important;
}

.chosen-container-single .chosen-single span {
    display: block !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Fix per i choice multipli su mobile */
.chosen-container-multi .chosen-choices {
    min-height: 44px !important;
    touch-action: manipulation !important;
}

.chosen-container-multi .chosen-choices li.search-field {
    width: 100% !important;
}

.chosen-container-multi .chosen-choices li.search-choice {
    min-height: 32px !important;
    padding: 8px 25px 8px 8px !important;
    font-size: 14px !important;
}

/* Evita il doppio tap delay su mobile */
.chosen-container a,
.chosen-container button {
    -webkit-touch-callout: none !important;
}

/* Fix per keyboard mobile */
@media only screen and (max-width: 768px) {
    .chosen-container .chosen-drop {
        position: fixed !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .chosen-container .chosen-results {
        max-height: calc(50vh - 60px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .chosen-container-single .chosen-single {
        box-sizing: border-box !important;
    }

    /* Assicura che il dropdown sia accessibile */
    .chosen-container.chosen-with-drop {
        z-index: 9999 !important;
    }
}

/* Fix specifico per Android < 5.0 */
@supports (-webkit-appearance:none) {
    .chosen-container .chosen-results {
        -webkit-user-select: none !important;
        user-select: none !important;
        -webkit-touch-callout: none !important;
    }
}

/* Previeni il 300ms tap delay */
button,
input,
select,
textarea,
.chosen-container,
.chosen-single {
    touch-action: manipulation !important;
}