/**
 * Viator Location Picker Styles
 * Estilos para o seletor de localização integrado com TripAdvisor API
 */

.viator-location-picker {
    position: relative;
    width: 100%;
}

.viator-location-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.viator-location-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.viator-location-input.is-loading {
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 11-6.219-8.56"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.viator-location-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
}

.viator-location-suggestions.show {
    display: block;
}

.viator-location-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.viator-location-suggestion:last-child {
    border-bottom: none;
}

.viator-location-suggestion:hover,
.viator-location-suggestion.highlighted {
    background-color: #f8f9fa;
}

.viator-location-suggestion.selected {
    background-color: #007cba;
    color: #fff;
}

.viator-location-suggestion-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.viator-location-suggestion-address {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
}

.viator-location-suggestion.selected .viator-location-suggestion-address {
    color: rgba(255, 255, 255, 0.8);
}

.viator-location-type-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #e9ecef;
    color: #495057;
    font-size: 10px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
    margin-left: 8px;
}

.viator-location-suggestion.selected .viator-location-type-badge {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.viator-location-no-results {
    padding: 16px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.viator-location-error {
    padding: 12px 16px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin-top: 4px;
    font-size: 14px;
}

.viator-location-picker.has-error .viator-location-input {
    border-color: #dc3545;
}

.viator-location-picker.has-error .viator-location-input:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

/* Responsividade */
@media (max-width: 768px) {
    .viator-location-suggestions {
        max-height: 150px;
    }
    
    .viator-location-suggestion {
        padding: 10px 12px;
    }
    
    .viator-location-input {
        padding: 10px 12px;
        font-size: 16px; /* Evita zoom no iOS */
    }
}

/* Estados de validação */
.viator-location-input.is-valid {
    border-color: #28a745;
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20,6 9,17 4,12"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.viator-location-input.is-invalid {
    border-color: #dc3545;
    background-image: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

/* Integração com formulários de booking */
.booking-question-group .viator-location-picker,
.form-group .viator-location-picker {
    margin-top: 4px;
}

.pickup-point-question-group .viator-location-picker {
    margin-top: 8px;
}

/* Acessibilidade */
.viator-location-suggestion:focus {
    outline: 2px solid #007cba;
    outline-offset: -2px;
}

.viator-location-input[aria-expanded="true"] {
    border-radius: 6px 6px 0 0;
}

/* Tema escuro (opcional) */
@media (prefers-color-scheme: dark) {
    .viator-location-input {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .viator-location-suggestions {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .viator-location-suggestion {
        border-bottom-color: #4a5568;
    }
    
    .viator-location-suggestion:hover,
    .viator-location-suggestion.highlighted {
        background-color: #4a5568;
    }
    
    .viator-location-suggestion-address {
        color: #a0aec0;
    }
    
    .viator-location-type-badge {
        background-color: #4a5568;
        color: #e2e8f0;
    }
}
