/* ============================================================================
   FileSeb — Processing Pro
   The "cinematic" processing screen + device-adaptive performance mode.
   Loaded after style.css / workspace-pro.css. Presentation only.
   ========================================================================== */

/* ── Overlay shell ──────────────────────────────────────────────────────── */
.px-overlay {
  position: absolute; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: 22px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(10, 16, 34, .82), rgba(4, 7, 18, .94));
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  animation: pxFade .3s ease both;
  overflow: hidden;
}
.px-overlay.is-active { display: flex; }
.px-overlay.is-leaving { opacity: 0; transition: opacity .32s ease; }
@keyframes pxFade { from { opacity: 0; } to { opacity: 1; } }

.px-aurora {
  position: absolute; inset: -35%;
  background:
    radial-gradient(36% 36% at 20% 22%, rgba(37, 99, 235, .55), transparent 62%),
    radial-gradient(32% 32% at 80% 28%, rgba(139, 92, 246, .50), transparent 62%),
    radial-gradient(38% 38% at 50% 86%, rgba(6, 182, 212, .42), transparent 62%);
  filter: blur(34px);
  animation: pxDrift 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes pxDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.px-card {
  position: relative;
  width: min(540px, 100%);
  max-height: 100%;
  overflow-y: auto;
  border-radius: 26px;
  padding: 30px 28px 20px;
  text-align: center;
  color: #e9eefb;
  background: linear-gradient(180deg, rgba(17, 24, 44, .94), rgba(8, 12, 26, .97));
  box-shadow:
    0 60px 130px -45px rgba(0, 0, 0, .9),
    0 18px 50px -30px rgba(0, 0, 0, .8),
    inset 0 1px 0 rgba(255, 255, 255, .10);
  animation: pxCardIn .42s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes pxCardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.px-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, rgba(37, 99, 235, .75), rgba(139, 92, 246, .55), rgba(6, 182, 212, .7));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none; opacity: .75;
}

