/**
 * Born to Ride - Tom Select Custom Styles
 * 
 * Stili custom per integrare Tom Select con il design system del plugin.
 * 
 * @package Born_To_Ride_Booking
 * @version 1.0.337
 */

/* Override colori Tom Select per allinearsi al brand (#0097c5) */
.ts-control {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 40px 10px 14px;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    background-color: #fff;
    transition: all 0.3s ease;
    min-height: 44px;
}

.ts-control:hover {
    border-color: #0097c5;
}

.ts-control.focus {
    outline: none;
    border-color: #0097c5;
    box-shadow: 0 0 0 3px rgba(0, 151, 197, 0.1);
}

.ts-control.single .ts-control-input {
    padding: 0;
}

.ts-control.single .ts-control-input input {
    color: #333;
    font-size: 15px;
    line-height: 1.5;
}

/* Placeholder styling */
.ts-control.single .ts-control-input input::placeholder {
    color: #999;
}

/* Dropdown styling - Allineato al design system del plugin */
.ts-dropdown {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    margin-top: 8px;
    z-index: 99999;
    background: #ffffff;
    overflow: hidden;
    max-height: 400px;
}

/* Search input nel dropdown - Stile coerente */
.ts-dropdown .ts-input {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ts-dropdown .ts-input input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 40px 10px 14px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.2s ease;
    width: 100%;
}

.ts-dropdown .ts-input input:focus {
    border-color: #0097c5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 151, 197, 0.1);
}

/* Option styling - Allineato al design system del plugin */
.ts-dropdown .ts-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.2s ease;
    color: #333;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
}

.ts-dropdown .ts-option:last-child {
    border-bottom: none;
}

/* Hover state - più visibile */
.ts-dropdown .ts-option:hover {
    background-color: #f0f8ff;
    color: #0097c5;
    border-left: 3px solid #0097c5;
    padding-left: 13px; /* Compensa per il bordo */
}

/* Active state (opzione evidenziata con tastiera) - più prominente */
.ts-dropdown .ts-option.active {
    background-color: #e6f7ff;
    color: #0097c5;
    font-weight: 500;
    border-left: 3px solid #0097c5;
    padding-left: 13px;
    box-shadow: inset 0 0 0 1px rgba(0, 151, 197, 0.1);
}

/* Selected state (opzione già selezionata) - distintivo ma non invadente */
.ts-dropdown .ts-option.selected {
    background-color: #f9fafb;
    color: #006d8f;
    font-weight: 500;
    border-left: 2px solid #0097c5;
    padding-left: 14px;
}

/* Combinazione active + selected */
.ts-dropdown .ts-option.active.selected {
    background-color: #e6f7ff;
    color: #0097c5;
    border-left: 3px solid #0097c5;
    padding-left: 13px;
}

/* Miglioramento visivo per opzioni con focus */
.ts-dropdown .ts-option:focus {
    outline: 2px solid #0097c5;
    outline-offset: -2px;
}

/* No results message - Stile migliorato */
.ts-dropdown .no-results {
    padding: 20px 16px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
    font-style: italic;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

/* Icona dropdown (freccia) - Migliorata */
.ts-control.single::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #6b7280;
    pointer-events: none;
    transition: transform 0.3s ease, border-top-color 0.3s ease;
}

.ts-control.single:hover::after {
    border-top-color: #0097c5;
}

.ts-control.single.focus::after {
    transform: translateY(-50%) rotate(180deg);
    border-top-color: #0097c5;
}

/* Loading state */
.ts-control.loading::before {
    border-top-color: #0097c5;
}

/* Responsive: mobile */
@media (max-width: 480px) {
    .ts-control {
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    .ts-dropdown {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        max-height: 70vh;
    }
}

/* Integrazione con form fields */
.btr-field-group .ts-control {
    width: 100%;
}

.btr-field-group.has-error .ts-control {
    border-color: #dc3545;
}

.btr-field-group.has-error .ts-control.focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Compatibilità con layout grid */
.btr-grid .ts-control {
    width: 100%;
}

.btr-grid .ts-dropdown {
    z-index: 99999 !important;
}

