/* ── IDE 3-Panel Layout ─────────────────────────────── */

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Activity Bar (leftmost column) ───────────────── */

.activity-bar {
  width: var(--activity-bar-width);
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) 0;
  gap: var(--space-1);
  flex-shrink: 0;
  z-index: 10;
}

.activity-bar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-accent), hsl(280, 85%, 55%));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  color: white;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-base);
}

.activity-bar-logo:hover {
  transform: scale(1.08);
}

.activity-bar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  transition: all var(--transition-base);
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
}

.activity-bar-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

.activity-bar-btn.active {
  background: var(--color-accent-subtle);
  color: var(--color-accent-text);
}

.activity-bar-btn.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.activity-bar-btn svg {
  width: 20px;
  height: 20px;
}

.activity-bar-spacer {
  flex: 1;
}

/* ── Navigator (left sidebar) ─────────────────────── */

.navigator {
  width: var(--sidebar-width);
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  min-width: 180px;
  transition: width var(--transition-base), min-width var(--transition-base);
}

.navigator.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}

.navigator-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
}


.navigator-search {
  width: 100%;
  height: 30px;
  padding: 0 var(--space-3);
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: var(--text-xs);
  transition: all var(--transition-base);
}

.navigator-search:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent-muted);
}

.navigator-search::placeholder {
  color: var(--color-text-muted);
}

.navigator-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navigator-actions-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semi);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.navigator-actions-btns {
  display: flex;
  gap: var(--space-1);
}

.navigator-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-1) var(--space-2);
}

/* ── Splitter (resize handle) ─────────────────────── */

.splitter {
  width: var(--splitter-width);
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  transition: background var(--transition-fast);
}

.splitter:hover,
.splitter.dragging {
  background: var(--color-accent);
}

.splitter::after {
  content: '';
  position: absolute;
  inset: 0 -4px;
}

/* ── Editor (center panel) ────────────────────────── */

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 200px;
  background: var(--color-bg-primary);
}

.editor-tabs {
  display: flex;
  align-items: stretch;
  height: var(--editor-tab-height);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.editor-tabs::-webkit-scrollbar {
  display: none;
}

.editor-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  border-right: 1px solid var(--color-border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  min-width: 0;
  max-width: 180px;
  position: relative;
  flex-shrink: 0;
  user-select: none;
}

.editor-tab:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-secondary);
}

.editor-tab.active {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.editor-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
}

.editor-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-tertiary);
}

.editor-tab-icon svg {
  width: 14px;
  height: 14px;
}

.editor-tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-tab-close {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.editor-tab-close:hover {
  background: var(--color-bg-active);
  color: var(--color-text-primary);
}

.editor-tab.modified .editor-tab-name::after {
  content: ' •';
  color: var(--color-warning);
}

.editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Editor - Welcome */
.editor-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-4);
  color: var(--color-text-tertiary);
  padding: var(--space-8);
}

.editor-welcome-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--color-accent-subtle), hsl(280, 30%, 18%));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-3xl);
  opacity: 0.6;
}

.editor-welcome h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-semi);
  color: var(--color-text-secondary);
}

.editor-welcome p {
  font-size: var(--text-sm);
  max-width: 320px;
  text-align: center;
  color: var(--color-text-muted);
}

.editor-welcome-shortcuts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.editor-welcome-shortcut {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.editor-welcome-shortcut kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* Editor - Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-subtle);
  min-height: 32px;
  flex-shrink: 0;
}

.editor-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.editor-toolbar .breadcrumb-path {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: var(--font-mono);
}

/* Editor - Code/Text Area */
.editor-code-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.editor-line-numbers {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-2);
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-bg-primary);
  border-right: 1px solid var(--color-border-subtle);
  user-select: none;
  line-height: var(--leading-loose);
  overflow: hidden;
  min-width: 40px;
}

.editor-textarea {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-primary);
  border: none;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
  resize: none;
  outline: none;
  white-space: pre;
  tab-size: 2;
  overflow: auto;
  min-width: 0;
}

.editor-textarea::placeholder {
  color: var(--color-text-muted);
}

/* Editor - Markdown Split */
.editor-md-split {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-md-source {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border-subtle);
  overflow: hidden;
}

.editor-md-preview {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

/* Editor - CSV Table */
.editor-csv-container {
  flex: 1;
  overflow: auto;
  padding: var(--space-4);
}

.editor-csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

.editor-csv-table th {
  position: sticky;
  top: 0;
  background: var(--color-bg-tertiary);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-subtle);
  font-weight: var(--font-semi);
  text-align: left;
  white-space: nowrap;
  color: var(--color-text-secondary);
}

.editor-csv-table td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-subtle);
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-csv-table tr:hover td {
  background: var(--color-bg-hover);
}

/* Editor - Image Preview */
.editor-image-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  gap: var(--space-4);
  overflow: auto;
}

.editor-image-container img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.editor-image-meta {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  text-align: center;
}

/* Editor - File Info (unknown types) */
.editor-file-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-4);
  padding: var(--space-8);
}

.editor-file-info-icon {
  font-size: 3rem;
}

.editor-file-info h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semi);
}

.editor-file-info p {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* ── Chat Panel (right side) ──────────────────────── */

.chat-panel {
  width: var(--chat-panel-width);
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  min-width: 280px;
  transition: width var(--transition-base), min-width var(--transition-base);
}

.chat-panel.collapsed {
  width: 0;
  min-width: 0;
  border-left: none;
  overflow: hidden;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
  min-height: var(--editor-tab-height);
  flex-shrink: 0;
}

.chat-panel-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semi);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chat-panel-actions {
  display: flex;
  gap: var(--space-1);
}

/* ── Auth Pages (kept same) ───────────────────────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--color-bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-10);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.auth-card h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  text-align: center;
  margin-bottom: var(--space-2);
  background: linear-gradient(135deg, var(--color-accent-text), hsl(280, 85%, 75%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
}

/* ── Auth Brand Lockup ──────────────────────────────── */

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-decoration: none;
  margin-bottom: var(--space-6);
}

.auth-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, hsl(240, 75%, 62%), hsl(268, 70%, 56%));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  font-size: var(--text-md);
  color: white;
  box-shadow: 0 0 20px hsla(250, 80%, 58%, 0.2);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.auth-brand:hover .auth-brand-icon {
  transform: scale(1.06);
}

.auth-brand-name {
  font-family: 'Outfit', var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

/* ── Page Container (for settings modal content) ─── */

.page-container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8);
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 1024px) {
  .chat-panel {
    width: 0;
    min-width: 0;
    border-left: none;
  }
}

@media (max-width: 768px) {
  .navigator {
    position: absolute;
    left: var(--activity-bar-width);
    top: 0;
    bottom: 0;
    z-index: 20;
    box-shadow: var(--shadow-xl);
  }

  .navigator.hidden {
    display: none;
  }
}
