/* ==========================================================================
   Tools pages (Verifica copertura + Speed Test)
   Shared layout, reuses .offer-card / .offer-form from offerte + hero-offerta
   ========================================================================== */
:root {
    --tool-blue: #122ac2;
    --tool-blue-dark: #00319a;
    --tool-green: #04b88f;
    --tool-red: #e4002b;
    --tool-ink: #182a79;
}

body.page-template-page-verifica-copertura,
body.page-template-page-speedtest {
    font-family: 'Inter', system-ui, sans-serif;
    color: #1a1a1a;
    background: #eef2fb;
}

/* ---- Hero ---- */
.tool-hero {
    position: relative;
    background: linear-gradient(135deg, var(--tool-blue) 0%, var(--tool-blue-dark) 100%);
    color: #fff;
    padding: 3.5rem 0 8rem;
    overflow: hidden;
}

.tool-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.12), transparent 35%),
        radial-gradient(circle at 85% 0%, rgba(4, 184, 143, 0.18), transparent 40%);
    pointer-events: none;
}

.tool-hero .container {
    position: relative;
    z-index: 1;
}

.tool-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.tool-hero h1 {
    font-family: 'Roboto', system-ui, sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 4.5vw, 3.4rem);
    line-height: 1.05;
    margin: 0 0 1rem;
}

.tool-hero h1 .accent {
    color: #ffd84d;
}

.tool-hero p.tool-lead {
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
}

/* ---- Floating panel that overlaps the hero ---- */
.tool-panel-wrap {
    margin-top: -6rem;
    position: relative;
    z-index: 3;
    padding-bottom: 4rem;
}

.tool-panel {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(18, 42, 194, 0.18);
    padding: 2.5rem;
}

@media (max-width: 576px) {
    .tool-panel { padding: 1.5rem; }
    .tool-hero { padding-bottom: 7rem; }
}

/* ==========================================================================
   Coverage checker
   ========================================================================== */
.coverage-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.coverage-field {
    flex: 1 1 240px;
    position: relative;
}

.coverage-field i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.1rem;
}

.coverage-field input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 1rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.coverage-field input:focus {
    border-color: var(--tool-blue);
    box-shadow: 0 0 0 4px rgba(18, 42, 194, 0.12);
}

.coverage-submit {
    flex: 0 0 auto;
    background: var(--tool-blue);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 1rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.coverage-submit:hover { background: var(--tool-blue-dark); transform: translateY(-2px); }
.coverage-submit:disabled { opacity: 0.6; cursor: default; transform: none; }

.coverage-hint {
    margin: 0.85rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
}

/* progress steps */
.coverage-progress {
    margin-top: 1.75rem;
    display: none;
    flex-direction: column;
    gap: 0.85rem;
}

.coverage-progress.is-visible { display: flex; }

.coverage-step {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.98rem;
    color: #94a3b8;
    opacity: 0.5;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.coverage-step.is-active { opacity: 1; color: #1e293b; }
.coverage-step.is-done { opacity: 1; color: var(--tool-green); }

.coverage-step .step-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid currentColor;
    font-size: 0.8rem;
}

.coverage-step .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(18, 42, 194, 0.25);
    border-top-color: var(--tool-blue);
    border-radius: 50%;
    animation: tool-spin 0.7s linear infinite;
}

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

/* result */
.coverage-result {
    margin-top: 1.75rem;
    display: none;
    text-align: center;
    animation: tool-fade 0.5s ease both;
}

.coverage-result.is-visible { display: block; }

.coverage-result .result-badge {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(18, 42, 194, 0.10);
    color: var(--tool-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.coverage-result h3 {
    font-family: 'Roboto', system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--tool-ink);
    margin: 0 0 0.5rem;
}

.coverage-result p { color: #475569; margin: 0 0 1.25rem; }
.coverage-result .result-address { font-weight: 700; color: var(--tool-blue); }

.coverage-speed {
    max-width: 360px;
    margin: 0 auto 1.5rem;
}

.coverage-speed-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.coverage-speed-bar {
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.coverage-speed-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--tool-green), var(--tool-blue));
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tool-fade {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Speed test
   ========================================================================== */
.speedtest-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.gauge {
    position: relative;
    width: 300px;
    max-width: 80vw;
}

.gauge svg { width: 100%; height: auto; transform: rotate(135deg); }

.gauge-track { fill: none; stroke: #e2e8f0; stroke-linecap: round; }
.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.12s linear;
}

.gauge-readout {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-value {
    font-family: 'Roboto', system-ui, sans-serif;
    font-weight: 900;
    font-size: 3.4rem;
    line-height: 1;
    color: var(--tool-ink);
    font-variant-numeric: tabular-nums;
}

.gauge-unit { font-size: 0.95rem; color: #64748b; margin-top: 0.25rem; }
.gauge-phase {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--tool-blue);
    min-height: 1rem;
}

.speedtest-start {
    margin-top: 1.75rem;
    background: var(--tool-red);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 1rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.speedtest-start:hover { background: #b8001f; transform: translateY(-2px); }
.speedtest-start:disabled { opacity: 0.6; cursor: default; transform: none; }

.speedtest-results {
    display: none;
    margin-top: 2rem;
    width: 100%;
    gap: 1rem;
}

.speedtest-results.is-visible { display: grid; grid-template-columns: repeat(3, 1fr); }

.speed-tile {
    background: #f5f8fc;
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-align: center;
}

.speed-tile .tile-icon { font-size: 1.4rem; color: var(--tool-blue); }
.speed-tile .tile-value {
    font-family: 'Roboto', system-ui, sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--tool-ink);
    margin: 0.25rem 0 0;
    font-variant-numeric: tabular-nums;
}
.speed-tile .tile-label { font-size: 0.8rem; color: #64748b; }

@media (max-width: 576px) {
    .speedtest-results.is-visible { grid-template-columns: 1fr; }
    .gauge-value { font-size: 2.8rem; }
}

/* comparison strip before final CTA */
.speed-compare {
    display: none;
    margin-top: 2rem;
    background: linear-gradient(135deg, rgba(18, 42, 194, 0.06), rgba(4, 184, 143, 0.08));
    border: 1px dashed rgba(18, 42, 194, 0.3);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    text-align: center;
}

.speed-compare.is-visible { display: block; }
.speed-compare strong { color: var(--tool-blue); }

/* ==========================================================================
   Final CTA (shared) — wraps the reused .offer-card
   ========================================================================== */
.tool-cta {
    display: none;
    padding: 1rem 0 5rem;
    animation: tool-fade 0.5s ease both;
}

.tool-cta.is-visible { display: block; }

.tool-cta-head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 2rem;
}

.tool-cta-head h2 {
    font-family: 'Roboto', system-ui, sans-serif;
    font-weight: 900;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--tool-ink);
    margin: 0 0 0.75rem;
}

.tool-cta-head p { color: #475569; font-size: 1.05rem; margin: 0; }

.tool-cta .offer-card {
    max-width: 480px;
    margin: 0 auto;
}
