/* MarX — strato grafico "Liquid Glass" (stile macOS recente).
   Si carica dopo marx.css e ne ridefinisce l'aspetto: materiali in vetro, angoli concentrici, barra dei menu trasparente. */

:root {
    --lg-tint: rgba(255, 255, 255, .22);
    --lg-tint-strong: rgba(255, 255, 255, .42);
    --lg-edge: rgba(255, 255, 255, .75);
    --lg-edge-soft: rgba(255, 255, 255, .25);
    --lg-shadow: 0 12px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
    --lg-blur: 18px;
    --lg-sat: 1.9;
    --lg-hover: rgba(255, 255, 255, .35);
    --menu-text: #fff;
    --r-window: 22px;
    --r-panel: 16px;
    --r-control: 999px;
    --win-bg: #fbfbfd;
    --win-sidebar: rgba(255, 255, 255, .55);
    --accent: #0a84ff;
    --wallpaper:
        radial-gradient(80% 60% at 18% 22%, rgba(120, 220, 255, .85) 0%, transparent 60%),
        radial-gradient(70% 55% at 85% 18%, rgba(170, 130, 255, .75) 0%, transparent 62%),
        radial-gradient(90% 70% at 70% 95%, rgba(20, 60, 190, .95) 0%, transparent 70%),
        radial-gradient(60% 50% at 10% 90%, rgba(0, 170, 200, .7) 0%, transparent 65%),
        linear-gradient(165deg, #6ec3f4 0%, #3f7fe0 38%, #2c4fc4 62%, #1a2a7c 100%);
}
:root[data-theme="dark"] {
    --lg-tint: rgba(28, 28, 34, .38);
    --lg-tint-strong: rgba(40, 40, 48, .6);
    --lg-edge: rgba(255, 255, 255, .32);
    --lg-edge-soft: rgba(255, 255, 255, .08);
    --lg-shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);
    --lg-hover: rgba(255, 255, 255, .14);
    --win-bg: #1c1c1e;
    --win-sidebar: rgba(44, 44, 50, .55);
    --wallpaper:
        radial-gradient(80% 60% at 18% 22%, rgba(40, 110, 170, .7) 0%, transparent 60%),
        radial-gradient(70% 55% at 85% 18%, rgba(90, 50, 170, .65) 0%, transparent 62%),
        radial-gradient(90% 70% at 70% 95%, rgba(10, 25, 90, .95) 0%, transparent 70%),
        radial-gradient(60% 50% at 10% 90%, rgba(0, 90, 120, .6) 0%, transparent 65%),
        linear-gradient(165deg, #12305a 0%, #0f1f4a 45%, #0a1033 100%);
}

/* ---------- Materiale vetro ---------- */
.dock, .lg-glass { position: relative; }
.dock, .dropdown, .ctx, .control, .spotlight, .toast, .lg-glass {
    background: var(--lg-tint);
    backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
    -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
    border: 0;
    box-shadow:
        inset 0 1px 0 var(--lg-edge),
        inset 0 -1px 0 var(--lg-edge-soft),
        inset 0 0 0 .5px var(--lg-edge-soft),
        var(--lg-shadow);
}
/* Rifrazione: solo nei browser Chromium, che supportano filtri SVG nel backdrop (classe messa dal JS) */
.lg-refract .dock, .lg-refract .control, .lg-refract .spotlight {
    backdrop-filter: url(#lg-refract) blur(var(--lg-blur)) saturate(var(--lg-sat));
}
/* Riflesso speculare sul bordo */
.dock::before, .dropdown::before, .ctx::before, .control::before, .spotlight::before, .toast::before, .lg-glass::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.12) 28%, rgba(255,255,255,0) 50%, rgba(255,255,255,.1) 72%, rgba(255,255,255,.55) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: .9;
}
:root[data-theme="dark"] .dock::before, :root[data-theme="dark"] .dropdown::before, :root[data-theme="dark"] .ctx::before,
:root[data-theme="dark"] .control::before, :root[data-theme="dark"] .spotlight::before, :root[data-theme="dark"] .toast::before,
:root[data-theme="dark"] .lg-glass::before { opacity: .35; }

@media (prefers-reduced-transparency: reduce) {
    .dock, .dropdown, .ctx, .control, .spotlight, .toast, .lg-glass { background: var(--lg-tint-strong); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); }
    .lg-refract .dock, .lg-refract .control, .lg-refract .spotlight { backdrop-filter: blur(40px); }
}

