/* =========================================================================
   demo.css — in-browser app simulation
   ========================================================================= */
:root { --ring-track: rgba(255,255,255,0.08); }
:root[data-theme="light"] { --ring-track: rgba(20,20,60,0.1); }

.demo-body { background: transparent; overflow: hidden; height: 100vh; }
.demo-body::before {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(109,94,246,0.32), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(56,198,232,0.14), transparent 60%),
    linear-gradient(180deg, #0a0a18, #0c0b1c);
}
:root[data-theme="light"] .demo-body::before {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(109,94,246,0.2), transparent 60%),
    linear-gradient(180deg, #eef1fb, #f4f5fd);
}

.app { display: flex; flex-direction: column; height: 100vh; position: relative; }

/* ---- Title bar ---- */
.app-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent);
  border-bottom: 1px solid var(--border);
}
.app-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 0.98rem; }
.app-brand .brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.app-demo-tag { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; padding: 3px 7px; border-radius: 6px; background: var(--brand-glow); color: #fff; }
.app-titlebar-right { display: flex; align-items: center; gap: 10px; }
.app-titlebar-right .lang-btn { padding: 6px 10px; font-size: 0.82rem; }
.app-theme { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.app-theme:hover { border-color: var(--brand-2); }
.ico-moon { display: none; }
:root[data-theme="light"] .ico-sun { display: none; }
:root[data-theme="light"] .ico-moon { display: block; }
.app-winctl { display: inline-flex; gap: 14px; margin-inline-start: 6px; }
.app-winctl i { width: 12px; height: 2px; background: var(--text-faint); align-self: center; }
.app-winctl i.x { width: 12px; height: 12px; background: none; position: relative; }
.app-winctl i.x::before, .app-winctl i.x::after { content: ""; position: absolute; inset: 5px 0; height: 2px; background: var(--text-faint); }
.app-winctl i.x::before { transform: rotate(45deg); } .app-winctl i.x::after { transform: rotate(-45deg); }

/* ---- Nav ---- */
.app-nav { display: flex; justify-content: center; gap: 8px; padding: 12px; flex-shrink: 0; flex-wrap: wrap; }
.app-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 12px;
  color: var(--text-muted); font-weight: 700; font-size: 0.92rem; transition: 0.2s;
}
.app-tab:hover { color: var(--text); background: var(--panel); }
.app-tab.active { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 8px 22px -8px var(--brand-glow); }
.app-tab.center:not(.active) { background: var(--panel); border: 1px solid var(--border); color: var(--text); }

/* ---- Body scroll ---- */
.app-body { flex: 1; overflow-y: auto; padding: 8px clamp(14px, 4vw, 42px) 40px; scroll-behavior: smooth; }
.app-body::-webkit-scrollbar { width: 10px; }
.app-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

.view { max-width: 960px; margin-inline: auto; animation: viewIn 0.35s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.view-head { margin: 10px 0 20px; }
.view-head.with-action { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.view-head h1 { font-size: 1.7rem; }
.view-head p { color: var(--text-muted); margin-top: 6px; font-size: 0.95rem; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }

/* ---- Banner ---- */
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 18px; overflow: hidden; position: relative;
  border: 1px solid var(--border-strong);
  background:
    radial-gradient(600px 200px at 90% 0%, rgba(109,94,246,0.5), transparent 60%),
    linear-gradient(120deg, rgba(20,20,45,0.9), rgba(30,20,60,0.7));
}
:root[data-theme="light"] .banner { background: radial-gradient(600px 200px at 90% 0%, rgba(109,94,246,0.28), transparent 60%), linear-gradient(120deg, #fff, #eef0fc); }
.banner-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; color: var(--brand-2); }
.banner-copy h2 { font-size: 1.55rem; margin: 8px 0 6px; }
.banner-copy p { color: var(--text-muted); font-size: 0.9rem; max-width: 460px; }
.banner-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; flex-shrink: 0; }
.banner-reclaimed { font-size: 0.82rem; color: var(--text-muted); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.banner-reclaimed b { color: var(--green); }
.toolbox-banner { min-height: 120px; }

/* ---- Health panel ---- */
.health-panel { display: flex; flex-direction: column; align-items: center; padding: 30px; }
.health-ring { position: relative; width: 180px; height: 180px; display: grid; place-items: center; }
.health-ring svg { position: absolute; }
#healthArc, #verdictArc { transition: stroke-dashoffset 1.1s var(--ease), stroke 0.5s; }
.health-face, .verdict-face { display: flex; flex-direction: column; align-items: center; color: var(--green); transition: color 0.5s; }
.health-num { font-size: 1.7rem; font-weight: 800; margin-top: -6px; color: var(--text); }
.health-label { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-faint); margin-top: 16px; }
.health-status { font-weight: 800; font-size: 1.05rem; margin-top: 2px; }

/* ---- Metric grid ---- */
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.metric {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px;
}
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.metric-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }
.metric-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); }
.metric-ico svg { width: 15px; height: 15px; }
.metric-val { font-size: 1.7rem; font-weight: 800; }
.metric-spark { height: 3px; border-radius: 3px; margin: 10px 0 8px; background: linear-gradient(90deg, var(--brand), var(--green)); opacity: 0.8; }
.metric-sub { font-size: 0.76rem; color: var(--text-faint); }

