/* Case Panel Component Styles: Work Grid, Agent State, Route Map & Focus Mode */

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-label h2 {
  font-size: 17px;
  font-weight: 750;
  color: var(--ink-heading);
}
.section-label .right-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.section-label .right-label svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
}

/* Panel Header & Customer Row */
.panel-header {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.case-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.case-id {
  font-size: 12px;
  font-weight: 750;
  font-family: var(--font-mono);
  color: var(--muted);
  letter-spacing: 0.04em;
}
.case-title {
  font-size: 18px;
  font-weight: 750;
  color: var(--ink-heading);
  line-height: 1.3;
}

.case-goal {
  padding: 14px 22px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}
.case-goal strong {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-heading);
  display: block;
}
.case-goal p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.goal-meta {
  margin-left: auto;
  text-align: right;
}
.goal-meta span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.goal-meta strong {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Agent Focus Banner */
.agent-focus {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.agent-focus.blue { background: #f0f7ff; border-left: 4px solid var(--blue); }
.agent-focus.amber { background: #fffdf5; border-left: 4px solid var(--amber); }
.agent-focus.green { background: #f2fbf5; border-left: 4px solid var(--green); }
.agent-focus.red { background: #fff5f5; border-left: 4px solid var(--red); }

[data-theme="dark"] .agent-focus.blue { background: #0c1c33; }
[data-theme="dark"] .agent-focus.amber { background: #261a07; }
[data-theme="dark"] .agent-focus.green { background: #082113; }
[data-theme="dark"] .agent-focus.red { background: #2b0b12; }

.focus-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 750;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.agent-focus.blue .focus-label { color: var(--blue); }
.agent-focus.amber .focus-label { color: var(--amber); }
.agent-focus.green .focus-label { color: var(--green); }
.agent-focus.red .focus-label { color: var(--red); }

.focus-title {
  font-size: 16px;
  font-weight: 750;
  color: var(--ink-heading);
  margin-bottom: 4px;
}
.focus-copy {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* Dynamic Cyber Route Matrix */
.route-matrix {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.route-matrix-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.route-matrix-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.route-matrix-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.route-matrix-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.route-matrix-track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.route-step {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 9px;
  flex-shrink: 0;
  min-width: 0;
  transition: all 180ms ease;
}
.route-step:hover {
  border-color: var(--line-strong);
}

.route-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.route-step-icon svg {
  width: 14px;
  height: 14px;
}

.route-step.blocked .route-step-icon {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}
.route-step.found .route-step-icon {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}
.route-step.dispatched .route-step-icon {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.25);
  color: #06b6d4;
}
.route-step.pending .route-step-icon {
  color: var(--muted);
}

.route-step-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.route-step-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-heading);
  white-space: nowrap;
}
.route-step-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}
.route-step-sub.red { color: #ef4444; }
.route-step-sub.emerald { color: #10b981; }
.route-step-sub.cyan { color: #06b6d4; }
.route-step-sub.muted { color: var(--muted); }

/* Connectors */
.route-track-connector {
  flex: 1;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.track-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.track-line {
  width: 100%;
  height: 2px;
  background: var(--line-strong);
  position: relative;
  overflow: hidden;
  border-radius: 1px;
}

.route-track-connector.moving .track-line {
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.35);
}

.track-pulse {
  display: none;
}
.route-track-connector.moving .track-pulse {
  display: block;
  position: absolute;
  top: -2px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #06b6d4, 0 0 3px #ffffff;
  animation: route-travel 1.3s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 960px) {
  .route-matrix-track {
    flex-direction: column;
    align-items: stretch;
  }
  .route-track-connector {
    height: 20px;
    width: 2px;
    margin: 0 auto;
  }
  .track-line {
    width: 2px;
    height: 100%;
  }
}

/* Scrubber Bar */
.case-scrubber-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
}

.scrubber-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scrub-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  transition: all 120ms ease;
}
.scrub-btn:hover:not(:disabled) {
  background: var(--surface-elevated);
  border-color: var(--accent);
  color: var(--accent);
}
.scrub-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.scrub-btn svg {
  width: 14px;
  height: 14px;
}

.play-pause-btn.playing {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.scrubber-slider-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scrubber-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.telemetry-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.scrubber-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: var(--line-strong);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
  transition: transform 100ms ease;
}
.scrubber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.scrubber-speed-pills {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.speed-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
}
.speed-pill.active {
  background: var(--accent);
  color: #ffffff;
}

.telemetry-hud-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.hud-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: signal 2s infinite ease-in-out;
}

.rot-180 {
  transform: rotate(180deg);
}

/* Panel Tabs */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 0 16px;
}
.panel-tabs button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 160ms var(--ease);
}
.panel-tabs button:hover {
  color: var(--ink-heading);
}
.panel-tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.panel-tabs button svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   CINEMATIC FOCUS MODE
   ========================================================================== */
#focus-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(5px);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
body.focus-mode-active #focus-overlay {
  opacity: 1;
  pointer-events: auto;
}

.focus-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 95;
  background: #0f172a;
  border: 1px solid #3b82f6;
  color: white;
  padding: 7px 18px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 650;
  font-family: var(--font-display);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.4);
  transition: transform 260ms var(--ease);
  pointer-events: none;
}
body.focus-mode-active .focus-banner {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.focus-banner kbd {
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.focus-banner button {
  background: transparent;
  border: 0;
  color: #93c5fd;
  cursor: pointer;
  padding: 0;
  font-weight: 650;
  margin-left: 4px;
}
.focus-banner button:hover { color: white; text-decoration: underline; }

/* Spotlight Focus Target: No over-zoom, fully bounded in viewport */
body.focus-mode-active .spotlight-focus-target {
  position: relative !important;
  z-index: 85 !important;
  transform: none !important;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), 0 0 0 2.5px var(--accent), 0 0 35px var(--accent-glow) !important;
  transition: box-shadow 250ms ease;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
}

@media (max-width: 1200px) {
  .work-grid {
    grid-template-columns: 1fr;
  }
}
