/**
 * Google Places Autocomplete Styles
 * Stili per il dropdown autocomplete in stile Bootstrap/Apefacile
 */

/* Container principale */
.gpa-container {
    position: relative;
    width: 100%;
}

/* Input field - mantiene stile Bootstrap form-control */
.gpa-container input[type="text"].form-control {
    width: 100%;
    padding: .375rem 2.25rem .375rem .75rem;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    background-color: #fff;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    line-height: 1.5;
}
.gpa-container input[type="text"].form-control.validated-ape-input {
    background-repeat: no-repeat;background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");background-position: center right 2.25rem;background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);border-width: 2px;border-color: #33aa11 !important; background-color: lightgreen;
}

.gpa-container input[type="text"].form-control:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 94, 168, 0.25);
}

/* Right icons container */
.gpa-right-icons {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
    pointer-events: none;
}

/* Spinner loading */
.gpa-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: #64748b;
    border-radius: 50%;
    animation: gpa-spin 1s linear infinite;
    opacity: 0.7;
}

@keyframes gpa-spin {
    to { 
        transform: rotate(360deg); 
    }
}

/* Clear button */
.gpa-clear-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 16px;
    color: #64748b;
    padding: 0 4px;
    pointer-events: auto;
    transition: color 0.15s ease-in-out;
}

.gpa-clear-btn:hover {
    color: #374151;
}

/* Dropdown */
.gpa-dropdown {
    position: absolute;
    z-index: 50;
    margin-top: 4px;
    width: 100%;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    max-height: 240px;
    overflow: hidden;
}

/* Dropdown list */
.gpa-dropdown-list {
    max-height: 240px;
    overflow: auto;
    padding: 4px 0;
}

/* Dropdown items */
.gpa-item {
    cursor: pointer;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    transition: background-color 0.15s ease-in-out;
}

.gpa-item:hover {
    background: #f9fafb;
}

.gpa-item.active {
    background: #f3f4f6;
}

/* Row content */
.gpa-row {
    display: block;
}

/* Muted text (no results) */
.gpa-muted {
    color: #6b7280;
    font-size: 14px;
    padding: 12px 16px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gpa-container input[type="text"] {
        font-size: 16px; /* Previene zoom su iOS */
    }
    
    .gpa-dropdown {
        max-height: 200px;
    }
    
    .gpa-dropdown-list {
        max-height: 200px;
    }
}

/* Focus states per accessibilità */
.gpa-item:focus {
    outline: 2px solid #005ea8;
    outline-offset: -2px;
}

/* Animazioni smooth */
.gpa-dropdown {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.gpa-dropdown[style*="block"] {
    opacity: 1;
    transform: translateY(0);
}

/* Stili per integrazione con Apefacile */
.gpa-container .form-control {
    border: 1px solid #ced4da;
    border-radius: 6px;
}

.gpa-container .form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(0, 94, 168, 0.25);
}

/* Override per compatibilità con stili esistenti */
.gpa-container input[type="text"].form-control {
    padding-right: 36px; /* Spazio per le icone */
}

/* Stili per stati di errore */
.gpa-container.error input[type="text"] {
    border-color: #dc3545;
}

.gpa-container.error input[type="text"]:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Stili per stati di successo */
.gpa-container.success input[type="text"] {
    border-color: #28a745;
}

.gpa-container.success input[type="text"]:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Validazione positiva */
.gpa-container input.validated-ape {
    border: 2px solid #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Validazione negativa */
.gpa-container input.invalid-ape-select-form {
    border: 2px solid #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

/* Focus con validazione */
.gpa-container input.validated-ape:focus {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.35) !important;
}

.gpa-container input.invalid-ape-select-form:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.35) !important;
}
