/* ==========================================================================
   1. VARIABILI E RESET
   ========================================================================== */
:root {
    --primary: #ff6600;
    --primary-hover: #e65c00;
    --primary-light: #fff1e7;   
    --dark: #1e293b;            
    --slate: #64748b;           
    --bg: #f8fafc;              
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: #334155;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

/* IL WRAPPER BLINDATO */
.wrapper {
    max-width: 1240px;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 20px;
    width: 100%;
}

/* ==========================================================================
   2. NAVBAR
   ========================================================================== */
.navbar {
    background-color: var(--white);
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark) !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo i { color: var(--primary); }

.btn-partner {
    background: var(--dark) !important;
    color: var(--white) !important;
    padding: 10px 22px;
    border-radius: 10px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    border: none;
}
.btn-partner:hover {
    background: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.3);
}

/* ==========================================================================
   3. HERO SECTION
   ========================================================================== */
.hero-section {
    background: linear-gradient(rgba(30, 41, 59, 0.7), rgba(30, 41, 59, 0.7)), 
                url('https://images.unsplash.com/photo-1544620347-c4fd4a3d5957?q=80&w=1920');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 80px 0 50px 0;
    text-align: center;
}

.hero-section h1 { font-size: 48px; line-height: 1.1; margin-bottom: 15px; font-weight: 800; }
.hero-section p { font-size: 18px; opacity: 0.9; }

/* ==========================================================================
   4. LAYOUT CALCOLATORE & FORM
   ========================================================================== */
.main-container { 
    margin-top: 40px; 
    margin-bottom: 40px; 
    flex: 1; 
}

.flex-layout { 
    display: flex; 
    gap: 40px; 
    align-items: flex-start;
    width: 100%; 
}

.form-box {
    flex: 1;
    min-width: 450px;
    background: var(--white);
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    border-top: 10px solid var(--primary);
}

#map {
    flex: 1.3;
    border-radius: 24px;
    height: 650px;
    position: sticky !important;
    top: 110px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.section-label {
    display: block;
    margin-top: 25px;
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 12px;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.input-row div { flex: 1; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select {
    width: 100%;
    padding: 16px;
    margin-bottom: 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    font-size: 15px;
    transition: 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

#main-btn {
    background: var(--primary);
    color: white;
    padding: 20px;
    width: 100%;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 20px;
    transition: 0.3s;
}
#main-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

/* ==========================================================================
   5. BUS CARDS & TRUST
   ========================================================================== */
.bus-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    border: 2px solid var(--border);
    margin-top: 20px;
    cursor: pointer;
    transition: 0.3s;
}
.bus-card:hover { border-color: var(--primary); }
.bus-card.selected { border-color: var(--primary); background: var(--primary-light); border-width: 3px; }

.bus-card-main { display: flex; gap: 20px; align-items: center; }
.bus-card-photo { width: 120px; height: 80px; border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.bus-card-photo img { width: 100%; height: 100%; object-fit: cover; }

.bus-price-total { font-size: 26px; font-weight: 800; color: var(--primary); }
.bus-price-pax { font-size: 13px; color: var(--slate); font-weight: 700; }

.trust-section { margin-top: 40px; margin-bottom: 80px; }
.trust-container {
    background: var(--white); border-radius: 24px; padding: 40px;
    display: flex; align-items: center; gap: 40px; box-shadow: var(--shadow);
    border-left: 6px solid var(--primary);
}

.sig { font-family: 'Georgia', serif; font-style: italic; font-weight: 700; color: var(--dark); font-size: 18px; }

/* ==========================================================================
   6. FOOTER
   ========================================================================== */
.footer { background: var(--dark); color: white; padding: 60px 0 30px 0; margin-top: auto; border-top: 5px solid var(--primary); }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.footer-links a { color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; transition: 0.3s; }
.footer-links a:hover { color: var(--primary); }

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
    .flex-layout { flex-direction: column; }
    #map { width: 100%; height: 400px; position: static !important; }
    .form-box { min-width: 0; width: 100%; }
}

@media (max-width: 768px) {
    .input-row { flex-direction: column; gap: 0; }
    .input-row input { margin-bottom: 15px !important; }
    .hero-section h1 { font-size: 32px; }
    .footer-grid { grid-template-columns: 1fr; text-align: center; }
    .footer-links a { justify-content: center; }
    .bus-card-main { flex-direction: column; text-align: center; }
    .trust-container { flex-direction: column; text-align: center; padding: 30px 20px; }
}

/* --- RESPONSIVE ADJUSTMENTS PER DISPOSITIVI MOBILE --- */
@media (max-width: 768px) {
    .flex-layout {
        display: flex;
        flex-direction: column; /* Incolonna gli elementi */
    }

    /* Ordina esplicitamente gli elementi (1=Sopra, 2=Sotto) */
    .form-box {
        order: 1;
        width: 100%;
    }

    #map {
        order: 2;
        width: 100%;
        height: 250px !important; /* Mappa con proporzioni ridotte */
        margin-top: 20px;         /* Distanza dal form superiore */
        border-radius: 12px;
    }

    /* Se usi input-row, assicurati che su mobile diventino singoli blocchi */
    .input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-row > div {
        width: 100%;
    }
}