/* ===== Motore tour interattivo PUNTO-TRAS (demo) ===== */

/* Le viste e i tab della replica app: una sola attiva per volta */
.view { display: none; }
.view.active { display: block; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* Durante il tour la replica app non è cliccabile: si guida dai controlli */
body.tour-running #app-root { pointer-events: none; user-select: none; }

/* Cursore finto animato */
.tour-cursor {
    position: fixed; left: -100px; top: -100px; width: 26px; height: 26px; z-index: 1100;
    pointer-events: none; transform-origin: 20% 20%;
    transition: left .72s cubic-bezier(.4, .1, .2, 1), top .72s cubic-bezier(.4, .1, .2, 1);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M5 3l14 8-6 1.5L10 20z' fill='white' stroke='%23003060' stroke-width='1.5' stroke-linejoin='round'/></svg>");
    background-size: contain; background-repeat: no-repeat;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.4));
}
.tour-cursor.clicking { transform: scale(.8); }
.tour-cursor.dragging::after {
    content: ""; position: absolute; inset: -6px -6px auto auto; width: 14px; height: 14px;
    border-radius: 50%; background: rgba(0,168,240,.5); border: 2px solid #00a8f0;
}

/* Onda del click */
.tour-ripple {
    position: fixed; z-index: 1050; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid #00a8f0; pointer-events: none; transform: translate(-50%, -50%) scale(1);
    opacity: .9; animation: ripple .55s ease-out forwards;
}
@keyframes ripple { to { transform: translate(-50%, -50%) scale(4); opacity: 0; } }

/* Spotlight: oscura tutto tranne il bersaglio */
.tour-spot {
    position: fixed; z-index: 900; border-radius: 10px; pointer-events: none;
    box-shadow: 0 0 0 3px rgba(0,168,240,.9), 0 0 0 9999px rgba(6,16,32,.55);
    transition: all .45s cubic-bezier(.4, .1, .2, 1); opacity: 0;
}
.tour-spot.on { opacity: 1; }

/* Callout / fumetto tutorial */
.tour-callout {
    position: fixed; z-index: 1000; max-width: 320px; background: #fff; color: var(--testo);
    border-radius: 12px; padding: 15px 17px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
    opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s;
    border-top: 4px solid var(--azzurro);
}
.tour-callout.on { opacity: 1; transform: translateY(0); }
.tour-callout .tc-step { font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--azzurro); margin-bottom: 4px; }
.tour-callout h4 { margin: 0 0 6px; font-size: 16px; color: var(--blu-scuro); }
.tour-callout p { margin: 0; font-size: 13.5px; line-height: 1.55; color: #48546a; }
.tour-callout .tc-arrow { position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); }
.tour-callout.arrow-left .tc-arrow { left: -7px; top: 24px; box-shadow: -3px 3px 6px rgba(0,0,0,.06); }
.tour-callout.arrow-right .tc-arrow { right: -7px; top: 24px; box-shadow: 3px -3px 6px rgba(0,0,0,.06); }
.tour-callout.arrow-top .tc-arrow { top: -7px; left: 26px; box-shadow: -3px -3px 6px rgba(0,0,0,.06); }
.tour-callout.arrow-bottom .tc-arrow { bottom: -7px; left: 26px; box-shadow: 3px 3px 6px rgba(0,0,0,.06); }
.tour-callout.is-alert { border-top-color: #d92d20; }
.tour-callout.is-alert h4 { color: #b71c1c; }

/* La modale demo deve stare sopra lo spotlight (che oscura il resto) */
.modal-overlay.demo-top { z-index: 950; }

/* Barra controlli */
.tour-controls {
    position: fixed; z-index: 1200; left: 50%; bottom: 20px; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px; background: #0b2547; color: #fff;
    padding: 9px 14px; border-radius: 40px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.tour-controls button {
    background: rgba(255,255,255,.12); color: #fff; border: none; width: 38px; height: 38px;
    border-radius: 50%; cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.tour-controls button:hover { background: rgba(255,255,255,.25); }
.tour-controls button.primary { background: var(--azzurro); width: 44px; height: 44px; font-size: 17px; }
.tour-controls button.primary:hover { background: #33baf5; }
.tour-controls .tc-label { font-size: 12.5px; opacity: .85; min-width: 60px; text-align: center; }
.tour-progress { width: 190px; height: 6px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.tour-progress > span { display: block; height: 100%; width: 0; background: var(--azzurro); transition: width .4s; }

/* Overlay intro / fine */
.tour-screen {
    position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(0,48,96,.92), rgba(24,96,168,.92)); padding: 20px;
}
.tour-screen.hidden { display: none; }
.tour-screen .ts-card {
    background: #fff; border-radius: 16px; padding: 34px 36px; max-width: 520px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.tour-screen .ts-card img { height: 40px; margin-bottom: 18px; }
.tour-screen h2 { margin: 0 0 10px; font-size: 24px; color: var(--blu-scuro); }
.tour-screen p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; color: #48546a; }
.tour-screen ul { text-align: left; display: inline-block; margin: 8px 0 22px; color: #48546a; font-size: 14px; line-height: 1.8; }
.tour-screen .ts-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.tour-screen .ts-btn {
    background: var(--blu); color: #fff; border: none; padding: 13px 26px; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.tour-screen .ts-btn:hover { background: var(--blu-scuro); }
.tour-screen .ts-btn.ghost { background: #eef2f8; color: var(--blu); }
.tour-screen .ts-badge { display: inline-block; background: #eaf4ff; color: var(--blu);
    font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 20px; margin-bottom: 16px; letter-spacing: .5px; }

/* Etichetta "demo" sempre visibile in alto */
.demo-flag { position: fixed; top: 10px; right: 12px; z-index: 1150; background: #003060; color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 5px 11px; border-radius: 20px; opacity: .85; }

@media (max-width: 640px) {
    .tour-callout { max-width: 260px; }
    .tour-progress { width: 90px; }
}
