:root {
    --glass: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --accent: #ff7e5f; /* Arancio corallo moderno */
    --accent-hover: #feb47b;
    --dark: #1a1a2e;
    --text-light: #f8f9fa;
}

/* Layout Base & Animazioni Globali */
body {
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(15px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- SEARCH SECTION (Glassmorphism & Animato) --- */
.search-container {
    background: var(--glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 24px;
    max-width: 1100px;
    margin: 80px auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.search-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px -12px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.35);
}

.search-container h1 {
    color: rgb(44, 44, 44);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    animation: fadeInUp 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Griglia Input Innovativa (4 Colonne, Zero Sovrapposizioni) */
.search-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 colonne uguali */
    gap: 15px; /* Spazio tra i campi */
    align-items: center;
    animation: fadeInUp 0.7s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.search-grid input, 
.search-grid select {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    width: 100%;
    box-sizing: border-box; /* Risolve definitivamente qualsiasi rischio di sovrapposizione */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.search-grid input:hover, 
.search-grid select:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.search-grid input:focus, 
.search-grid select:focus {
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 126, 95, 0.35), 0 6px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Pulsante Search con Gradiente e Animazione */
.btn-search {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-transform: uppercase;
    
    /* Altezza e allineamento simmetrico */
    height: 100%;
    min-height: 50px;
    width: 100%;
    grid-column: 2 / 4; /* Posizionato nelle colonne centrali per simmetria */
    box-shadow: 0 8px 20px rgba(255, 126, 95, 0.3);
}

.btn-search:hover {
    filter: brightness(1.1);
    transform: scale(1.02) translateY(-2px);
    box-shadow: 0 12px 25px rgba(255, 126, 95, 0.5);
}

.btn-search:active {
    transform: scale(0.99) translateY(0);
}

/* --- CITIES GRID (Modern Cards & Animazioni) --- */
.cities-section {
    padding: 100px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.cities-section h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
    animation: fadeInUp 0.7s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cities-section h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 50px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
}

.cities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.city-card {
    position: relative;
    height: 350px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    animation: fadeInScale 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Ritardo a cascata per le card in griglia (effetto sequenziale pulito) */
.city-card:nth-child(1) { animation-delay: 0.35s; }
.city-card:nth-child(2) { animation-delay: 0.45s; }
.city-card:nth-child(3) { animation-delay: 0.55s; }
.city-card:nth-child(4) { animation-delay: 0.65s; }

.city-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}

.city-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.city-card:hover img {
    transform: scale(1.1);
}

.city-info {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
    color: white;
    transition: 0.3s;
}

.city-info h3 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    transform: translateY(5px);
    transition: transform 0.3s ease;
}

.city-card:hover .city-info h3 {
    transform: translateY(0);
}

.city-info p {
    font-size: 1rem;
    opacity: 0.9;
    transform: translateY(12px);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.city-card:hover .city-info p {
    transform: translateY(0);
    opacity: 1;
}

/* --- RESPONSIVO OTTIMIZZATO --- */

/* Tablet e schermi medi (max 1024px) */
@media (max-width: 1024px) {
    .search-grid {
        grid-template-columns: repeat(2, 1fr); /* Griglia a 2 colonne bilanciata */
        gap: 15px;
    }
    
    .btn-search {
        grid-column: 1 / -1; /* Il pulsante occupa interamente l'ultima riga */
    }
    
    .search-container {
        padding: 2.5rem;
        margin: 50px 20px;
    }
}

/* Smartphone e schermi piccoli (max 768px) */
@media (max-width: 768px) {
    .search-container {
        padding: 1.5rem;
        margin: 30px 15px;
        border-radius: 20px;
    }

    .search-grid {
        grid-template-columns: 1fr; /* 1 colonna verticale: zero rischi di sovrapposizione */
        gap: 12px;
    }

    .search-container h1 {
        font-size: 1.8rem;
        margin-bottom: 1.2rem;
    }

    .search-grid input, 
    .search-grid select {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .btn-search {
        grid-column: 1 / -1;
        padding: 15px;
        min-height: 48px;
    }

    .cities-section {
        padding: 60px 5%;
    }

    .cities-section h2 {
        font-size: 1.7rem;
        margin-bottom: 30px;
    }

    .city-card {
        height: 280px;
    }
}