/* Peer Designing — small header overrides on top of shared li- classes
   (reused from live-interview.css) so we don't duplicate the base canvas/
   toolbar styling. Only the bits that differ from Live Interview live here:
   Room ID / Participants count / Invite / Copy Link / Connection status. */

/* Left panel: Components palette (3-col × 4-row scrollable grid) +
   Inspector (contained, no extra scroll). */
#li-component-palette.li-palette-inner {
  overflow: hidden;
}
#li-component-palette .components-section {
  flex-shrink: 0;
}

/* 3-column grid capped at 4 visible rows — extras scroll inside */
.pd-session-body #li-component-palette .palette {
  grid-template-columns: repeat(4, 1fr);
  max-height: 230px; /* ~4 rows with slightly larger icons */
  overflow-y: auto;
  scrollbar-width: none;
}
.pd-session-body #li-component-palette .palette::-webkit-scrollbar {
  width: 4px;
}
.pd-session-body #li-component-palette .palette::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Inspector — contained, no overflow, minimal padding */
#li-component-palette .inspector-section {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid #e2e8f0;
  overflow: hidden;
}
#li-component-palette .inspector-section h2 {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0 0 10px;
}
#li-component-palette .inspector-section .section-body {
  overflow: hidden;
  padding: 0;
}
#pd-inspector {
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  background: transparent;
}
#pd-inspector-default-text {
  margin: 0;
  font-size: 12px;
  color: #64748b;
 
}

/* Component palette items — slightly larger icon + label in peer designing */
.pd-session-body #li-component-palette .palette-item {
  font-size: 13px;
}
.pd-session-body #li-component-palette .palette-item .icon {
  width: 30px;
  height: 30px;
}

/* Left panel collapse/expand — purely local UI state per participant,
   mirrors the right (Simulation) panel's collapse pattern and Practice
   mode's #left-panel/#toggle-left-panel/#open-left-panel behavior. */
#li-left-panel.li-left-panel {
  transition: width 0.18s ease, min-width 0.18s ease, max-width 0.18s ease;
}
#li-left-panel.pd-left-collapsed {
  width: 0;
  min-width: 0;
  max-width: 0;
  border: none;
  overflow: hidden;
}
.li-palette-header {
  position: relative;
}
#pd-toggle-left-panel {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) scaleX(1);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#pd-toggle-left-panel:hover {
  background: #e2e8f0;
  color: #0f172a;
}
#pd-open-left-panel {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  z-index: 20;
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
#pd-open-left-panel:hover {
  background: #f1f5f9;
  color: #0f172a;
}
#pd-open-left-panel.pd-visible {
  display: flex;
}

.pd-toolbar-title {
  font-weight: 700;
  color: #f8fafc;
  font-size: 14px;
}

.pd-room-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
}

.pd-participants-count {
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

/* Participants dropdown */
.pd-participants-dropdown {
  position: relative;
}

.pd-participants-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.pd-participants-btn:hover {
  background: rgba(148, 163, 184, 0.1);
}

.pd-participants-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}

.pd-participant-item {
  padding: 10px 16px;
  font-size: 13px;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
}

.pd-participant-item:last-child {
  border-bottom: none;
}

.pd-participant-item:hover {
  background: #f8fafc;
}

.pd-connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
}

.pd-connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f87171;
  display: inline-block;
}
.pd-connection-dot.connected { background: #34d399; }
.pd-connection-dot.connecting { background: #fbbf24; }

.pd-copy-btn {
  background: rgba(56,189,248,0.1);
  color: #38bdf8;
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.pd-copy-btn:hover { background: rgba(56,189,248,0.2); }

/* ═══════════════════════════════════════════════════════════════════════
   RIGHT PANEL — Simulation
   Purely local UI state: each participant toggles their own panel
   independently. Never broadcast over Socket.IO/WebRTC (see session.js —
   the toggle handler only touches local DOM/localStorage, nothing is
   emitted to the room).
   ═══════════════════════════════════════════════════════════════════════ */
#pd-right-panel {
  width: 350px;
  max-width: 350px;
  min-width: 350px;
  flex-shrink: 0;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width 0.18s ease, min-width 0.18s ease, max-width 0.18s ease;
}
#pd-right-panel.pd-collapsed {
  width: 0;
  min-width: 0;
  max-width: 0;
  border: none;
}
#pd-right-panel .panel-header {
  flex-shrink: 0;
}

/* In-panel toggle — explicitly light-themed regardless of the shared
   `.icon-button` base cascade (which can pick up dark hover/theme rules
   from other pages sharing the same class). Positioned on the right of
   the header, next to the "Simulation" title. */
