/* copertura.fastalp.it — stile allineato a www.fastalp.it (Kodchasan, rosso FastAlp) */

:root {
    --red: #C8102E;
    --red-dark: #A00D25;
    --red-soft: #FDECEF;
    --ink: #1F2933;
    --muted: #52606D;
    --line: #E1E5EA;
    --bg: #F5F6F8;
    --white: #FFFFFF;
    --green: #00A575;
    --green-soft: #E3F6EF;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 24px rgba(31, 41, 51, .08);
    --focus: 0 0 0 3px rgba(200, 16, 46, .22);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: Kodchasan, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--red); }
a:hover { color: var(--red-dark); }

.icon {
    width: 1.15em;
    height: 1.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
    vertical-align: -0.2em;
}

/* ---------------- Header / footer ---------------- */

.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-header__logo img { display: block; height: 44px; width: auto; }
.site-header__phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    text-decoration: none;
    color: var(--ink);
}
.site-header__phone svg { width: 18px; height: 18px; fill: none; stroke: var(--red); stroke-width: 2; }

.site-footer {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 24px 16px 32px;
}
.site-footer a { color: var(--muted); }

/* Modalità iframe (dentro www.fastalp.it): solo il form */
.is-embedded .site-header,
.is-embedded .site-footer,
.is-embedded .hero { display: none; }
.is-embedded body { background: transparent; min-height: 0; }
.is-embedded .wizard { padding-top: 12px; }
.is-embedded .result { margin-top: 12px; }

/* ---------------- Layout ---------------- */

.page {
    flex: 1;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px;
}

.hero { text-align: center; padding: 40px 0 24px; }
.hero__eyebrow {
    margin: 0 0 6px;
    color: var(--red);
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 13px;
}
.hero__title {
    margin: 0;
    font-size: clamp(30px, 6vw, 44px);
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -1px;
}
.hero__lead { max-width: 560px; margin: 12px auto 0; color: var(--muted); }

.card {
    background: var(--white);
    border-top: 4px solid var(--red);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

/* ---------------- Stepper ---------------- */

.wizard { padding-bottom: 24px; }

.steps {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    counter-reset: step;
}
.steps__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}
.steps__item::before {
    content: "";
    position: absolute;
    top: 15px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--line);
    z-index: 0;
}
.steps__item:first-child::before { display: none; }
.steps__dot {
    position: relative;
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--white);
    border: 2px solid var(--line);
    transition: background .2s, border-color .2s, color .2s;
}
.steps__item.is-done, .steps__item.is-active { color: var(--ink); }
.steps__item.is-done::before, .steps__item.is-active::before { background: var(--red); }
.steps__item.is-done .steps__dot { background: var(--red); border-color: var(--red); color: var(--white); }
.steps__item.is-active .steps__dot { border-color: var(--red); color: var(--red); box-shadow: var(--focus); }

/* ---------------- Pannelli ---------------- */

.panel { border: 0; margin: 0; padding: 0; min-width: 0; display: none; }
.panel.is-active { display: block; animation: panel-in .25s ease-out; }

@keyframes panel-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .panel.is-active { animation: none; }
}

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel__title {
    padding: 0;
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    float: left;
    width: 100%;
}
.panel__head .panel__title { width: auto; }
.panel__title + * { clear: both; }
.panel__hint { color: var(--muted); margin: 0 0 20px; }
.panel__hint .icon { color: var(--red); }

.panel__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.panel__actions .js-next, .panel__actions [type=submit] { margin-left: auto; }
.req-note { font-size: 13px; color: var(--muted); }

/* ---------------- Campi ---------------- */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
    margin-top: 20px;
}
.col-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 16px; }
.grid .field + .field { margin-top: 0; }
.field-hint { margin: 4px 0 -6px; font-size: 14px; color: var(--muted); font-weight: 600; }

label, .label { font-weight: 600; font-size: 15px; }
.req { color: var(--red); }

input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
    width: 100%;
    font: inherit;
    font-weight: 500;
    color: var(--ink);
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    min-height: 48px;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 110px; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2352606D' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: var(--focus); }
input[readonly] { background: var(--bg); }
.field.is-invalid input, .field.is-invalid select { border-color: var(--red); background: var(--red-soft); }
.field__error { color: var(--red); font-size: 13px; font-weight: 600; }

/* Privato / Azienda */
.segmented {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--bg);
    border-radius: 10px;
    margin-top: 14px;
}
.segmented__option input, .chip input, .tile input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted);
    transition: background .15s, color .15s;
}
.segmented__option input:checked + span { background: var(--white); color: var(--red); box-shadow: 0 1px 4px rgba(31, 41, 51, .12); }
.segmented__option input:focus-visible + span { box-shadow: var(--focus); }

