/* ==========================================================================
   WARP-SURGEON: PRO TACTICAL STUDIO DESIGN SYSTEM
   Prefix: ws-* (Strictly Scoped Zero Collision)
   ========================================================================== */

.ws-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #1212124d;
  backdrop-filter: blur(5px);
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.ws-overlay.ws-active {
  opacity: 1;
  pointer-events: auto;
}

.ws-overlay.ws-embedded {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  background: transparent;
  backdrop-filter: none;
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
}

.ws-modal-card {
  width: 98vw;
  height: 96vh;
  max-width: 1720px;
  background: #161616;
  border: 1px solid #1f1f1f;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.ws-modal-card.ws-card-embedded {
  width: 100%;
  height: 100%;
  max-width: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.ws-overlay .btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.58);
  font-weight: 600;
  padding: 5px 9px;
}

.ws-overlay .btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
  color: rgba(255, 255, 255, 0.85);
}

.ws-overlay .btn.ws-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ws-overlay .btn.ws-toggle-btn::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.22);
  flex-shrink: 0;
}

.ws-overlay .btn.ws-toggle-btn.is-active,
.ws-overlay .btn.ws-mode-btn.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
}

.ws-overlay .btn.ws-toggle-btn.is-active::before {
  background: rgba(52, 211, 153, 0.72);
}

.ws-overlay .btn.ws-toggle-btn.is-active:hover,
.ws-overlay .btn.ws-mode-btn.is-active:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.94);
}

.ws-overlay .btn-primary,
.ws-overlay .btn-chrome,
.ws-overlay .ws-sidebar-head .btn {
  background: rgba(255, 255, 255, 0.86);
  color: #121212;
  border: none;
  border-radius: 999px;
  font-weight: 700;
}

.ws-overlay .btn-primary:hover,
.ws-overlay .btn-chrome:hover,
.ws-overlay .ws-sidebar-head .btn:hover {
  background: rgba(255, 255, 255, 0.76);
  color: #121212;
}

/* ==========================================================================
   HEADER CONTROL BAR
   ========================================================================== */
.ws-header {
  height: 42px;
  padding: 0 12px;
  background: #121212;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  user-select: none;
  flex-shrink: 0;
}

.ws-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ws-brand-pill {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 700;
  color: #737373;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  letter-spacing: 0.06em;
}

.ws-filepath-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: #e5e5e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ws-editable-breadcrumb {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 0;
  border: none;
}

.ws-editable-breadcrumb:hover {
  background: #161616;
  color: #ffffff;
}

.ws-edit-pen {
  opacity: 0;
  color: #737373;
  margin-left: 2px;
}

.ws-editable-breadcrumb:hover .ws-edit-pen {
  opacity: 1;
}

.ws-rename-input {
  height: 24px !important;
  padding: 2px 6px !important;
  font-family: var(--font-mono, monospace) !important;
  font-size: 11px !important;
  width: 240px !important;
  border: none !important;
  border-bottom: 1px solid #525252 !important;
  border-radius: 0 !important;
  background: #121212 !important;
}

.ws-filepath-breadcrumb .ws-dir {
  color: #737373;
  font-weight: 400;
}

.ws-filepath-breadcrumb .ws-filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ws-header-center {
display: flex;
align-items: center;
gap: 8px;
}
.ws-diff-mode-group {
display: flex;
align-items: center;
gap: 2px;
}

.ws-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   MAIN SURGICAL VIEWPORT
   ========================================================================== */
.ws-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  background: #161616;
  overflow: hidden;
}

.ws-editor-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

.ws-gutter {
  width: 52px;
  min-width: 52px;
  background: #161616;
  border-right: 1px solid #1a1a1a;
  color: #525252;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 22px;
  user-select: none;
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: border-box;
  position: relative;
}

.ws-gutter-track {
  padding: 12px 8px 12px 0;
  text-align: right;
  white-space: pre;
  will-change: transform;
}

.ws-code-textarea {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 12px 14px;
  color: #f5f5f5;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 22px;
  tab-size: 2;
  resize: none;
  white-space: pre;
  overflow: auto;
}

@media (max-width: 768px) {
  .ws-code-textarea {
    font-size: 16px;
  }
}

/* ==========================================================================
   FLOATING CMD+F SEARCH/REPLACE OVERLAY
   ========================================================================== */
.ws-floating-search {
  position: absolute;
  top: 10px;
  right: 24px;
  background: #161616;
  border: 1px solid #282828;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: none;
  z-index: 100;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.14s ease;
}

.ws-floating-search.ws-search-active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.ws-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-search-input {
  background: #121212;
  border: 1px solid #222222;
  border-radius: 4px;
  padding: 4px 8px;
  color: #f5f5f5;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  width: 170px;
  outline: none;
}

