/* «Lavora con me» (work-with-me.js, WorkWithMeButton.razor, WorkWithMePanel.razor):
   pulsante nella barra in alto, invito ricevuto, pagina divisa di chi guarda. */

:root { --lcm-w: 50vw; --lcm-zoom: .78; }

/* ── Pulsante e menu (barra in alto) ── */
.lcm { position: relative; display: inline-flex; }
.lcm-btn { gap: 8px; padding: 8px 12px; white-space: nowrap; font-weight: 600; font-size: 12.5px; }
.lcm-btn .ic { width: 18px; height: 18px; }
.lcm.on .lcm-btn {
    background: var(--grad); color: white; border-color: transparent;
    box-shadow: 0 0 0 0 rgba(236, 72, 153, .55); animation: lcm-pulse 2s ease-out infinite;
}
@keyframes lcm-pulse { to { box-shadow: 0 0 0 9px rgba(236, 72, 153, 0); } }

.lcm-menu { width: 370px; max-height: min(560px, 76vh); padding: 0 0 6px; }
.lcm-head { display: grid; gap: 6px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.lcm-head .small { line-height: 1.45; }
.lcm-group { padding: 12px 16px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lcm-row { display: flex; align-items: center; gap: 10px; padding: 7px 16px; }
.lcm-row:hover { background: var(--surface-hover); }
.lcm-name { font-weight: 600; font-size: 13px; }
.lcm-av {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; position: relative;
    display: grid; place-items: center; font-size: 11px; font-weight: 700;
    background: var(--grad-soft); color: var(--text); border: 1px solid var(--border);
}
.lcm-av.online::after {
    content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
    background: var(--success); border: 2px solid var(--surface-solid);
}
.lcm-av.waiting { background: none; border: 1px dashed var(--border-strong); color: var(--muted); }
.lcm-empty { padding: 6px 16px 10px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.lcm-foot { margin-top: 6px; padding: 10px 16px 6px; border-top: 1px solid var(--border); text-align: right; }

/* ── Invito ricevuto ── */
.lcm-invites { position: fixed; right: 20px; bottom: 24px; z-index: 190; display: grid; gap: 10px; width: min(420px, calc(100vw - 40px)); }
.lcm-invite {
    display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: start; padding: 16px 18px;
    background: var(--surface-solid); color: var(--text); border: 1px solid var(--border-strong); border-radius: 16px;
    box-shadow: var(--shadow), var(--shadow-glow); animation: lcm-in .25s ease-out;
}
@keyframes lcm-in { from { transform: translateY(12px); opacity: 0; } }
.lcm-invite-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: white; }
.lcm-invite-text { display: grid; gap: 4px; font-size: 13.5px; }
.lcm-invite-text span { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.lcm-invite-text .lcm-invite-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.lcm-invite-actions { grid-column: 2; display: flex; gap: 8px; margin-top: 6px; }

/* ── Pagina divisa (chi guarda) ── */
/* Il proprio portale resta a sinistra, un po' rimpicciolito: in mezza finestra le pagine tengono la loro impaginazione */
html.lcm-guest .shell { margin-right: calc(var(--lcm-w) / var(--lcm-zoom)); zoom: var(--lcm-zoom); min-height: calc(100vh / var(--lcm-zoom)); }
html.lcm-guest .sidebar { height: calc(100vh / var(--lcm-zoom)); height: calc(100dvh / var(--lcm-zoom)); }
html.lcm-guest .toast-stack, html.lcm-guest .lcm-invites { right: calc(var(--lcm-w) + 20px); }
.lcm-split {
    position: fixed; top: 0; right: 0; bottom: 0; width: var(--lcm-w); z-index: 150;
    display: flex; flex-direction: column;
    background: #0b0b12; border-left: 2px solid var(--accent-2);
    box-shadow: -10px 0 30px rgba(0, 0, 0, .28);
}
.lcm-split-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--grad); color: white; }
.lcm-split-head .lcm-exit { color: white; border-color: rgba(255, 255, 255, .45); background: rgba(0, 0, 0, .18); flex-shrink: 0; }
.lcm-split-head .lcm-exit:hover { background: rgba(0, 0, 0, .3); }
.lcm-live { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); animation: lcm-live 1.6s ease-out infinite; }
@keyframes lcm-live { to { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); } }
.lcm-who { flex: 1; min-width: 0; display: grid; font-size: 13.5px; }
.lcm-who span { font-size: 11.5px; opacity: .9; }
.lcm-stage-wrap { position: relative; flex: 1; min-height: 0; }
.lcm-stage { position: absolute; inset: 0; overflow: hidden; }
.lcm-frame { position: relative; transform-origin: 0 0; }
.lcm-frame.is-veiled { visibility: hidden; }
.lcm-iframe { display: block; border: 0; background: #0b0b12; pointer-events: none; }
.lcm-iframe.is-back { position: absolute; left: 0; top: 0; visibility: hidden; }
.lcm-cursor { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 2; transition: transform 60ms linear; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); }
.lcm-cursor[hidden] { display: none; }
.lcm-click {
    position: absolute; z-index: 2; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; pointer-events: none;
    border: 2px solid #ec4899; animation: lcm-click .7s ease-out forwards;
}
@keyframes lcm-click { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.lcm-veil {
    position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center;
    padding: 36px; color: #dcdcec; font-size: 14.5px; line-height: 1.55; background: #0b0b12;
}

/* Finestre medie: il nome nel pulsante lascia spazio alla barra */
@media (max-width: 1280px) { .lcm:not(.on) .lcm-label { display: none; } }

/* Telefono e finestre strette: la copia va sotto, metà altezza, sopra la barra di navigazione */
@media (max-width: 960px) {
    html.lcm-guest .shell { margin-right: 0; padding-bottom: 46vh; zoom: 1; min-height: 100vh; }
    html.lcm-guest .sidebar { height: 100vh; height: 100dvh; }
    html.lcm-guest .toast-stack, html.lcm-guest .lcm-invites { right: 20px; }
    .lcm-split { top: auto; left: 0; width: auto; height: 46vh; border-left: 0; border-top: 2px solid var(--accent-2); }
}
@media (max-width: 760px) {
    .lcm-label { display: none; }
    .lcm-menu { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; }
    .lcm-split { bottom: calc(62px + env(safe-area-inset-bottom)); }
    .lcm-invites { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media print { .lcm, .lcm-split, .lcm-invites { display: none !important; } }

/* ───────────── Spettatore (Platform Admin): lo schermo di chi è collegato, in diretta ───────────── */

/* Occhio nella barra in alto: tenue quando nessuno guarda, acceso («Supervisionato») quando lo Spettatore guarda */
.lcm-eye {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border-radius: 999px;
    font-size: 12px; font-weight: 650; white-space: nowrap; color: var(--muted); border: 1px solid transparent;
    opacity: .35; transition: all .2s ease; cursor: default;
}
.lcm-eye-label { display: none; }
.lcm-eye[data-stato="acceso"] {
    opacity: 1; color: #5b3a00; background: #ffd54f; border-color: #f2c233;
    animation: lcm-eye-pulse 1.8s ease-out infinite;
}
.lcm-eye[data-stato="acceso"] .lcm-eye-label { display: inline; }
@keyframes lcm-eye-pulse {
    0% { box-shadow: 0 0 0 0 rgba(242, 194, 51, .6); }
    70% { box-shadow: 0 0 0 8px rgba(242, 194, 51, 0); }
    100% { box-shadow: 0 0 0 0 rgba(242, 194, 51, 0); }
}
@media (max-width: 960px) {
    .lcm-eye[data-stato="acceso"] .lcm-eye-label { display: none; }
    .lcm-eye[data-stato="spento"] { display: none; }
}

.spt-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.spt-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.spt-live[data-stato="diretta"] { color: var(--text); }
.spt-live[data-stato="diretta"] .spt-live-dot { background: var(--success); box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: spt-pulse 1.6s ease-out infinite; }
.spt-live[data-stato="attesa"] .spt-live-dot { background: var(--warning); }
@keyframes spt-pulse { to { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } }

.spt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.spt-card {
    position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; text-align: left; min-width: 0;
    font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.spt-card:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.spt-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spt-card.is-on { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.spt-card.is-away { opacity: .72; }
.spt-av {
    position: relative; flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    font-size: 13px; font-weight: 700; color: white; background: var(--grad);
}
.spt-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-solid); background: var(--muted); }
.spt-card.is-active .spt-dot { background: var(--success); }
.spt-card.is-idle .spt-dot { background: var(--warning); }
.spt-card-body { display: grid; gap: 3px; min-width: 0; flex: 1; }
.spt-name { font-weight: 650; }
.spt-path { font-size: 12px; color: var(--text-2); }
.spt-eye { position: absolute; top: 10px; right: 12px; opacity: 0; transition: opacity .15s; }
.spt-card:hover .spt-eye, .spt-card.is-on .spt-eye { opacity: 1; }

.spt-monitor { display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden; background: #0b0b12; box-shadow: var(--shadow); }
.spt-bar { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px; color: #f4f4f8; background: #16161f; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.spt-bar .btn { color: #f4f4f8; }
.spt-bar .tag { flex: 0 0 auto; }
.spt-bar-page { color: #a0a0b8; min-width: 0; }
.spt-dots { display: inline-flex; gap: 5px; flex: 0 0 auto; }
.spt-dots i { width: 10px; height: 10px; border-radius: 50%; background: #f43f5e; }
.spt-dots i:nth-child(2) { background: #f59e0b; }
.spt-dots i:nth-child(3) { background: #10b981; }
.spt-stage-wrap { position: relative; height: calc(100vh - 300px); min-height: 320px; }
.spt-monitor:fullscreen { border-radius: 0; border: 0; }
.spt-monitor:fullscreen .spt-stage-wrap { height: auto; flex: 1; }

@media (max-width: 760px) {
    .spt-cards { grid-template-columns: 1fr; }
    .spt-stage-wrap { height: 60vh; min-height: 300px; }
    .spt-bar .tag, .spt-dots { display: none; }
}
/* Scheda: stato, ricarica, finestre */
.spt-card { cursor: pointer; }
.spt-state { display: inline-flex; align-items: center; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; vertical-align: 1px; }
.spt-state.is-active { color: #6ee7b7; background: rgba(16, 185, 129, .16); }
.spt-state.is-idle { color: #fcd34d; background: rgba(245, 158, 11, .16); }
.spt-state.is-away { color: var(--muted); background: var(--surface-2); }
[data-theme="light"] .spt-state.is-active { color: #047857; }
[data-theme="light"] .spt-state.is-idle { color: #b45309; }
.spt-card.is-idle, .spt-card.is-away { opacity: .8; }
.spt-reload {
    position: absolute; right: 10px; bottom: 10px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
    color: var(--muted); background: transparent; border: 1px solid var(--border); cursor: pointer; opacity: 0; transition: opacity .15s;
}
.spt-card:hover .spt-reload, .spt-card.is-on .spt-reload, .spt-reload:focus-visible { opacity: 1; }
.spt-reload:hover { color: var(--text); border-color: var(--border-strong); }
.spt-reload:disabled { opacity: .5; cursor: wait; }
.spt-watchers { font-size: 11.5px; font-weight: 650; color: #f2c233; }
[data-theme="light"] .spt-watchers { color: #b45309; }
.spt-scale { color: #a0a0b8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.spt-tabs { display: flex; gap: 6px; padding: 6px 12px; overflow-x: auto; background: #12121a; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.spt-tab {
    flex: 0 0 auto; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 4px 10px; border-radius: 8px;
    font: inherit; font-size: 12px; color: #c4c4d4; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); cursor: pointer;
}
.spt-tab.is-on { color: white; border-color: #8b5cf6; background: rgba(139, 92, 246, .25); }
.spt-tab.is-hidden { opacity: .65; }
.spt-follow { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #c4c4d4; white-space: nowrap; cursor: pointer; }

@media print { .lcm-eye { display: none !important; } }
