/* ViceDeck Restart-to-Update flow (ui/update-flow.js). Uses the theme tokens from styles.css. */

.vdu-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Topbar button ---- */
.update-restart-btn.vdu-top {
  display: inline-flex; align-items: center; gap: 6px; min-width: 112px; justify-content: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  animation: none; transform: none;
}
.vdu-top .vdu-ico { font-size: 12px; line-height: 1; display: inline-block; }
.vdu-top .vdu-ver {
  font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.22); letter-spacing: 0.02em;
}
.vdu-top[data-state="uptodate"] { color: var(--text-muted); }
.vdu-top[data-state="uptodate"] .vdu-ico { color: var(--accent-green); }
.vdu-top[data-state="ready"] {
  background: var(--vice-gradient); color: #fff; border-color: transparent; font-weight: 800;
  box-shadow: 0 0 0 0 rgba(232, 93, 153, 0.55), var(--vice-glow);
  animation: vduPulse 2.4s ease-in-out infinite;
}
.vdu-top[data-state="ready"]:hover { background: var(--vice-gradient-hover); }
.vdu-top[data-state="ready"][data-bad="1"] { animation: none; box-shadow: none; outline: 1px solid var(--accent-amber); }
.vdu-top[data-state="checking"] .vdu-ico,
.vdu-top[data-state="updating"] .vdu-ico,
.vdu-top[data-state="restarting"] .vdu-ico,
.vdu-top[data-state="health"] .vdu-ico { animation: vduSpin 1s linear infinite; }
.vdu-top[data-state="updating"],
.vdu-top[data-state="restarting"],
.vdu-top[data-state="health"] {
  color: #fff; border-color: rgba(232, 93, 153, 0.6);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.34), rgba(232, 93, 153, 0.36));
}
.vdu-top[data-state="rolled_back"] {
  color: #1b1405; background: var(--accent-amber); border-color: transparent; font-weight: 800;
}
.vdu-top[data-state="error"] { color: var(--accent-amber); }
.vdu-top:focus-visible, .vdu-mini:focus-visible, .vdu-banner button:focus-visible, .vdu-modal button:focus-visible {
  outline: 2px solid #fff; outline-offset: 2px;
}

@keyframes vduPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 153, 0.5), 0 4px 16px rgba(232, 93, 153, 0.28); }
  50% { box-shadow: 0 0 0 5px rgba(232, 93, 153, 0), 0 4px 22px rgba(232, 93, 153, 0.5); }
}
@keyframes vduSpin { to { transform: rotate(360deg); } }