.ws-search-input:focus {
  border-color: #444444;
}

.ws-search-count {
  font-size: 10px;
  color: #888888;
  font-family: var(--font-mono, monospace);
  min-width: 48px;
}

/* ==========================================================================
   DRAWER 1: DIAGNOSTIC RADAR (COLLAPSIBLE)
   ========================================================================== */
.ws-radar-drawer {
  width: 320px;
  background: #161616;
  border-left: 1px solid #1f1f1f;
  display: flex;
  flex-direction: column;
  transition: width 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.ws-radar-drawer.ws-collapsed {
  width: 0;
  border-left: none;
}

@media (max-width: 1024px) {
  .ws-radar-drawer:not(.ws-collapsed), .ws-diff-drawer:not(.ws-collapsed) {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 480px;
    z-index: 150;
    box-shadow: none;
  }
}

.ws-pane-header {
  height: 34px;
  padding: 0 12px;
  background: #121212;
  border-bottom: 1px solid #1f1f1f;
  font-size: 10px;
  font-weight: 700;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ws-radar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-radar-card {
  background: transparent;
  border: none;
  border-bottom: 1px solid #1a1a1a;
  border-radius: 0;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.ws-radar-card:hover {
  background: #1c1c1c;
}

.ws-radar-card.ws-card-arch { border-left: 3px solid #f5a623; }
.ws-radar-card.ws-card-secret { border-left: 3px solid #ff3333; }
.ws-radar-card.ws-card-hallucination { border-left: 3px solid #f5a623; }

.ws-radar-title {
  font-size: 11px;
  font-weight: 600;
  color: #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ws-radar-snippet {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: #888888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   DRAWER 2: LIVE DIFF COMPANION (COLLAPSIBLE)
   ========================================================================== */
.ws-diff-drawer {
  width: 440px;
  background: #161616;
  border-left: 1px solid #1f1f1f;
  display: flex;
  flex-direction: column;
  transition: width 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.ws-diff-drawer.ws-collapsed {
  width: 0;
  border-left: none;
}

.ws-diff-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.6;
  background: #161616;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ws-diff-row {
  display: flex;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 1px 6px;
  border-radius: 2px;
}

.ws-diff-add {
  background: rgba(52, 211, 153, 0.08);
  color: #34d399;
}

.ws-diff-del {
  background: rgba(255, 133, 133, 0.08);
  color: #ff8585;
  text-decoration: line-through;
}

.ws-diff-ctx {
  color: #666666;
}

/* ==========================================================================
   IDE-GRADE BOTTOM STATUS BAR
   ========================================================================== */
.ws-status-bar {
  height: 26px;
  padding: 0 12px;
  background: #121212;
  border-top: 1px solid #1a1a1a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  color: #888888;
  user-select: none;
  flex-shrink: 0;
}

.ws-status-left, .ws-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ws-status-item.ws-status-interactive {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 999px;
  color: #a3a3a3;
}

.ws-status-item.ws-status-interactive:hover {
  background: #1a1a1a;
  color: #ffffff;
}

.ws-status-deltas-add { color: #34d399; font-weight: 600; }
.ws-status-deltas-del { color: #f87171; font-weight: 600; }

.patch-studio-canvas {
  height: calc(100vh - 78px);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.studio-empty-backdrop {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 0;
}

.ws-workbench {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #161616;
  position: relative;
}

.ws-workbench.ws-no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.ws-workbench.ws-no-sidebar .ws-sidebar {
  display: none;
}

.ws-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #121212;
  border-right: 1px solid #1a1a1a;
  overflow: hidden;
}

.ws-sidebar-head {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #1a1a1a;
}

.ws-sidebar-search {
  flex: 1;
  min-width: 0;
  border: none !important;
  border-bottom: 1px solid #262626 !important;
  border-radius: 0 !important;
  background: #121212 !important;
}

.ws-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ws-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 5px 8px 5px 6px;
  border-radius: 0;
  border-left: 2px solid transparent;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #a3a3a3;
}

.ws-tree-item:hover {
  background: #1c1c1c;
  color: #ffffff;
}

.ws-tree-item.active {
  background: #202020;
  border-left-color: #ffffff;
  color: #ffffff;
  font-weight: 600;
}

.ws-tree-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-tree-badge {
  font-size: 9px;
  font-weight: 700;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

.ws-tree-badge.is-mod { color: #fbbf24; }
.ws-tree-badge.is-new { color: #34d399; }

.ws-sidebar-empty {
  padding: 14px;
  font-size: 11px;
  color: #666666;
  text-align: center;
}

.ws-main-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ws-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  background: #121212;
  border-bottom: 1px solid #1a1a1a;
  overflow-x: auto;
  flex-shrink: 0;
}

.ws-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #737373;
  background: transparent;
  border: none;
  border-right: 1px solid #161616;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.ws-tab:hover {
  color: #e5e5e5;
  background: #1a1a1a;
}

.ws-tab.active {
  background: #161616;
  color: #ffffff;
  border-bottom-color: #ffffff;
}

.ws-tab-dot {
  color: #fbbf24;
  font-weight: 700;
}

.ws-tab-close {
  color: #666666;
  font-size: 12px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 999px;
}

.ws-tab-close:hover {
  color: #ffffff;
}

.ws-notice-bar, .ws-conflict-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 11px;
  background: #161616;
  border: none;
  border-bottom: 1px solid #1f1f1f;
  border-left: 3px solid #fbbf24;
  color: #f5f5f5;
  flex-shrink: 0;
}

.ws-editor-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  overflow: hidden;
}

.ws-editor-host, .ws-split-host {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.ws-split-host .cm-mergeView {
  height: 100%;
  overflow: auto;
}

.ws-empty-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #888888;
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.ws-symbol-popover {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: min(380px, 92%);
  max-height: 320px;
  overflow-y: auto;
  background: #181818;
  border: 1px solid #262626;
  border-radius: 0;
  padding: 4px 0;
  z-index: 120;
  box-shadow: none;
}

.ws-symbol-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  text-align: left;
}

.ws-symbol-row:hover {
  background: #1a1a1a;
}

.ws-symbol-kind {
  color: #a3a3a3;
  font-size: 10px;
  width: 64px;
  flex-shrink: 0;
}

.ws-symbol-name {
  flex: 1;
  color: #f5f5f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-symbol-line {
  color: #737373;
  font-size: 10px;
}

@media (max-width: 960px) {
  .ws-workbench {
    grid-template-columns: 1fr;
  }
  .ws-workbench:not(.ws-no-sidebar)::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(18, 18, 18, 0.5);
    z-index: 139;
    pointer-events: none;
  }
  .ws-sidebar {
    position: absolute;
    left: 0;
    top: 44px;
    bottom: 26px;
    width: 240px;
    z-index: 140;
    box-shadow: none;
  }
}

@media (max-width: 880px) {
  .ws-header {
    height: auto;
    min-height: 42px;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .ws-header-center {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   SKELETON LOADERS
   ========================================================================== */
.patch-studio-skeleton {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #161616;
  overflow: hidden;
}

.patch-studio-skeleton-header {
  height: 42px;
  padding: 0 12px;
  background: #121212;
  border-bottom: 1px solid #1a1a1a;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.patch-studio-skeleton-tabs {
  height: 27px;
  background: #121212;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.patch-studio-skeleton-body {
  flex: 1;
  display: flex;
  min-height: 0;
  background: #161616;
}

.ws-editor-skeleton {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #161616;
}

.ws-editor-skeleton-gutter,
.patch-studio-skeleton-gutter {
  width: 52px;
  min-width: 52px;
  background: #161616;
  border-right: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.ws-editor-skeleton-lines,
.patch-studio-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  min-width: 0;
}

.ws-editor-skeleton-line,
.patch-studio-skeleton-line {
  display: block;
  height: 12px;
  background: #1a1a1a;
  opacity: 0.6;
  animation: patch-studio-skeleton-pulse 1.4s ease-in-out infinite;
}

.patch-studio-skeleton-header > .patch-studio-skeleton-line.is-wide {
  width: 32%;
  max-width: 240px;
  height: 10px;
}

.patch-studio-skeleton-lines > .patch-studio-skeleton-line:nth-child(3n+1),
.ws-editor-skeleton-lines > .ws-editor-skeleton-line:nth-child(3n+1) { width: 85%; }
.patch-studio-skeleton-lines > .patch-studio-skeleton-line:nth-child(3n+2),
.ws-editor-skeleton-lines > .ws-editor-skeleton-line:nth-child(3n+2) { width: 62%; }
.patch-studio-skeleton-lines > .patch-studio-skeleton-line:nth-child(3n+3),
.ws-editor-skeleton-lines > .ws-editor-skeleton-line:nth-child(3n+3) { width: 95%; }

.patch-studio-skeleton-lines > .patch-studio-skeleton-line:nth-child(2n),
.ws-editor-skeleton-lines > .ws-editor-skeleton-line:nth-child(2n) {
  animation-delay: 0.15s;
}
.patch-studio-skeleton-lines > .patch-studio-skeleton-line:nth-child(3n),
.ws-editor-skeleton-lines > .ws-editor-skeleton-line:nth-child(3n) {
  animation-delay: 0.3s;
}

@keyframes patch-studio-skeleton-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .ws-editor-skeleton-line,
  .patch-studio-skeleton-line {
    animation: none;
    opacity: 0.6;
  }
}