/* ==========================================================================
   TRINAI SAAS - CUSTOM DROPDOWN SELECT COMPONENT
   Sostituto grafico moderno e accessibile per <select> native.
   Previene il rendering scuro/traslucido di macOS e assicura
   un'estetica coordinata bianco/slate in tutta l'applicazione.
   ========================================================================== */

.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: inherit;
}

.custom-dropdown-trigger {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.custom-dropdown-trigger:hover {
    border-color: #cbd5e1;
    background-color: #ffffff;
}

.custom-dropdown.is-open .custom-dropdown-trigger,
.custom-dropdown-trigger:focus {
    outline: none;
    border-color: #0f172a;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.custom-dropdown-trigger.has-error {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.custom-dropdown-selected {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    color: #0f172a;
}

.custom-dropdown-selected.is-placeholder {
    color: #94a3b8;
}

.custom-dropdown-arrow {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.custom-dropdown.is-open .custom-dropdown-arrow {
    transform: rotate(180deg);
    color: #0f172a;
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
    z-index: 1050;
    max-height: 280px;
    overflow-y: auto;
    display: none;
    animation: customDropdownFadeIn 0.15s ease-out forwards;
    padding: 4px 0;
    box-sizing: border-box;
}

@keyframes customDropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-dropdown.is-open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-group-label {
    padding: 8px 14px 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    background-color: #f8fafc;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    user-select: none;
}

.custom-dropdown-group-label:first-child {
    border-top: none;
}

.custom-dropdown-item {
    padding: 10px 14px;
    font-size: 13.5px;
    color: #0f172a;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    border-bottom: 1px solid #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    user-select: none;
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.custom-dropdown-item.is-selected {
    background-color: #f8fafc;
    font-weight: 600;
    color: #0f172a;
}

.custom-dropdown-item.is-selected .item-check {
    opacity: 1;
    color: #0f172a;
}

.custom-dropdown-item .item-check {
    opacity: 0;
    font-size: 12px;
    color: transparent;
    transition: opacity 0.12s ease;
}

.custom-dropdown-item.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: transparent !important;
}

/* Custom Scrollbar for Dropdown Menu */
.custom-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background-color: #f8fafc;
}