/* ── Progress ring ──────────────────────────────────────────────────────── */
.px-ring { position: relative; width: 176px; height: 176px; margin: 2px auto 16px; }
.px-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.px-ring circle { fill: none; stroke-width: 8.5; stroke-linecap: round; }
.px-ring-track { stroke: rgba(255, 255, 255, .09); }
.px-ring-fill {
  stroke: url(#pxGrad);
  transition: stroke-dashoffset .5s cubic-bezier(.22, 1, .36, 1);
  filter: drop-shadow(0 0 9px rgba(59, 130, 246, .6));
}
.px-ring-sweep {
  position: absolute; inset: 6px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 68%, rgba(125, 211, 252, .55) 82%, rgba(167, 139, 250, .85) 94%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  animation: pxSpin 1.5s linear infinite;
  opacity: .9;
}
@keyframes pxSpin { to { transform: rotate(360deg); } }
.px-ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
}
.px-pct {
  font-size: 42px; font-weight: 900; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, #7dd3fc, #a78bfa 55%, #22d3ee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.px-state {
  font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(233, 238, 251, .58);
}
.px-ring-check {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
}
.px-ring-check svg { position: static; width: 66px; height: 66px; transform: none; }
.px-ring-check svg path {
  stroke: #22c55e; stroke-width: 7; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 42; stroke-dashoffset: 42;
  filter: drop-shadow(0 0 12px rgba(34, 197, 94, .65));
}
.px-overlay.is-done .px-ring-fill { stroke: #22c55e; filter: drop-shadow(0 0 12px rgba(34, 197, 94, .6)); }
.px-overlay.is-done .px-ring-sweep { opacity: 0; }
.px-overlay.is-done .px-ring-center { display: none; }
.px-overlay.is-done .px-ring-check { display: flex; }
.px-overlay.is-done .px-ring-check svg path { animation: pxCheck .5s .1s cubic-bezier(.22, 1, .36, 1) forwards; }
@keyframes pxCheck { to { stroke-dashoffset: 0; } }
.px-overlay.is-error .px-ring-fill { stroke: #ef4444; filter: drop-shadow(0 0 12px rgba(239, 68, 68, .55)); }
.px-overlay.is-error .px-ring-sweep { opacity: 0; }

/* ── Copy ───────────────────────────────────────────────────────────────── */
.px-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 5px; }
.px-file {
  font-size: 12.5px; color: rgba(233, 238, 251, .62);
  max-width: 380px; margin: 0 auto 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.px-file b { color: rgba(233, 238, 251, .9); font-weight: 700; }

/* ── Pipeline stages ────────────────────────────────────────────────────── */
.px-stages { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.px-stage {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 6px 11px; border-radius: 999px;
  color: rgba(233, 238, 251, .45);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  transition: color .3s ease, background .3s ease, border-color .3s ease, transform .3s ease;
}
.px-stage i {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, .2); flex-shrink: 0;
  transition: background .3s ease, box-shadow .3s ease;
}
.px-stage.on {
  color: #eaf1ff;
  background: linear-gradient(120deg, rgba(37, 99, 235, .32), rgba(139, 92, 246, .28));
  border-color: rgba(125, 211, 252, .45);
  transform: translateY(-1px);
}
.px-stage.on i { background: #7dd3fc; box-shadow: 0 0 10px rgba(125, 211, 252, .9); }
.px-stage.done i { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, .8); }
.px-stage.done { color: rgba(233, 238, 251, .75); }

/* ── Live stats ─────────────────────────────────────────────────────────── */
.px-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 12px; border-radius: 16px; margin-bottom: 14px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .07);
}
.px-stat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.px-stat span {
  font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(233, 238, 251, .42);
}
.px-stat strong {
  font-size: 13px; font-weight: 800; color: #eaf1ff;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.px-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.px-trust {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 600; color: rgba(233, 238, 251, .48);
  text-align: left;
}
.px-trust svg { width: 12px; height: 12px; stroke: #22c55e; flex-shrink: 0; }
.px-cancel {
  font-size: 11.5px; font-weight: 800;
  color: #fecaca; background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .35);
  border-radius: 10px; padding: 8px 15px; cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.px-cancel:hover { background: rgba(239, 68, 68, .2); }
.px-cancel:active { transform: scale(.96); }
.px-cancel[hidden] { display: none; }

.px-done-note {
  display: none; font-size: 12px; font-weight: 600; color: rgba(134, 239, 172, .95);
  margin-top: 4px;
}
.px-overlay.is-done .px-done-note { display: block; }
.px-error-note {
  display: none; font-size: 12px; font-weight: 600; color: #fca5a5;
  margin: 6px auto 0; max-width: 400px; line-height: 1.5;
}
.px-overlay.is-error .px-error-note { display: block; }

/* ── Performance mode chip (workspace header) ───────────────────────────── */
.ws-perf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 11px; border-radius: 9px;
  border: 1px solid var(--border-soft); background: var(--bg);
  color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .01em;
  cursor: pointer; flex-shrink: 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease, transform .12s ease;
}
.ws-perf-chip:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); transform: translateY(-1px); }
.ws-perf-chip svg { width: 13px; height: 13px; }
.ws-perf-chip b { color: var(--ink); font-weight: 800; }
.ws-perf-chip.lite { color: #b45309; border-color: color-mix(in srgb, #f59e0b 45%, transparent); }
.ws-perf-chip.ultra { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

/* ── perf-lite: cheaper visuals on low-end devices / reduced motion ────── */
html.perf-lite .px-aurora { animation: none; opacity: .75; }
html.perf-lite .px-ring-sweep { animation-duration: 2.6s; }
html.perf-lite .quick-drop:hover,
html.perf-lite .ws-file:hover,
html.perf-lite .ws-info-card:hover { transform: none; }
html.perf-lite .ws-progress-bar { animation: none; }
html.perf-lite .workspace { backdrop-filter: none; }
html.perf-lite .ws-drop::before { display: none; }

@media (max-width: 560px) {
  .px-card { padding: 24px 18px 16px; border-radius: 22px; }
  .px-ring { width: 148px; height: 148px; }
  .px-pct { font-size: 34px; }
  .px-stats { grid-template-columns: repeat(2, 1fr); }
  .px-foot { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .px-aurora, .px-ring-sweep { animation: none; }
  .px-overlay, .px-card { animation: none; }
}


/* ── Universal document preview (Preview Pro) ───────────────────────────── */
.ws-doc-stage { position: absolute; inset: 0; z-index: 4; display: none; overflow: auto; background: var(--surface); touch-action: pan-y; }
.ws-stage-viewport.has-doc-preview .ws-doc-stage { display: flex; align-items: flex-start; justify-content: center; padding: 14px; }
.ws-stage-viewport.has-doc-preview .ws-stage-badge,
.ws-stage-viewport.has-doc-preview .ws-stage-canvas { display: none !important; }
.ws-doc-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 18px 40px -24px rgba(0, 0, 0, .6); }
.ws-doc-media { max-width: 100%; max-height: 100%; border-radius: 10px; background: #000; }
.ws-doc-frame { width: 100%; height: 100%; min-height: 280px; border: 0; border-radius: 10px; background: #fff; }
.ws-doc-sheet {
  background: #fff; color: #111827; border-radius: 10px; max-width: 100%; max-height: 100%; overflow: auto;
  padding: 22px 26px; text-align: left;
  font: 400 12.5px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 20px 44px -26px rgba(0, 0, 0, .55);
}
.ws-doc-sheet h1, .ws-doc-sheet h2, .ws-doc-sheet h3 { font-size: 15px; margin: 14px 0 6px; color: #0f172a; }
.ws-doc-sheet p { margin: 0 0 10px; }
.ws-doc-sheet img { max-width: 100%; height: auto; }
.ws-doc-sheet table { border-collapse: collapse; font-size: 11.5px; }
.ws-doc-sheet td, .ws-doc-sheet th { border: 1px solid #e5e7eb; padding: 4px 8px; white-space: nowrap; }
.ws-doc-text {
  margin: 0; width: 100%; max-height: 100%; overflow: auto;
  background: #0d1117; color: #c9d1d9; font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
  padding: 18px 20px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; text-align: left;
  border-top: 3px solid var(--primary);
}
.ws-doc-info { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 20px; max-width: 320px; margin: auto; }
.ws-doc-info-icon {
  width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font: 800 11px/1 var(--font-mono); color: #fff;
  background: linear-gradient(150deg, var(--primary), color-mix(in srgb, var(--accent) 80%, var(--primary)));
  box-shadow: 0 10px 24px -12px rgba(15, 23, 42, .7);
}
.ws-doc-info strong { font-size: 13.5px; color: var(--ink); word-break: break-all; }
.ws-doc-info span { font-size: 11.5px; color: var(--muted-soft); line-height: 1.55; }
html.perf-lite .ws-doc-sheet { box-shadow: none; }