/* ---------- Barra dei menu trasparente ---------- */
.menubar {
    background: linear-gradient(rgba(0,0,0,.14), rgba(0,0,0,0));
    backdrop-filter: none; -webkit-backdrop-filter: none;
    color: var(--menu-text);
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    height: 28px; --menubar-h: 28px;
}
.menubar button, .menu-app, .menu-clock { border-radius: var(--r-control); padding: 2px 10px; height: 22px; }
.menubar button:hover, .menubar button.open { background: var(--lg-hover); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.35); }
.desktop { inset: 28px 0 0 0; }

/* ---------- Menu a tendina e tasto destro ---------- */
.dropdown, .ctx { border-radius: 14px; padding: 6px; color: var(--text); min-width: 230px; }
.dropdown { top: 32px; }
.dropdown button, .ctx button { border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.dropdown hr, .ctx hr { margin: 5px 10px; border-top-color: rgba(127,127,127,.25); }
.dropdown button:hover:not(:disabled), .ctx button:hover:not(:disabled) { background: var(--accent); color: #fff; }

/* ---------- Dock ---------- */
.dock-wrap { bottom: 8px; }
.dock { border-radius: 28px; padding: 7px 9px; gap: 4px; align-items: flex-end; overflow: visible; }
.dock-item { width: 54px; height: 54px; transition: width .12s ease-out, height .12s ease-out; will-change: width, height; }
.dock-item .ico { border-radius: 24%; box-shadow: 0 3px 8px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.5), inset 0 0 0 .5px rgba(255,255,255,.35); }
.dock-item::after {
    background: var(--lg-tint-strong); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-radius: var(--r-control); padding: 4px 12px; font-weight: 500;
    box-shadow: inset 0 1px 0 var(--lg-edge), var(--lg-shadow);
}
.dock-item.running::before { width: 5px; height: 5px; margin-left: -2.5px; bottom: -6px; background: var(--menu-text); opacity: .85; box-shadow: 0 0 4px rgba(0,0,0,.3); }
.dock-sep { background: rgba(255,255,255,.35); margin: 6px 6px; }
.dock.magnify .dock-item { transition: width .06s linear, height .06s linear; }

/* ---------- Finestre ---------- */
.window {
    border-radius: var(--r-window);
    background: var(--win-bg);
    box-shadow: 0 30px 80px rgba(0,0,0,.30), 0 8px 24px rgba(0,0,0,.14), 0 0 0 .5px rgba(0,0,0,.18);
    transition: box-shadow .2s;
    animation: none;
}
:root[data-theme="dark"] .window { box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 8px 24px rgba(0,0,0,.4), 0 0 0 .5px rgba(255,255,255,.14); }
.window.inactive { box-shadow: 0 16px 40px rgba(0,0,0,.18), 0 0 0 .5px rgba(0,0,0,.14); }
.window > .titlebar { border-radius: var(--r-window) var(--r-window) 0 0; background: var(--win-bg); border-bottom: 0; height: 44px; padding: 0 16px; }
.window > .win-body { border-radius: 0 0 var(--r-window) var(--r-window); }
.titlebar .title { color: var(--text); font-weight: 600; opacity: .85; }
.window.inactive .titlebar .title { opacity: .45; }
.lights { gap: 9px; }
.lights button { width: 13px; height: 13px; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.18), inset 0 1px 1px rgba(255,255,255,.35); }

/* Finder: barra laterale galleggiante in vetro, angoli concentrici con la finestra */
.window .finder { grid-template-columns: 200px 1fr; }
.window .finder .sidebar, .window .notes .notes-list {
    margin: 0 0 10px 10px; border-radius: calc(var(--r-window) - 8px);
    background: var(--win-sidebar);
    backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border: 0; box-shadow: inset 0 1px 0 var(--lg-edge-soft), inset 0 0 0 .5px rgba(127,127,127,.18), 0 2px 10px rgba(0,0,0,.06);
}
.window .notes { grid-template-columns: 220px 1fr; }
.sidebar button { border-radius: 10px; padding: 5px 10px; }
.sidebar button.active { background: rgba(127,127,127,.18); }
.note-item { border-bottom: 0; border-radius: 10px; margin: 2px 6px; width: calc(100% - 12px); }
.note-item.active { background: rgba(255, 204, 0, .35); }
.notes-list .bar { border-bottom: 0; }
.notes textarea { border-radius: 0 0 var(--r-window) 0; }