#pd-right-panel .panel-header #pd-toggle-right-panel {
  position: absolute;
  left: auto;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%) scaleX(1);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}
#pd-right-panel .panel-header #pd-toggle-right-panel:hover {
  background: #e2e8f0;
  color: #0f172a;
}
#pd-right-panel.pd-collapsed .panel-header #pd-toggle-right-panel {
  transform: translateY(-50%) scaleX(-1);
}

/* ═══════════════════════════════════════════════════════════════════════
   Live Simulation panel — same client-side SimEngine analysis used by
   Practice mode's Simulate tab (js/practice/sim-engine.js). No "Run
   Simulation" button: this container is fully re-rendered on a short
   poll as the canvas changes. Styles mirror css/practice/right-panel.css
   (scoped under `.prp-sim-root` there) 1:1, renamed to `.pd-sim-live-root`.
   ═══════════════════════════════════════════════════════════════════════ */
.pd-sim-live-root {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sim-scenario-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  padding: 5px 14px;
  min-height: 65px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 4;
  overflow-x: auto;
  scrollbar-width: none;
}
.sim-scenario-bar::-webkit-scrollbar { display: none; }

.sim-scenario-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 16px;
  min-height: 58px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
  font-family: inherit;
  flex: 1 1 0;
  white-space: nowrap;
}
.sim-scenario-btn:hover { background: #f0f4ff; border-color: #c7d4ff; }
.sim-scenario-btn.active { background: #eff6ff; border-color: #3b82f6; }
.sim-scenario-btn:active { transform: scale(0.96); }

.sim-scenario-btn[data-sc="normal"]  .ssb-icon { color: #3b82f6; }
.sim-scenario-btn[data-sc="spike"]   .ssb-icon { color: #f59e0b; }
.sim-scenario-btn[data-sc="failure"] .ssb-icon { color: #ef4444; }
.sim-scenario-btn[data-sc="global"]  .ssb-icon { color: #8b5cf6; }
.sim-scenario-btn[data-sc="async"]   .ssb-icon { color: #14b8a6; }

.sim-scenario-btn[data-sc="normal"]:hover  { background: #eff6ff; border-color: #3b82f6; }
.sim-scenario-btn[data-sc="spike"]:hover   { background: #fffbeb; border-color: #f59e0b; }
.sim-scenario-btn[data-sc="failure"]:hover { background: #fff1f2; border-color: #ef4444; }
.sim-scenario-btn[data-sc="global"]:hover  { background: #f5f3ff; border-color: #8b5cf6; }
.sim-scenario-btn[data-sc="async"]:hover   { background: #f0fdfa; border-color: #14b8a6; }

.sim-scenario-btn[data-sc="normal"].active  { background: #eff6ff; border-color: #3b82f6; }
.sim-scenario-btn[data-sc="normal"].active .ssb-icon  { color: #2563eb; }
.sim-scenario-btn[data-sc="normal"].active .ssb-label { color: #1d4ed8; }

.sim-scenario-btn[data-sc="spike"].active   { background: #fffbeb; border-color: #f59e0b; }
.sim-scenario-btn[data-sc="spike"].active .ssb-icon   { color: #d97706; }
.sim-scenario-btn[data-sc="spike"].active .ssb-label  { color: #b45309; }

.sim-scenario-btn[data-sc="failure"].active { background: #fff1f2; border-color: #ef4444; }
.sim-scenario-btn[data-sc="failure"].active .ssb-icon { color: #dc2626; }
.sim-scenario-btn[data-sc="failure"].active .ssb-label { color: #991b1b; }

.sim-scenario-btn[data-sc="global"].active  { background: #f5f3ff; border-color: #8b5cf6; }
.sim-scenario-btn[data-sc="global"].active .ssb-icon  { color: #7c3aed; }
.sim-scenario-btn[data-sc="global"].active .ssb-label { color: #6d28d9; }

.sim-scenario-btn[data-sc="async"].active   { background: #f0fdfa; border-color: #14b8a6; }
.sim-scenario-btn[data-sc="async"].active .ssb-icon   { color: #0d9488; }
.sim-scenario-btn[data-sc="async"].active .ssb-label  { color: #0f766e; }

.ssb-icon { font-size: var(--fs-lg); line-height: 1; }
.ssb-label {
  font-size: var(--fs-xss);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.sim-section { padding: 14px 14px 4px; }
.sim-section-hd {
  display: flex;
  align-items: baseline;
  font-size: var(--fs-xss);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 10px;
}

.sim-events { display: flex; flex-direction: column; gap: 8px; }
.sim-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.sim-event--critical { background: #fff1f2; border-color: #fecdd3; }
.sim-event--warn { background: #fffbeb; border-color: #fde68a; }
.sim-event--info { background: #f8fafc; border-color: #e2e8f0; }
.sim-event--good { background: #f0fdf4; border-color: #bbf7d0; }

.sim-ev-icon { font-size: var(--fs-sm); flex-shrink: 0; margin-top: 1px; line-height: 1; }
.sim-event--critical .sim-ev-icon { color: #dc2626; }
.sim-event--warn     .sim-ev-icon { color: #d97706; }
.sim-event--info     .sim-ev-icon { color: #64748b; }
.sim-event--good     .sim-ev-icon { color: #16a34a; }

.sim-ev-body { flex: 1; min-width: 0; }
.sim-ev-title { font-size: var(--fs-xs); font-weight: 700; color: #1e293b; line-height: 1.3; margin-bottom: 2px; }
.sim-event--critical .sim-ev-title { color: #991b1b; }
.sim-event--warn     .sim-ev-title { color: #92400e; }
.sim-event--good     .sim-ev-title { color: #166534; }
.sim-ev-desc { font-size: var(--fs-xss); color: #475569; line-height: 1.45; }

.sim-challenge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #6366f1;
  border-radius: 8px;
}
.sim-challenge-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #6366f1;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1;
  margin-top: 1px;
}
.sim-challenge-q { font-size: var(--fs-xs); color: #1e293b; line-height: 1.5; margin: 0; font-weight: 500; }

.sim-insight { padding: 12px 14px; border-radius: 8px; border: 1px solid #e2e8f0; background: #f8fafc; }
.ins--fails    { border-left: 3px solid #ef4444; background: #fff8f8; }
.ins--works    { border-left: 3px solid #22c55e; background: #f8fdf8; }
.ins--tradeoff { border-left: 3px solid #f59e0b; background: #fffcf0; }
.ins--scaling  { border-left: 3px solid #3b82f6; background: #f8fbff; }
.ins-tag { font-size: var(--fs-xss); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; opacity: 0.7; }
.ins--fails    .ins-tag { color: #dc2626; }
.ins--works    .ins-tag { color: #16a34a; }
.ins--tradeoff .ins-tag { color: #b45309; }
.ins--scaling  .ins-tag { color: #1d4ed8; }
.ins-head { font-size: var(--fs-xs); font-weight: 700; color: #1e293b; margin-bottom: 8px; line-height: 1.3; }
.ins-body { font-size: var(--fs-xss); color: #475569; line-height: 1.5; }

.sim-confidence { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; }
.conf-row { display: flex; align-items: center; gap: 8px; }
.conf-dim-label { font-size: var(--fs-xss); font-weight: 600; color: #475569; flex: 0 0 90px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.conf-dots { display: flex; gap: 4px; flex: 0 0 auto; }
.conf-dot { width: 7px; height: 7px; border-radius: 50%; background: #e2e8f0; border: 1px solid #cbd5e1; transition: background 200ms ease, border-color 200ms ease; }
.conf-val-label { font-size: var(--fs-xss); font-weight: 700; letter-spacing: 0.02em; flex: 1; text-align: right; }
.conf-strong   { color: #16a34a; }
.conf-moderate { color: #d97706; }
.conf-weak     { color: #dc2626; }
.conf-strong   .conf-dot--on { background: #22c55e; border-color: #16a34a; }
.conf-moderate .conf-dot--on { background: #f59e0b; border-color: #d97706; }
.conf-weak     .conf-dot--on { background: #f87171; border-color: #ef4444; }

.sim-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 24px; text-align: center; }
.sim-empty-icon { color: #cbd5e1; margin-bottom: 4px; }
.sim-empty-title { font-size: var(--fs-sm); font-weight: 700; color: #475569; margin: 0; }
.sim-empty-sub { font-size: var(--fs-xss); color: #94a3b8; line-height: 1.5; margin: 0; max-width: 240px; }

/* ── Floating toggle button (mirrors Practice mode's #open-right-panel) ──
   Explicitly light-themed (white bg, slate icon) — never dark/black,
   regardless of any shared `.floating-toggle` base cascade. */
#pd-open-right-panel {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  z-index: 20;
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
#pd-open-right-panel:hover {
  background: #f1f5f9;
  color: #0f172a;
}
#pd-open-right-panel.pd-visible { display: flex; }

/* Audio-only: hide the video PIP panels entirely (Peer Designing never
   requests a camera track) */
.pd-session-body #li-local-video,
.pd-session-body #li-remote-video,
.pd-session-body #li-video-toggle {
  display: none !important;
}
