/* ===== MODALITÀ DI PARTECIPAZIONE AFFIANCATE ===== */
.travel-options-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.travel-options-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.travel-type-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 20px;
}

@media (max-width: 1000px) {
    .travel-type-selector {
        grid-template-columns: repeat(2, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 600px) {
    .travel-type-selector {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .radio-group {
        min-width: auto;
        padding: 20px;
    }
}

.radio-group {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    min-height: 140px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.radio-group:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
}

.radio-group input[type="radio"] {
    display: none;
}

.radio-group label {
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 15px;
    color: #333;
    transition: all 0.3s ease;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.radio-group input[type="radio"]:checked + label {
    color: #007bff;
    font-weight: 600;
}

.radio-group input[type="radio"]:checked ~ .price-indicator {
    color: #007bff;
    font-weight: 600;
}

.radio-group:has(input:checked) {
    border-color: #007bff;
    background: linear-gradient(135deg, #f0f8ff 0%, #e8f4fd 100%);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.2);
}

.radio-group .price-indicator {
    font-size: 1.2em;
    font-weight: 600;
    color: #007bff;
    transition: all 0.3s ease;
}

/* ===== SELEZIONE TRENI DINAMICA ===== */
#train-selection-section {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
}

#train-selection-section h3,
#train-selection-section h4 {
    color: #333;
    margin-bottom: 15px;
}

.train-selector {
    margin-bottom: 20px;
}

.train-options {
    display: grid;
    gap: 10px;
}

.train-options .loading,
.train-options .error,
.train-options .no-trains {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.train-options .error {
    color: #dc3545;
    background-color: #f8d7da;
    border-radius: 5px;
}

/* ===== VALIDAZIONE TELEFONO ===== */
.field-group input.invalid {
    border: 2px solid #dc3545;
    background-color: #fff5f5;
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.3);
}

.field-group input.valid {
    border: 2px solid #28a745;
    background-color: #f8fff8;
    box-shadow: 0 0 5px rgba(40, 167, 69, 0.3);
}

.phone-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    font-style: italic;
}

.phone-success {
    color: #28a745;
    font-size: 12px;
    margin-top: 5px;
    display: block;
    font-style: italic;
}

.train-option {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.train-option:hover {
    border-color: #007bff;
    box-shadow: 0 2px 5px rgba(0, 123, 255, 0.2);
}

.train-option.selected {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.train-option.selected .train-info .train-name {
    color: #007bff;
}

.train-info .train-name {
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.train-info .train-times {
    color: #666;
    margin-bottom: 8px;
    font-size: 14px;
}

.train-info .train-availability .availability-count {
    font-weight: bold;
    color: #28a745;
}

.train-info .train-availability .availability-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    margin-top: 5px;
    overflow: hidden;
}

.train-info .train-availability .availability-bar .availability-fill {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
}

/* ===== MODAL OTP ===== */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal-content .close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.modal-content .close:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content #otp-code {
    text-align: center;
    font-size: 24px;
    letter-spacing: 5px;
    font-family: monospace;
    padding: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.modal-content .otp-actions {
    display: flex;
    gap: 10px;
}

.modal-content .otp-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

/* ===== ACCOMPAGNATORI ===== */
.companions-section {
    margin: 20px 0;
}

.companions-section h3 {
    color: #333;
    margin-bottom: 15px;
}

#add-companion {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
}

#add-companion:hover {
    background-color: #218838;
}

.companion-card {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
}

.companion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.companion-header h4 {
    margin: 0;
    color: #333;
}

.remove-companion {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.remove-companion:hover {
    background-color: #c82333;
}

/* ===== PREZZO TOTALE ===== */
.price-summary {
    margin: 20px 0;
    padding: 20px;
    border: 2px solid #007bff;
    border-radius: 10px;
    background-color: #e3f2fd;
    text-align: center;
}

.price-summary .total-price {
    font-size: 24px;
    color: #007bff;
}

.price-summary .total-price strong {
    display: block;
}

.price-summary .total-price strong #total-price {
    font-size: 28px;
    color: #0056b3;
}

/* ===== AVVISO NON RIMBORSABILE ===== */
.non-refundable-notice {
    margin-top: 15px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ff9800;
    border-radius: 8px;
    text-align: center;
    color: #856404;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
}

.non-refundable-notice i {
    margin-right: 8px;
    color: #ff9800;
    font-size: 18px;
    vertical-align: middle;
}

.non-refundable-notice strong {
    font-weight: 700;
}

@media (max-width: 768px) {
    .non-refundable-notice {
        font-size: 14px;
        padding: 12px 15px;
    }
}

/* ===== ALERT RITORNO AUTONOMO ===== */
.return-booking-alert {
    margin-top: 20px;
    padding: 20px;
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
}

.return-booking-alert h4 {
    color: #0c5460;
    margin-bottom: 15px;
}

.return-booking-alert p {
    margin-bottom: 15px;
    color: #0c5460;
}

/* ===== STILI ACCOMPAGNATORI ===== */
.companion-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #f9f9f9;
}

.companion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.companion-header h4 {
    margin: 0;
    color: #333;
}

.remove-companion {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.companion-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.companion-row-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.companion-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.companion-travel-options {
    margin: 15px 0;
}

.companion-travel-options h5 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

/* Utente principale - box affiancati */
.main-travel-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

/* Accompagnatori - box affiancati come il principale */
.companion-travel-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

.radio-group-small {
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    font-size: 12px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.radio-group-small input[type="radio"] {
    display: none;
}

.radio-group-small:has(input:checked) {
    border-color: #007bff;
    background: #e8f4fd;
    color: #007bff;
    font-weight: 600;
}

/* Fallback per browser che non supportano :has() */
.radio-group-small.selected {
    border-color: #007bff;
    background: #e8f4fd;
    color: #007bff;
    font-weight: 600;
}

.radio-group-small label {
    cursor: pointer;
    font-weight: 500;
    margin: 0;
    display: block;
    width: 100%;
    font-size: 11px;
}

.companion-price {
    margin-top: 15px;
    text-align: right;
    font-weight: bold;
    color: #007bff;
}

/* Migliora dimensione campi input e select */
.companion-card .field-group input,
.companion-card .field-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.companion-card .field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.companion-card .field-group {
    width: 100%;
}

/* RESPONSIVE MODALITÀ PARTECIPAZIONE */
@media (max-width: 768px) {
    /* Su mobile tutti i passeggeri hanno i box uno sotto l'altro */
    .main-travel-selector,
    .companion-travel-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* RESPONSIVE ACCOMPAGNATORI */
@media (max-width: 1024px) {
    .companion-row-4 {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .companion-row,
    .companion-row-4,
    .companion-row-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .companion-travel-selector,
    .main-travel-selector {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}

/* ===== SELEZIONE TRENI ACCOMPAGNATORI ===== */
.companion-train-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin-top: 15px;
}

.companion-train-section h5 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.train-selection-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.companion-train-section .field-group {
    width: 100%;
}

.companion-train-section select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.companion-train-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 12px;
}

/* RESPONSIVE TRENI ACCOMPAGNATORI */
@media (max-width: 768px) {
    .train-selection-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}


.loading {
    text-align: center;
    padding: 20px;
    color: #007bff;
    font-style: italic;
}

/* ===== SWEETALERT PERSONALIZZAZIONE ===== */
.swal-passenger-update {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 123, 255, 0.15);
}

.swal-passenger-title {
    color: #495057;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.swal-passenger-content {
    color: #6c757d;
    line-height: 1.5;
}

.swal-passenger-content p {
    margin: 10px 0;
}

.swal2-confirm {
    background: #007bff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.swal2-confirm:hover {
    background: #0056b3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
}

.swal2-cancel {
    background: #6c757d !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.swal2-cancel:hover {
    background: #545b62 !important;
    transform: translateY(-1px);
}

/* ===== SELEZIONE TRENI UTENTE PRINCIPALE ===== */
.main-train-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-top: 20px;
}

.main-train-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.main-train-selection-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.main-train-section .field-group {
    width: 100%;
}

.main-train-section select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    box-sizing: border-box;
}

.main-train-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* RESPONSIVE TRENI UTENTE PRINCIPALE */
@media (max-width: 768px) {
    .main-train-selection-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .main-train-section {
        padding: 15px;
    }
}