/* Chip (scelte singole) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chips--stack { flex-direction: column; align-items: stretch; }
.chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: border-color .15s, background .15s;
}
.chip::before {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--line);
    flex: none;
    transition: border .15s;
}
.chip:hover { border-color: #C5CCD4; }
.chip:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.chip:has(input:checked)::before { border: 6px solid var(--red); }
.chip:has(input:focus-visible) { box-shadow: var(--focus); }

/* Tile (utilizzo, scelta multipla) */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { position: relative; cursor: pointer; }
.tile span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    min-height: 120px;
    padding: 16px 10px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    transition: border-color .15s, background .15s, transform .15s;
}
.tile .icon { width: 30px; height: 30px; color: var(--muted); }
.tile:hover span { border-color: #C5CCD4; }
.tile input:checked + span { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }
.tile input:checked + span .icon { color: var(--red); }
.tile input:focus-visible + span { box-shadow: var(--focus); }
.tile:active span { transform: scale(.98); }

/* Checkbox privacy */
.check { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); flex: none; }

/* Honeypot anti-spam */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Privato / azienda: mostra solo il blocco pertinente */
.form-privato .only-azienda, .form-azienda .only-privato { display: none !important; }

/* ---------------- Autocompletamento ---------------- */

.ac { position: relative; }
.ac__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    margin: 4px 0 0;
    padding: 4px;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow-y: auto;
}
.ac__list li { padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: 15px; }
.ac__list li mark { background: none; color: var(--red); font-weight: 700; }
.ac__list li[aria-selected=true], .ac__list li:hover { background: var(--bg); }
.ac__list li.ac__free { color: var(--muted); font-style: italic; }
.ac__badge {
    float: right;
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    background: var(--green-soft);
    border-radius: 999px;
    padding: 1px 8px;
    margin-top: 2px;
}

/* ---------------- Mappa ---------------- */

.map {
    position: relative;
    height: 360px;
    margin-top: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #DDE2E7;
}
.map__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    z-index: 1;
    background: #DDE2E7;
}
.map__placeholder[hidden] { display: none; }
.map .leaflet-container, .map.leaflet-container { font-family: inherit; }
.map-pin { background: none; border: 0; }
.map-pin svg { width: 34px; height: 50px; fill: var(--red); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); }
.leaflet-control-layers-base label { font-weight: 600; font-size: 14px; }
.map__hint {
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #FFF4D6;
    color: #6B4600;
    font-size: 15px;
    font-weight: 600;
}
.map__hint[hidden] { display: none; }

/* ---------------- Riepilogo ---------------- */

.summary {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin: 14px 0 18px;
    font-size: 15px;
}
.summary dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------------- Pulsanti ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 22px;
    font: inherit;
    font-weight: 600;
    font-size: 16px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn--primary { background: var(--red); border-color: var(--red); color: var(--white); }
.btn--primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }
.btn--primary:disabled { background: #E7A3AE; border-color: #E7A3AE; cursor: not-allowed; }
.btn--outline { background: var(--white); border-color: var(--red); color: var(--red); }
.btn--outline:hover { background: var(--red-soft); }
.btn--ghost { background: transparent; color: var(--muted); padding-left: 10px; padding-right: 10px; }
.btn--ghost:hover { color: var(--ink); }
.btn--link { background: none; border: 0; padding: 0; min-height: 0; color: var(--red); text-decoration: underline; font-size: 15px; }

/* ---------------- Avvisi / overlay ---------------- */

.alert {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: var(--red-soft);
    color: var(--red-dark);
    font-weight: 600;
}
.alert[hidden] { display: none; }
.alert .icon { margin-top: 3px; }

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: rgba(31, 41, 51, .45);
    backdrop-filter: blur(2px);
}
.overlay[hidden] { display: none; }
.overlay__box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px 36px;
    text-align: center;
    box-shadow: var(--shadow);
}
.overlay__box p { margin: 14px 0 0; }
.spinner {
    display: inline-block;
    width: 38px;
    height: 38px;
    border: 4px solid var(--red-soft);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Pagina esito ---------------- */

.result { max-width: 680px; margin: 40px auto 24px; text-align: center; }
.result__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--red-soft);
    color: var(--red);
}
.result--success .result__icon { background: var(--green-soft); color: var(--green); }
.result__icon .icon { width: 32px; height: 32px; }
.result__title { margin: 0 0 12px; font-size: 30px; line-height: 1.2; }
.result__body { color: var(--muted); }
.result__body b { color: var(--ink); }
.result__body ul { text-align: left; display: inline-block; margin: 0; }

.coverage { margin: 22px 0; padding: 18px; border-radius: var(--radius); background: var(--bg); }
.coverage p { margin: 0 0 12px; color: var(--ink); }
.coverage__list { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; font-weight: 700; }
.badge--ftth { background: var(--green-soft); color: #007A57; }
.badge--fwa { background: #FFF4D6; color: #8A5A00; }

.contact-box { margin: 24px 0; }
.contact-box__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.signature { color: var(--ink); }

/* ---------------- Responsive ---------------- */

@media (max-width: 680px) {
    .card { padding: 22px 18px; }
    .grid { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: 1fr 1fr; }
    .steps__label { display: none; }
    .steps__item.is-active .steps__label { display: block; position: absolute; top: 38px; white-space: nowrap; }
    .steps { margin-bottom: 34px; }
    .hero { padding-top: 28px; }
    .map { height: 300px; }
    .panel__title { font-size: 21px; }
    .summary dl { grid-template-columns: 1fr; }
    .summary dd { margin-bottom: 6px; }
}
