/* Layout responsive e mobile-first */
*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    color: #333;
    line-height: 1.6;
    overflow-x: clip;
}
/* Barra di navigazione in alto a destra */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1000;
}
.nav-menu {
    list-style: none;
    display: flex;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
}
.nav-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease, opacity 0.3s ease;
}
.nav-menu a:hover {
    opacity: 0.85;
    border-bottom-color: #fff;
}
/* Toggle mobile (hamburger) nascosto su desktop */
.nav-toggle, .nav-toggle-label { display: none; }

/* Compensa la navbar fissa quando si scorre alle sezioni */
section { scroll-margin-top: 80px; }

header {
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('images/sfondo.webp');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}
header > div { max-width: 100%; }
section { padding: 50px 20px; max-width: 1000px; margin: auto; }

#services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 1.25rem;
}
.service {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}
.service:hover { transform: translateY(-5px); }
.form-group { margin-bottom: 15px; }
input, textarea {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    margin-top: 5px;
}
textarea { display: block; resize: vertical; min-height: 6rem; }
button[type="submit"] {
    cursor: pointer;
    padding: 0.65rem 1.25rem;
    min-height: 44px;
    min-width: 44px;
}
.map-container {
    width: 100%;
    max-width: 100%;
    height: 300px;
    background: #eee;
    overflow: hidden;
    position: relative;
}
.map-container iframe {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    border: 0;
}
@media (max-width: 600px) {
    section { padding: 2.5rem 1rem; }
    /* Sposta il punto focale a destra: su schermi verticali "cover" taglia
       i lati, quindi spostiamo l'inquadratura sul gruppo anziana+bambino+signora col libro */
    header { background-position: 63% center; }
    /* Menu a comparsa con pulsante hamburger */
    .navbar { padding: 0.85rem 1rem; }
    .nav-toggle-label {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 28px;
        height: 20px;
        cursor: pointer;
    }
    .nav-toggle-label span {
        display: block;
        height: 3px;
        width: 100%;
        background: #fff;
        border-radius: 2px;
    }
    .nav-menu {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(0, 0, 0, 0.85);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    .nav-menu li { text-align: right; }
    .nav-menu a {
        display: block;
        padding: 0.9rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    .nav-menu a:hover { border-bottom-color: rgba(255, 255, 255, 0.1); }
    .nav-toggle:checked ~ .nav-menu { max-height: 300px; }
    h1 { font-size: clamp(1.45rem, 6vw, 1.85rem); line-height: 1.2; }
    header > div > p { font-size: 0.95rem; line-height: 1.45; }
    h2 { font-size: 1.35rem; }
    /* Evita lo zoom automatico su focus in iOS (font < 16px) */
    input, textarea, button[type="submit"] { font-size: 16px; }
    input { min-height: 44px; }
    textarea { min-height: 7rem; padding-top: 12px; padding-bottom: 12px; }
    button[type="submit"] {
        width: 100%;
        margin-top: 0.35rem;
    }
}

/* ============================================================
   Nuovi componenti: form, consenso, esito, bottoni contatto,
   privacy banner, footer  (palette coerente con il sito)
   ============================================================ */
:root {
    --accent: #2e7d32;
    --accent-dark: #1b5e20;
    --dark-surface: #1f2a30;
    --danger: #c0392b;
    --success: #2e7d32;
}

/* Stile generale input/textarea piu' gradevole */
input, textarea {
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    background: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

#contatti form {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    max-width: 640px;
}

/* Submit con accento + stato disabilitato */
button[type="submit"] {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
button[type="submit"]:hover:not(:disabled) { background: var(--accent-dark); }
button[type="submit"]:disabled {
    background: #b0bec5;
    color: #eceff1;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Checkbox consenso privacy */
.form-consent {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0 0 15px;
    font-size: 0.92rem;
    line-height: 1.4;
    color: #455a64;
}
.form-consent input[type="checkbox"] {
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0.2rem 0 0;
    flex: 0 0 auto;
    accent-color: var(--accent);
}
.form-consent label { cursor: pointer; }

/* Campo honeypot anti-bot: nascosto agli utenti reali */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Messaggio di esito invio */
.form-status {
    margin-top: 12px;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    display: none;
}
.form-status.is-visible { display: block; }
.form-status.is-success {
    background: #e8f5e9;
    color: var(--success);
    border: 1px solid #a5d6a7;
}
.form-status.is-error {
    background: #fdecea;
    color: var(--danger);
    border: 1px solid #f5b7b1;
}

/* Bottoni contatto Chiamaci / Scrivici */
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    max-width: 640px;
}
.contact-btn {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 48px;
    padding: 0.7rem 1.25rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.contact-btn:hover { transform: translateY(-2px); }
.contact-btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.btn-call {
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--accent);
}
.btn-call:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-write {
    background: #fff;
    color: var(--accent-dark);
    border: 2px solid var(--accent);
}
.btn-write:hover { background: #e8f5e9; }

/* Placeholder mappa (prima del consenso) */
.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    margin: 0;
    padding: 1.25rem;
    text-align: center;
    color: #607d8b;
    font-size: 0.95rem;
}

/* Privacy banner fisso in fondo allo schermo */
.privacy-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background: var(--dark-surface);
    color: #eceff1;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.25);
    font-size: 0.92rem;
    line-height: 1.45;
}
.privacy-banner.is-visible { display: flex; }
.privacy-banner p { margin: 0; max-width: 760px; }
.privacy-banner a { color: #a5d6a7; text-decoration: underline; }
.privacy-banner .privacy-accept {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.65rem 1.5rem;
    min-height: 44px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}
.privacy-banner .privacy-accept:hover { background: var(--accent-dark); }

/* Footer a piena larghezza */
.site-footer {
    width: 100%;
    background: var(--dark-surface);
    color: #cfd8dc;
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}
.site-footer a {
    color: #a5d6a7;
    text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

/* ---- Responsive mobile per i nuovi componenti (NFR-1bis) ---- */
@media (max-width: 600px) {
    #contatti form { padding: 1.25rem; }
    .contact-actions { gap: 0.75rem; }
    .contact-btn {
        flex: 1 1 100%;
        font-size: 16px;
    }
    .privacy-banner {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
        text-align: center;
        font-size: 0.88rem;
    }
    .privacy-banner .privacy-accept { width: 100%; }
    .site-footer { font-size: 0.85rem; padding: 1.25rem 1rem; }
    .form-consent { font-size: 0.88rem; }
}