/* ---- Session card line ---- */
.vdu-side {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-muted);
}
.vdu-side-txt { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.vdu-side .vdu-ok span[aria-hidden] { color: var(--accent-green); }
.vdu-side .vdu-warn { color: var(--accent-amber); font-weight: 700; }
.vdu-mini {
  font: 700 11px var(--font-display); color: var(--text-main); cursor: pointer;
  padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border-highlight); background: var(--bg-elev);
}
.vdu-mini:hover { border-color: var(--vice-accent-1); }
.vdu-mini-go { background: var(--vice-gradient); border-color: transparent; color: #fff; }
.vdu-spin {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: var(--vice-accent-1);
  animation: vduSpin 0.9s linear infinite;
}

/* ---- Home banner ---- */
.vdu-banner {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  margin-bottom: 12px; padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(90deg, rgba(232, 93, 153, 0.16), rgba(123, 92, 246, 0.16));
  border: 1px solid rgba(232, 93, 153, 0.45); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  animation: fadeSlideIn 0.18s ease-out;
}
.vdu-banner.hidden { display: none; }
.vdu-banner-ok { background: rgba(56, 217, 107, 0.09); border-color: rgba(56, 217, 107, 0.45); }
.vdu-banner-warn { background: rgba(245, 166, 66, 0.1); border-color: rgba(245, 166, 66, 0.55); }
.vdu-banner-main { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.vdu-banner-title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 13.5px; }
.vdu-banner-sub { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.vdu-badge {
  font: 800 10px var(--font-display); letter-spacing: 0.08em; padding: 3px 8px; border-radius: 999px;
  background: var(--vice-gradient); color: #fff;
}
.vdu-badge-ok { background: var(--accent-green); color: #08240f; }
.vdu-badge-warn { background: var(--accent-amber); color: #2a1a04; }
.vdu-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vdu-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--text-muted);
  border: 1px solid var(--border-highlight); background: rgba(0, 0, 0, 0.18);
}
.vdu-chip-warn { color: var(--accent-amber); border-color: rgba(245, 166, 66, 0.6); }
.vdu-changes { list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12px; max-height: 128px; overflow: auto; }
.vdu-changes li { overflow-wrap: anywhere; }
.vdu-changes li::before { content: "•"; color: var(--vice-accent-1); margin-right: 7px; }
.vdu-changes code, .vdu-modal code { font-size: 11px; color: #f3c3d8; }
.vdu-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vdu-go { background: var(--vice-gradient); color: #fff; border-color: transparent; }

/* ---- Modals ---- */
.vdu-modal { z-index: 110; }
.vdu-card { width: 520px; max-width: calc(100vw - 32px); }
.vdu-vline { font-size: 14px; }
.vdu-keep-head { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.vdu-keep { list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.vdu-keep span[aria-hidden] { color: var(--accent-green); margin-right: 4px; }
.vdu-note { font-size: 11.5px; }
.vdu-blocked {
  font-size: 12.5px; padding: 8px 10px; border-radius: 8px;
  background: rgba(245, 166, 66, 0.12); border: 1px solid rgba(245, 166, 66, 0.55);
}
.vdu-blocked.hidden { display: none; }

.vdu-stages { list-style: none; display: flex; flex-direction: column; gap: 2px; counter-reset: vdu; }
.vdu-stages li {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--text-subtle);
}
.vdu-st-detail { font-size: 11px; color: var(--text-muted); }
.vdu-st-ico {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.18); font-size: 10px; font-weight: 800;
}
.vdu-stages li[data-state="active"] { color: var(--text-main); background: rgba(232, 93, 153, 0.1); font-weight: 700; }
.vdu-stages li[data-state="active"] .vdu-st-ico { border-color: rgba(255, 255, 255, 0.2); border-top-color: var(--vice-accent-1); animation: vduSpin 0.9s linear infinite; }
.vdu-stages li[data-state="done"] { color: var(--text-main); }
.vdu-stages li[data-state="done"] .vdu-st-ico { border-color: var(--accent-green); background: var(--accent-green); color: #08240f; }
.vdu-stages li[data-state="done"] .vdu-st-ico::after { content: "✓"; }
.vdu-stages li[data-state="failed"] { color: var(--accent-amber); font-weight: 700; }
.vdu-stages li[data-state="failed"] .vdu-st-ico { border-color: var(--accent-amber); background: var(--accent-amber); color: #2a1a04; }
.vdu-stages li[data-state="failed"] .vdu-st-ico::after { content: "!"; }
.vdu-stages li[data-state="skipped"] { opacity: 0.45; text-decoration: line-through; }
.vdu-prog-msg { font-size: 12.5px; min-height: 18px; color: var(--text-muted); }
.vdu-elapsed { font-size: 11px; }
.vdu-result { font-size: 12.5px; padding: 10px 12px; border-radius: 8px; line-height: 1.5; overflow-wrap: anywhere; }
.vdu-result.hidden { display: none; }
.vdu-result-ok { background: rgba(56, 217, 107, 0.1); border: 1px solid rgba(56, 217, 107, 0.45); }
.vdu-result-warn { background: rgba(245, 166, 66, 0.1); border: 1px solid rgba(245, 166, 66, 0.55); }
.vdu-files-h { margin-top: 8px; font-weight: 600; }
.vdu-files { margin: 4px 0 0 18px; padding: 0; max-height: 140px; overflow: auto; }
.vdu-files li { margin: 1px 0; }
.vdu-files-note { margin-top: 8px; font-size: 11.5px; }
.vdu-choice { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.vdu-feed-row { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.vdu-feed-inputs { display: flex; gap: 6px; }
.vdu-feed-inputs input { flex: 1; min-width: 0; }

@media (max-width: 720px) {
  .update-restart-btn.vdu-top { min-width: 0; }
  .vdu-top .vdu-lbl { display: none; }
  .vdu-top[data-state="ready"] .vdu-lbl { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .vdu-top[data-state="ready"] { animation: none; box-shadow: var(--vice-glow); }
  .vdu-top .vdu-ico, .vdu-spin, .vdu-stages li[data-state="active"] .vdu-st-ico, .vdu-banner { animation: none !important; }
}