/* ---- Info / disk / proc ---- */
.info-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-item span { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--text-faint); display: block; }
.info-item b { font-size: 1.05rem; }
.disk-panel h3, .proc-panel h3, .reco-title { font-size: 0.74rem; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: 14px; }
.disk-row { display: grid; grid-template-columns: 32px 1fr auto auto; gap: 14px; align-items: center; margin-bottom: 10px; }
.disk-name { font-weight: 700; }
.disk-bar { height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.disk-bar i { display: block; height: 100%; border-radius: 6px; }
.disk-val { font-weight: 700; font-size: 0.86rem; } .disk-pct { color: var(--text-muted); font-size: 0.86rem; min-width: 38px; text-align: end; }
.proc-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; align-items: center; padding: 9px 12px; border-radius: 10px; }
.proc-row:hover { background: var(--panel); }
.proc-mem { font-weight: 700; text-align: end; font-size: 0.88rem; }
.proc-name { font-family: var(--mono); font-size: 0.84rem; color: var(--text-muted); }
.proc-cpu { color: var(--text-muted); font-size: 0.84rem; }

/* ---- Scan progress ---- */
.scan-progress-top { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 12px; }
.progress-track { height: 10px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.progress-track i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.3s var(--ease); }
.scan-checklist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 18px; }
.scan-check { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; color: var(--text-muted); padding: 6px 4px; }
.scan-check .sc-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; position: relative; transition: 0.3s; }
.scan-check.active .sc-dot { border-color: var(--brand-2); }
.scan-check.done .sc-dot { border-color: var(--green); background: var(--green); }
.scan-check.done .sc-dot::after { content: ""; position: absolute; inset: 2px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='%23071' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-size: contain; }
.scan-check.done { color: var(--text); }

/* ---- Verdict ---- */
.verdict-panel { display: flex; gap: 26px; align-items: center; }
.verdict-ring { position: relative; width: 150px; height: 150px; display: grid; place-items: center; flex-shrink: 0; }
.verdict-ring svg { position: absolute; }
.verdict-face { color: var(--amber); }
.verdict-num { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-top: -4px; }
.verdict-eyebrow { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--text-faint); }
.verdict-copy h2 { font-size: 1.3rem; margin: 6px 0 8px; }
.verdict-forecast { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 0.88rem; }
.verdict-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.vtag { font-size: 0.78rem; padding: 5px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--border); color: var(--text-muted); }

/* ---- Recommendations ---- */
.reco-title { margin-top: 24px; }
.reco {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  border-inline-start: 4px solid var(--rc, var(--brand)); transition: 0.3s;
}
.reco.removing { opacity: 0; transform: translateX(20px); }
.reco-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--rc) 16%, transparent); color: var(--rc); flex-shrink: 0; }
.reco-ico svg { width: 20px; height: 20px; }
.reco-body { flex: 1; min-width: 0; }
.reco-body b { display: block; font-size: 0.98rem; }
.reco-body span { color: var(--text-muted); font-size: 0.84rem; }
.reco-conf { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.reco-act { padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 0.86rem; background: var(--panel-2); border: 1px solid var(--border-strong); color: var(--text); transition: 0.2s; }
.reco-act:hover { border-color: var(--brand-2); }
.reco-act.primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; border: none; }

/* ---- Category grid ---- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cat {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  position: relative;
}
.cat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cat-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--cc, var(--brand)) 16%, transparent); color: var(--cc, var(--brand)); }
.cat-ico svg { width: 18px; height: 18px; }
.cat-num { font-size: 1.6rem; font-weight: 800; }
.cat-name { font-size: 0.86rem; color: var(--text-muted); }
.cat-badge { font-size: 0.6rem; font-weight: 800; letter-spacing: 0.05em; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; }

/* ---- Subtabs ---- */
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.subtabs.small { border-bottom: none; margin-bottom: 14px; }
.subtab { padding: 12px 16px; font-weight: 700; font-size: 0.92rem; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; transition: 0.2s; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--brand-2); }
.subtabs.small .subtab { font-size: 0.86rem; padding: 8px 12px; }