/* Barra strumenti: controlli a capsula in vetro */
.toolbar { border-bottom: 0; padding: 8px 12px; gap: 8px; }
.toolbar button {
    border-radius: var(--r-control); padding: 4px 12px; background: rgba(127,127,127,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 0 0 .5px rgba(127,127,127,.2);
}
.toolbar button:hover:not(:disabled) { background: rgba(127,127,127,.22); }
.toolbar [data-nav] { width: 30px; padding: 4px 0; }
.crumbs button { border-radius: var(--r-control); }
.statusbar { border-top: 0; padding: 6px 16px 10px; }
.file { border-radius: 12px; }
.file.sel { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.files .ico { border-radius: 14px; }

/* Dialoghi (sheet) */
.sheet-bg { inset: 44px 0 0; background: transparent; border-radius: 0 0 var(--r-window) var(--r-window); }
.sheet {
    border-radius: 20px; margin-top: 10px; background: var(--lg-tint-strong);
    backdrop-filter: blur(30px) saturate(1.8); -webkit-backdrop-filter: blur(30px) saturate(1.8);
    box-shadow: inset 0 1px 0 var(--lg-edge), inset 0 0 0 .5px var(--lg-edge-soft), 0 20px 50px rgba(0,0,0,.3);
    animation: lgPop .28s cubic-bezier(.2,1.2,.3,1);
}
@keyframes lgPop { from { transform: scale(.9); opacity: 0; } }
.btn { border-radius: var(--r-control); padding: 5px 16px; }
.sheet input, .sheet select, .pane .field input { border-radius: 10px; }

/* Calcolatrice: tasti in vetro */
.calc { background: rgba(28, 28, 30, .92); border-radius: 0 0 var(--r-window) var(--r-window); }
.window:has(.calc) > .titlebar { background: rgba(28, 28, 30, .92); }
.window:has(.calc) .titlebar .title { color: #fff; }
.calc-keys button { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 0 0 .5px rgba(255,255,255,.08); transition: filter .1s, transform .1s; }
.calc-keys button:active { transform: scale(.94); }

/* Impostazioni */
.seg { border-radius: var(--r-control); padding: 3px; background: rgba(127,127,127,.14); }
.seg button { border-radius: var(--r-control); }
.walls button { border-radius: 14px; }

/* ---------- Spotlight, Centro di controllo, notifiche ---------- */
.spotlight { border-radius: 30px; top: 20%; }
.spotlight input { padding: 16px 24px; font-size: 24px; }
#spotlightResults button { border-radius: 12px; margin: 0 8px; width: calc(100% - 16px); }
.control { border-radius: 26px; padding: 12px; top: 34px; }
.cc-tile { border-radius: 20px; background: rgba(255,255,255,.2); box-shadow: inset 0 1px 0 var(--lg-edge-soft), inset 0 0 0 .5px var(--lg-edge-soft); }
:root[data-theme="dark"] .cc-tile { background: rgba(255,255,255,.08); }
.toast { border-radius: 20px; padding: 12px 16px; top: 38px; animation: lgSlide .4s cubic-bezier(.2,1.1,.3,1); }
@keyframes lgSlide { from { transform: translateX(120%); } }

/* ---------- Launchpad e blocco schermo ---------- */
.launchpad { background: rgba(0,0,0,.18); backdrop-filter: blur(50px) saturate(1.6); -webkit-backdrop-filter: blur(50px) saturate(1.6); }
.launchpad input { border-radius: var(--r-control); background: rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); padding: 7px 16px; }
.lp-grid .ico { border-radius: 24%; }
.lock-input { border-radius: var(--r-control); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 0 0 .5px rgba(255,255,255,.3); }
.avatar { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 6px 24px rgba(0,0,0,.25); }

/* Icone sulla scrivania */
.desk-icon { border-radius: 12px; }
.desk-icon:focus, .desk-icon.sel { background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.35); }

@media (prefers-reduced-motion: reduce) { .dock-item { transition: none; } }

/* Menu più leggibili: vetro più denso dove c'è testo da leggere */
.dropdown, .ctx, .toast { background: rgba(246, 246, 250, .62); }
:root[data-theme="dark"] .dropdown, :root[data-theme="dark"] .ctx, :root[data-theme="dark"] .toast { background: rgba(36, 36, 42, .62); }

/* ---------- Icone App Store e Monitoraggio, app installate ---------- */
.ico-appstore { background: linear-gradient(160deg, #1ec8ff, #0a6cff); }
.ico-appstore::before { content: ""; position: absolute; inset: 24%; background:
    linear-gradient(60deg, transparent 44%, #fff 44% 56%, transparent 56%),
    linear-gradient(-60deg, transparent 44%, #fff 44% 56%, transparent 56%),
    linear-gradient(transparent 70%, #fff 70% 80%, transparent 80%); }
.ico-activity { background: linear-gradient(160deg, #3a3a3e, #111113); }
.ico-activity::before { content: ""; position: absolute; inset: 22% 16%; background:
    linear-gradient(135deg, transparent 46%, #34c759 46% 54%, transparent 54%) 0 0 / 34% 100% no-repeat,
    linear-gradient(45deg, transparent 46%, #34c759 46% 54%, transparent 54%) 33% 0 / 34% 100% no-repeat,
    linear-gradient(135deg, transparent 46%, #34c759 46% 54%, transparent 54%) 66% 0 / 34% 100% no-repeat; }
.ico-web { background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.ico-web img { width: 78%; height: 78%; object-fit: contain; }
.dock-apps { display: contents; }
.webapp { width: 100%; height: 100%; border: 0; display: block; background: #fff; border-radius: 0 0 var(--r-window) var(--r-window); }
.logview { margin: 0; padding: 14px 16px; height: 100%; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, monospace; background: #1c1c1e; color: #e5e5e7; white-space: pre-wrap; word-break: break-all; border-radius: 0 0 var(--r-window) var(--r-window); user-select: text; }

/* ---------- App Store ---------- */
.as-wrap { height: 100%; }
.as-side small { margin-left: auto; color: var(--muted); }
.as-main { overflow: auto; padding: 6px 26px 26px; min-width: 0; }
.as-main h2 { margin: 6px 0 2px; font-size: 26px; letter-spacing: -.01em; }
.as-sub { color: var(--muted); margin: 0 0 14px; }
.as-empty { color: var(--muted); text-align: center; padding: 50px 20px; }
.as-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 10px; }
.as-card { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(127,127,127,.07); cursor: default; transition: background .15s, transform .15s; }
.as-card:hover { background: rgba(127,127,127,.13); }
.as-card:focus-visible { outline: 2px solid var(--accent); }
.as-card img, .as-detail header img { width: 52px; height: 52px; border-radius: 12px; background: #fff; padding: 6px; object-fit: contain; box-shadow: 0 2px 8px rgba(0,0,0,.12), inset 0 0 0 .5px rgba(0,0,0,.08); }
.as-info { min-width: 0; display: flex; flex-direction: column; }
.as-info strong { font-size: 14px; }
.as-info span { color: var(--muted); font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.as-btn { border-radius: 999px; padding: 4px 16px; font-weight: 700; font-size: 13px; color: var(--accent); background: rgba(10,132,255,.12); cursor: pointer; }
.as-btn:hover { background: rgba(10,132,255,.2); }
.as-btn.warn { color: #ff3b30; background: rgba(255,59,48,.12); }
.as-progress { width: 64px; height: 6px; border-radius: 3px; background: rgba(127,127,127,.25); overflow: hidden; }
.as-progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.as-detail { max-width: 760px; }
.as-back { color: var(--accent); padding: 8px 0; font-weight: 600; cursor: pointer; }
.as-detail header { display: flex; align-items: center; gap: 16px; margin: 6px 0 16px; }
.as-detail header img { width: 84px; height: 84px; border-radius: 20px; padding: 10px; }
.as-detail header h2 { margin: 0; }
.as-head-act { margin-left: auto; }
.as-detail h3 { margin: 22px 0 6px; font-size: 16px; }
.as-step { color: var(--accent); font-weight: 600; }
.as-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.as-facts div { padding: 10px 12px; border-radius: 12px; background: rgba(127,127,127,.08); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.as-facts span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.as-facts strong { overflow-wrap: anywhere; }
.as-note { padding: 12px 14px; border-radius: 12px; background: rgba(10,132,255,.1); line-height: 1.5; }
.as-note.err { background: rgba(255,59,48,.1); }
.as-note code { font-size: 12px; overflow-wrap: anywhere; }
.as-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.as-detail a { color: var(--accent); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.on { background: rgba(40,200,64,.15); color: #1f9d3a; }
.pill.off { background: rgba(127,127,127,.18); color: var(--muted); }

/* ---------- Monitoraggio Attività ---------- */
.am { padding: 4px 18px 16px; display: flex; flex-direction: column; gap: 14px; height: 100%; overflow: auto; }
.am-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.am-tile { padding: 12px 14px; border-radius: 16px; background: rgba(127,127,127,.08); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.am-tile span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.am-tile strong { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.am-tile small { color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 34px; margin-top: 6px; }
.am-bar { height: 6px; border-radius: 3px; background: rgba(127,127,127,.2); margin-top: 12px; overflow: hidden; }
.am-bar i { display: block; height: 100%; background: #ff9f0a; }
.am-table-wrap { overflow-x: auto; border-radius: 14px; background: rgba(127,127,127,.05); }
.am-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.am-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.am-table th[data-sort] { cursor: pointer; }
.am-table th.sorted { color: var(--accent); }
.am-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.am-table tr:last-child td { border-bottom: 0; }
.am-table td img { width: 18px; height: 18px; vertical-align: -4px; margin-right: 8px; border-radius: 4px; background: #fff; }
.am-table .num { text-align: right; }
