/* ─── PRISM Workspace Action Bar ─────────────────────────────────────────────
   Three-zone bar: [LEFT: badge] [CENTER: selector] [RIGHT: actions]
   Shown in practice-mode and learn-mode-active only.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Visibility ──────────────────────────────────────────────────────────── */
#workspace-action-bar { display: none; }

body.practice-mode #workspace-action-bar,
body.learn-mode-active #workspace-action-bar {
  display: flex;
}

/* ── Base shell ──────────────────────────────────────────────────────────── */
#workspace-action-bar {
  height: var(--wab-height, 48px);
  background: #172340;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  align-items: center;
  padding: 0 14px;
  gap: 0;
  position: sticky;
  top: var(--topbar-height, 80px);
  z-index: 89;
  user-select: none;
  flex-shrink: 0;
  overflow: visible;
}

/* ══════════════════════════════════════════════════════════════════════════
   LEFT ZONE — mode badge only
   flex:1 so it takes equal space to mirror .wab-right → center stays centred
   ══════════════════════════════════════════════════════════════════════════ */
.wab-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.wab-mode-badge {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

body.practice-mode .wab-mode-badge {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.28);
}
body.practice-mode .wab-mode-badge::after { content: 'Practice'; }

body.learn-mode-active .wab-mode-badge {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.22);
}
body.learn-mode-active .wab-mode-badge::after { content: 'Learn'; }

/* ══════════════════════════════════════════════════════════════════════════
   CENTER ZONE — question selector, always shown in both modes
   position:absolute + translateX(-50%) = pixel-perfect centre regardless of
   left/right content widths.
   ══════════════════════════════════════════════════════════════════════════ */
.wab-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}
.wab-center > * { pointer-events: auto; }

/* Question selector pill */
.wab-question-selector {
  position: relative;
  width: clamp(200px, 28vw, 360px);
}

/* Dark-theme trigger override (base style.css is light) */
.wab-question-selector .pcs-trigger {
  background: rgba(255, 255, 255, 0.08);
  border: 0.57px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  color: #fff;
  font-size: var(--fs-ui);
  font-weight: 600;
  padding: 0 10px;
  box-shadow: none;
  height: 35px;
  text-align: center;
  transition: background 0.13s ease, border-color 0.13s ease;
}
.wab-question-selector .pcs-trigger:hover {
  background:transparent;
  border-color: rgba(255, 255, 255, 0.22);
  font-weight: 800;
  box-shadow: none;
}
.wab-question-selector .preset-custom-select.open .pcs-trigger {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.wab-question-selector .pcs-chevron { color: rgba(255, 255, 255); }

/* Dropdown opens downward */
.wab-question-selector .pcs-list {
  min-width: 300px;
  max-height: 400px;
  left: 0;
  right: auto;
}

/* ══════════════════════════════════════════════════════════════════════════
   RIGHT ZONE — action buttons + stopwatch
   flex:1 + justify-content:flex-end keeps buttons flush to the right edge
   ══════════════════════════════════════════════════════════════════════════ */
.wab-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.wab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  color: #fff;
  white-space: nowrap;
  line-height: 1;
  padding: 15px;
  transition: background 0.13s ease, transform 0.1s ease, opacity 0.13s ease;
}
.wab-btn:active:not(:disabled) { transform: scale(0.97); }

/* Run — solid indigo */
#wab-run-btn { background: #4f46e5; }
#wab-run-btn:hover:not(:disabled) { background: #4338ca; }
#wab-run-btn:disabled,
#wab-run-btn.wab-btn--running { opacity: 0.55; cursor: not-allowed; }

/* Submit — solid green */
#wab-submit-btn { background: #16a34a; }
#wab-submit-btn:hover:not(:disabled) { background: #15803d; }
#wab-submit-btn:disabled,
#wab-submit-btn.wab-btn--submitting { opacity: 0.55; cursor: not-allowed; }
#wab-submit-btn.wab-btn--success { background: #166534; }

/* Submit + stopwatch hidden in learn mode */
body.learn-mode-active #wab-submit-btn,
body.learn-mode-active .wab-stopwatch { display: none !important; }

/* Spinning icon */
.wab-btn-icon { flex-shrink: 0; }
@keyframes wab-spin { to { transform: rotate(360deg); } }
.wab-btn--running .wab-btn-icon,
.wab-btn--submitting .wab-btn-icon { animation: wab-spin 0.8s linear infinite; }

/* Unused separator divs — hide safely */
.wab-btn-sep { display: none; }

/* ── Stopwatch ───────────────────────────────────────────────────────────── */
.wab-stopwatch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.wab-stopwatch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.70);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.13s ease, color 0.13s ease;
}
.wab-stopwatch-btn:hover { background: rgba(255,255,255,0.09); color: #fff; }

.wab-stopwatch[data-state="idle"]    .wab-stopwatch-btn { color: rgba(255,255,255,0.70); }
.wab-stopwatch[data-state="running"] .wab-stopwatch-btn { color: #4ade80; background: rgba(34,197,94,0.10); }
.wab-stopwatch[data-state="paused"]  .wab-stopwatch-btn { color: #fbbf24; background: rgba(251,191,36,0.10); }
.wab-stopwatch[data-state="running"] .wab-stopwatch-btn:hover { background: rgba(34,197,94,0.18); }
.wab-stopwatch[data-state="paused"]  .wab-stopwatch-btn:hover { background: rgba(251,191,36,0.18); }

/* Time display — hidden until running/paused */
.wab-timer-display {
  font-size: var(--fs-xss);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.03em;
  display: none;
  min-width: 32px;
}
.wab-stopwatch[data-state="running"] .wab-timer-display { display: inline; color: #86efac; }
.wab-stopwatch[data-state="paused"]  .wab-timer-display { display: inline; color: #fcd34d; }

/* Pulsing dot before running time */
.wab-stopwatch[data-state="running"] .wab-timer-display::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 4px;
  vertical-align: middle;
  animation: wab-pulse 1.2s ease-in-out infinite;
}
@keyframes wab-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.7); }
}