/* ---- Clean ---- */
.clean-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.mode-toggle { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 4px; gap: 2px; }
.mode-btn { padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 0.88rem; color: var(--text-muted); transition: 0.2s; }
.mode-btn.active { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; }
.clean-btns { margin-inline-start: auto; display: flex; gap: 10px; }
.clean-mode-desc { flex-basis: 100%; color: var(--text-muted); font-size: 0.88rem; margin: 0; }
.clean-status { font-weight: 700; margin-bottom: 14px; }
.clean-status .risky { color: var(--amber); }
.clean-list { display: flex; flex-direction: column; gap: 8px; }
.clean-item {
  display: grid; grid-template-columns: 24px 66px 92px 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px;
  transition: opacity 0.4s, transform 0.4s;
}
.clean-item.removing { opacity: 0; transform: scale(0.96); }
.clean-check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border-strong); cursor: pointer; display: grid; place-items: center; transition: 0.15s; }
.clean-check.on { background: var(--brand); border-color: var(--brand); }
.clean-check.on::after { content: ""; width: 11px; height: 11px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M20 6L9 17l-5-5' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-size: contain; }
.clean-size { font-weight: 800; }
.clean-path { font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clean-cat { font-size: 0.8rem; color: var(--text-faint); }

/* ---- Toolbox ---- */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.25s; text-align: start;
}
.tool:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.tool-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; }
.tool-ico svg { width: 22px; height: 22px; }
.tool b { display: block; font-size: 1rem; margin-bottom: 4px; }
.tool span { font-size: 0.82rem; color: var(--text-muted); }

/* ---- Protect ---- */
.protect-controls { display: flex; flex-direction: column; gap: 16px; }
.protect-folder { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.protect-folder > label { flex-basis: 100%; font-size: 0.82rem; color: var(--text-muted); }
.protect-input { flex: 1; min-width: 220px; display: flex; gap: 8px; }
.protect-input input { flex: 1; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; color: var(--text); font-family: var(--mono); font-size: 0.84rem; }
.folder-btn { width: 42px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); display: grid; place-items: center; }
.protect-depth { display: inline-flex; gap: 4px; }
.depth-btn { padding: 9px 14px; border-radius: 10px; font-weight: 700; font-size: 0.86rem; color: var(--text-muted); border-bottom: 2px solid transparent; }
.depth-btn.active { color: var(--text); border-bottom-color: var(--brand-2); }
.engines-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.86rem; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 14px; }
.engine { font-weight: 700; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); }
.engine.ok { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.engine.off { color: var(--text-faint); }
.engine-link { color: var(--red); font-weight: 700; cursor: pointer; }
.yara-file { font-size: 0.78rem; color: var(--text-faint); margin-top: 12px; height: 1.2em; overflow: hidden; }
.threat {
  display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); border-inline-start: 4px solid var(--tc, var(--red));
}
.threat-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 16%, transparent); color: var(--tc); flex-shrink: 0; }
.threat-ico svg { width: 20px; height: 20px; }
.threat-body { flex: 1; min-width: 0; }
.threat-body b { display: block; } .threat-body span { font-size: 0.8rem; color: var(--text-muted); font-family: var(--mono); }
.threat-act { padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 0.82rem; background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
.protect-summary { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 4px 0 14px; }
.protect-summary.clean { color: var(--green); }

/* ---- Settings ---- */
.set-block h3 { font-size: 1rem; margin-bottom: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: none; }
.set-row b { display: block; } .set-row span { font-size: 0.84rem; color: var(--text-muted); }
.accent-swatches { display: flex; gap: 8px; }
.accent-sw { width: 30px; height: 30px; border-radius: 9px; cursor: pointer; border: 2px solid transparent; transition: 0.15s; }
.accent-sw.active { border-color: var(--text); transform: scale(1.08); }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
.about-item span { font-size: 0.76rem; color: var(--text-faint); display: block; }
.about-item b { font-size: 0.94rem; }

/* ---- Empty states ---- */
.scan-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.scan-empty-ico { width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; margin: 0 auto 18px; background: var(--panel); color: var(--brand-2); }
.scan-empty-ico.big { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 14px 34px -12px var(--brand-glow); }
.scan-empty p { max-width: 420px; margin-inline: auto; font-size: 0.94rem; }

/* ---- Toasts ---- */
.toast-host { position: absolute; bottom: 20px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; z-index: 50; }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-radius: 12px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 0.9rem; animation: toastIn 0.3s var(--ease); max-width: 92%;
}
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
.toast-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.toast.ok .toast-ico { background: var(--green-soft); color: var(--green); }
.toast.info .toast-ico { background: var(--brand-glow); color: #fff; }
.toast.warn .toast-ico { background: var(--amber-soft); color: var(--amber); }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(16px); } }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .metric-grid, .info-panel, .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .banner { flex-direction: column; align-items: flex-start; }
  .verdict-panel { flex-direction: column; text-align: center; }
  .clean-item { grid-template-columns: 24px 1fr auto; }
  .clean-item .clean-path, .clean-item .clean-cat { grid-column: 2 / -1; }
  .app-tab span { display: none; }
  .app-tab { padding: 10px 14px; }
  .app-tab.center span { display: inline; }
  .scan-checklist { grid-template-columns: 1fr; }
}
