/* Anthropic-Inspired Minimal Theme - Light (Default) */
:root,
body[data-theme="light"] {
  /* Colors */
  --primary: #ffffff;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --border: #e0e0e0;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #000000;
  --hover-bg: #e9ecef;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
  --transition-spring: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme */
body[data-theme="dark"] {
  --primary: #000000;
  --bg-primary: #0a0a0a;
  --bg-secondary: #151515;
  --bg-tertiary: #1f1f1f;
  --border: #2a2a2a;
  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent: #ffffff;
  --hover-bg: #252525;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #60a5fa;

  /* Shadows — darker for dark mode */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Override Bootstrap primary color for navbar only */
.navbar.bg-primary {
  background-color: var(--bg-secondary) !important;
}

.text-primary {
  color: var(--text-primary) !important;
}

/* Override Bootstrap bg-body-tertiary for dark mode */
.bg-body-tertiary {
  background-color: var(--bg-tertiary) !important;
}

body[data-theme="dark"] .bg-body-tertiary {
  background-color: var(--bg-tertiary) !important;
}

/* Override Bootstrap text-bg-primary for Anthropic styling */
.text-bg-primary {
  background-color: #000000 !important;
  color: #ffffff !important;
}

body[data-theme="dark"] .text-bg-primary {
  background-color: #ffffff !important;
  color: #000000 !important;
}

/* Anthropic Black Buttons - Override Bootstrap Blue */
.btn-primary {
  background-color: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: #2a2a2a !important;
  border-color: #2a2a2a !important;
  color: #ffffff !important;
}

.btn-primary:disabled {
  background-color: #404040 !important;
  border-color: #404040 !important;
  opacity: 0.6;
}

.btn-outline-primary {
  color: #000000 !important;
  border-color: #000000 !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: #000000 !important;
  border-color: #000000 !important;
  color: #ffffff !important;
}

body[data-theme="dark"] .btn-outline-primary {
  color: #ffffff !important;
  border-color: #ffffff !important;
}

body[data-theme="dark"] .btn-outline-primary:hover,
body[data-theme="dark"] .btn-outline-primary:focus,
body[data-theme="dark"] .btn-outline-primary:active {
  background-color: #ffffff !important;
  border-color: #ffffff !important;
  color: #000000 !important;
}

/* Navbar - Minimal Black */
.navbar {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}

.navbar-brand {
  color: var(--text-primary) !important;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.navbar-nav .nav-link {
  color: var(--text-secondary) !important;
  font-size: 14px;
  padding: 0.5rem 1rem !important;
  transition: color 0.2s ease;
}

.navbar-nav .nav-link:hover {
  color: var(--text-primary) !important;
}

.navbar-nav .nav-link.active {
  color: var(--accent) !important;
}

/* Cards - Modern Anthropic Style */
.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

body[data-theme="dark"] .card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  font-size: 15px;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  font-size: 13px;
}

.card-title {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 0.625rem;
  line-height: 1.4;
}

.card-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* Forms - Minimal Input Style with Focus Micro-Interaction */
.form-control,
.form-select {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 14px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  outline: none;
}

body[data-theme="dark"] .form-control:focus,
body[data-theme="dark"] .form-select:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

/* Shake animation for validation errors */
.form-control.is-invalid {
  animation: shake 0.4s ease;
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Buttons - Minimal Style with Micro-Interactions */
.btn {
  border-radius: var(--radius-sm);
  padding: 0.625rem 1.25rem;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 0.08s;
}

/* CSS-only subtle press feedback */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, currentColor 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.btn:active::after {
  opacity: 0.08;
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--hover-bg);
  border-color: var(--border);
}

/* Borders */
.border {
  border-color: var(--border) !important;
}

.border-top,
.border-bottom,
.border-start,
.border-end {
  border-color: var(--border) !important;
}

/* Views — Transition System */
.view {
  min-height: calc(100vh - 72px);
  background-color: var(--bg-primary);
  padding: 2rem 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.view.view-active {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Auth Pages (Login / Register)
   ============================================ */
.auth-view {
  padding: 0;
}

.auth-layout {
  display: flex;
  min-height: calc(100vh - 72px);
}

.auth-hero {
  flex: 0 0 55%;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 3rem;
}

.auth-hero-content {
  position: relative;
  z-index: 1;
  max-width: 480px;
  animation: fadeIn 0.6s ease;
}

.auth-brand {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: -0.03em;
}

.auth-headline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.auth-subtext {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.8;
  margin-bottom: 2.5rem;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

.auth-feature i {
  font-size: 1rem;
  opacity: 0.7;
}

.auth-hero-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 80%, rgba(255,255,255,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(255,255,255,0.04) 0%, transparent 50%);
  pointer-events: none;
}

.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: var(--bg-primary);
}

.auth-form-container {
  width: 100%;
  max-width: 380px;
  animation: slideIn 0.5s ease;
}

.auth-form-title {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.auth-form-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-field {
  margin-bottom: 1.25rem;
}

.auth-field .form-control {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-field .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

body[data-theme="dark"] .auth-field .form-control:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.auth-submit {
  padding: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-submit:active {
  transform: scale(0.98);
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Password Strength Indicator */
.password-strength {
  height: 3px;
  border-radius: 2px;
  margin-top: 0.5rem;
  background: var(--bg-tertiary);
  overflow: hidden;
  transition: opacity var(--transition-fast);
  opacity: 0;
}

.password-strength.visible {
  opacity: 1;
}

.password-strength::after {
  content: '';
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width var(--transition-normal), background var(--transition-normal);
}

.password-strength.weak::after {
  width: 33%;
  background: var(--danger);
}

.password-strength.medium::after {
  width: 66%;
  background: var(--warning);
}

.password-strength.strong::after {
  width: 100%;
  background: var(--success);
}

/* Auth page responsive */
@media (max-width: 768px) {
  .auth-layout {
    flex-direction: column;
  }
  .auth-hero {
    flex: none;
    padding: 2rem 1.5rem;
    min-height: auto;
  }
  .auth-headline {
    font-size: 1.75rem;
  }
  .auth-features {
    display: none;
  }
  .auth-form-side {
    padding: 2rem 1.5rem;
  }
}

/* ============================================
   Onboarding Overlay
   ============================================ */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.onboarding-overlay.visible {
  opacity: 1;
}

.onboarding-overlay.has-spotlight {
  background: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  clip-path: polygon(
    0% 0%, 0% 100%, var(--spot-x) 100%,
    var(--spot-x) var(--spot-y),
    calc(var(--spot-x) + var(--spot-w)) var(--spot-y),
    calc(var(--spot-x) + var(--spot-w)) calc(var(--spot-y) + var(--spot-h)),
    var(--spot-x) calc(var(--spot-y) + var(--spot-h)),
    var(--spot-x) 100%, 100% 100%, 100% 0%
  );
}

.onboarding-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl, 16px);
  padding: 2.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.35s ease;
  border: 1px solid var(--border);
}

.onboarding-step-indicator {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition-fast);
}

.onboarding-dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.onboarding-dot.done {
  background: var(--success);
}

.onboarding-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.onboarding-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.625rem;
  color: var(--text-primary);
}

.onboarding-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

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

.onboarding-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.onboarding-skip:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

.onboarding-next {
  padding: 0.625rem 1.5rem;
  font-weight: 600;
}

/* Dashboard View - Modern Layout */
#dashboardView {
  background: var(--bg-primary);
}

#dashboardView .container-fluid {
  padding: 2rem 1.5rem;
}

#dashboardView h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

#dashboardView .d-flex.justify-content-between {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* Let Bootstrap handle the grid layout with .row and .col-md-4 */
@media (max-width: 768px) {
  #dashboardView .container-fluid {
    padding: 1.5rem 1rem;
  }
}

#appContent {
  padding-top: 72px; /* accounts for fixed landing-nav height */
}

#editorView {
  overflow: hidden;
  height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
}

#editorView .container-fluid {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  height: 100%;
}

/* Resizable Editor Panels */
.editor-panels {
  display: flex;
  overflow: hidden;
}

.editor-panel-left {
  width: 33.333%;
  min-width: 280px;
  max-width: 60%;
  flex-shrink: 0;
}

.editor-panel-right {
  flex: 1;
  min-width: 400px;
  overflow: hidden;
}

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

.panel-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 32px;
  border-radius: 2px;
  background: var(--border);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.panel-resize-handle:hover {
  background: var(--hover-bg);
}

.panel-resize-handle:hover::after,
.panel-resize-handle.dragging::after {
  opacity: 1;
}

.panel-resize-handle.dragging {
  background: var(--accent);
  opacity: 0.15;
}

/* Project Cards - Modern Design */
.project-card {
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.project-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-card .card-img-top {
  height: 160px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border);
}

/* Left Panel Column - CRITICAL: Fixed height prevents reflow */
#leftPanel {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Chat Interface - Lovable Style with Independent Scrolling */
#chatPanel {
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  overflow: hidden; /* Prevent outer scroll */
}

/* Chat Content - Hidden when Visual Edits mode is active */
#chatContent {
  display: flex;
  flex-direction: column;
  flex: 1; /* CRITICAL: fill available space in flex parent */
  min-height: 0; /* CRITICAL: allow flex shrinking */
}

#chatContent[style*="display: none"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Visual Edits Content - Hidden by default, MUST have same flex structure as chatContent */
#visualEditsContent {
  display: none;
  flex-direction: column; /* Same as chatContent */
  flex: 1; /* CRITICAL: fill available space in flex parent */
  min-height: 0; /* CRITICAL: allow flex shrinking */
}

#visualEditsContent[style*="display: block"] {
  display: flex !important; /* FLEX not block - critical for fixed height */
  visibility: visible !important;
  flex: 1; /* CRITICAL: fill available space */
  min-height: 0; /* CRITICAL: allow flex shrinking */
}

/* Visual Edits scrollable area - same pattern as chatMessages */
#visualEditsContent > .flex-grow-1 {
  flex: 1;
  min-height: 0; /* Critical: allows overflow scrolling without affecting parent */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem; /* Match chatMessages padding */
}

#chatMessages {
  background-color: var(--bg-primary);
  overflow-y: auto; /* Independent scrolling */
  overflow-x: hidden;
  padding: 1rem;
  flex: 1; /* Take available space */
  min-height: 0; /* Allow flex shrinking */
}

.message {
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.message-user {
  text-align: left;
}

.message-assistant {
  text-align: left;
}

.message-bubble {
  display: inline-block;
  max-width: 85%;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-md);
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap; /* Preserve line breaks at bubble level too */
  overflow-wrap: break-word; /* Break long words if needed */
}

.message-user .message-bubble {
  background-color: var(--primary);
  color: var(--accent);
  border: 1px solid #1a1a1a;
}

.message-assistant .message-bubble {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.message-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.message-code {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 0.75rem 0;
  overflow-x: auto;
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Code Editor Toolbar */
.editor-toolbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

#currentFileName {
  flex-grow: 1;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#currentFileName i {
  flex-shrink: 0;
  color: var(--text-muted);
}

#saveFileBtn {
  flex-shrink: 0;
  font-size: 13px;
  padding: 0.375rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

#saveFileBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#saveFileBtn i {
  font-size: 14px;
}

/* Code Editor - Minimal Theme with Independent Scrolling */
#codeTab > .d-flex > .flex-grow-1 > .CodeMirror {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: auto !important;
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Courier New", monospace;
  font-size: 13px;
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}

.CodeMirror-gutters {
  background-color: var(--bg-secondary) !important;
  border-right: 1px solid var(--border) !important;
}

.CodeMirror-linenumber {
  color: var(--text-muted) !important;
}

/* Monaco Editor Styling */
.monaco-editor {
  font-family: "SF Mono", "Monaco", "Cascadia Code", "Courier New", monospace !important;
  font-size: 13px !important;
}

.monaco-editor .margin {
  background-color: var(--bg-secondary) !important;
}

.monaco-editor .line-numbers {
  color: var(--text-muted) !important;
}

/* Monaco in light theme */
body[data-theme="light"] .monaco-editor {
  --vscode-editor-background: #ffffff;
  --vscode-editor-foreground: #000000;
}

/* Monaco in dark theme */
body[data-theme="dark"] .monaco-editor {
  --vscode-editor-background: var(--bg-primary);
  --vscode-editor-foreground: var(--text-primary);
}

/* Code Tab - Complete Height Cascade with new toolbar structure */
#codeTab {
  display: flex;
  flex-direction: column;
}

/* Outer flex container (toolbar + content) */
#codeTab > .d-flex.flex-column {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Toolbar at top of code tab */
#codeTab > .d-flex.flex-column > div:first-child {
  flex-shrink: 0;
}

/* Editor content area (file tree + editor + component panel) */
#codeTab > .d-flex.flex-column > .d-flex.flex-grow-1 {
  flex: 1;
  min-height: 0; /* Critical for flex child scrolling */
}

/* Editor container - specific ID selector */
#editorContainer {
  position: relative;
  flex: 1;
  min-height: 0; /* Critical for flex child scrolling */
  min-width: 0; /* Critical for flex child to take width */
  overflow: hidden; /* Monaco handles its own scrolling */
}

/* Hide the textarea when using Monaco */
#editorContainer > textarea {
  display: none;
}

/* Monaco editor - ensure it fills and can scroll */
#editorContainer > .monaco-editor {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: auto !important;
  width: auto !important;
}

/* File Tree - Minimal with Folder Support */
#fileTree {
  list-style: none;
  padding: 0.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  user-select: none;
}

/* Folder Items */
.folder-item {
  margin-bottom: 2px;
}

.folder-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-header:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.folder-chevron {
  margin-right: 0.25rem;
  font-size: 12px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.folder-icon {
  margin-right: 0.625rem;
  font-size: 14px;
  flex-shrink: 0;
}

.folder-name {
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.folder-header:hover .folder-name {
  color: var(--text-primary);
}

.folder-children {
  /* Container for nested files/folders */
}

/* File Items */
.file-item {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.file-item:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.file-item.active {
  background-color: var(--bg-tertiary);
  color: var(--accent);
  font-weight: 500;
}

.file-item i {
  margin-right: 0.625rem;
  font-size: 14px;
  flex-shrink: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* File type specific colors */
.file-item .bi-filetype-html {
  color: #e34c26 !important;
}

.file-item .bi-filetype-css {
  color: #264de4 !important;
}

.file-item .bi-filetype-js {
  color: #f0db4f !important;
}

.file-item .bi-filetype-json {
  color: #10b981 !important;
}

.file-item .bi-file-earmark-code.text-primary {
  color: #3178c6 !important; /* TypeScript blue for .tsx */
}

.file-item .bi-file-earmark-code.text-info {
  color: #3178c6 !important; /* TypeScript blue for .ts */
}

.file-item .bi-file-earmark-code.text-warning {
  color: #61dafb !important; /* React blue for .jsx */
}

/* Active file icon color preservation */
.file-item.active i {
  opacity: 1;
}

/* Folder icon color - warm yellow */
.folder-icon.text-warning {
  color: #f59e0b !important;
}

/* Preview Frame */
#previewFrame {
  border: none;
  background-color: #ffffff;
  width: 100%;
  height: 100%;
  display: block;
}

/* Tabs - Minimal */
.nav-tabs {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Grouped editor tabs with dividers and scroll overflow */
.editor-tabs-grouped {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;
}

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

.tab-divider {
  width: 1px;
  background: var(--border);
  margin: 0.25rem 0.375rem;
  align-self: stretch;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Tab content must fill remaining space */
.tab-content {
  flex: 1;
  min-height: 0; /* Critical for flex scrolling */
  overflow: hidden;
  position: relative; /* Create positioning context */
}

.tab-pane {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  display: none !important; /* Hide by default - IMPORTANT to override Bootstrap */
  visibility: hidden; /* Extra insurance */
  pointer-events: none; /* Prevent any interaction when hidden */
}

.tab-pane.active {
  display: block !important; /* Show when active */
  visibility: visible; /* Make visible */
  pointer-events: auto; /* Allow interaction */
}

.nav-tabs .nav-link {
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.45rem 0.75rem;
  font-size: 10.4px;
  font-weight: 500;
  transition: color var(--transition-fast), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color var(--transition-fast);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-tabs .nav-link i {
  font-size: 8.4px;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-bottom-color: var(--border);
  background-color: var(--hover-bg);
}

.nav-tabs .nav-link.active {
  color: var(--accent);
  background-color: transparent;
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
}

/* Loading Spinner */
.spinner-border {
  border-color: var(--border);
  border-right-color: var(--text-primary);
}

.spinner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

/* Legacy Bootstrap Toast (kept for any remaining usage) */
.toast {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  min-width: 280px;
}

.toast-header {
  background-color: transparent;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

/* ============================================
   Unified Toast System (tyga-toast)
   ============================================ */
.tyga-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.tyga-toast {
  pointer-events: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.tyga-toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.tyga-toast-exit {
  opacity: 0;
  transform: translateX(80px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tyga-toast-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--toast-accent);
  border-radius: 10px 0 0 10px;
}

.tyga-toast-content {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem 0.75rem 1.125rem;
}

.tyga-toast-icon {
  color: var(--toast-accent);
  font-size: 16px;
  flex-shrink: 0;
}

.tyga-toast-message {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-primary);
}

.tyga-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.tyga-toast-close:hover {
  color: var(--text-primary);
  background: var(--hover-bg);
}

.tyga-toast-close i {
  font-size: 12px;
}

.tyga-toast-progress {
  height: 3px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.tyga-toast-progress-bar {
  height: 100%;
  background: var(--toast-accent);
  animation: tyga-toast-shrink linear forwards;
  transform-origin: left;
}

@keyframes tyga-toast-shrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* Dark mode refinements */
body[data-theme="dark"] .tyga-toast {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 576px) {
  .tyga-toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

/* Empty State (legacy — kept for filtered results) */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
}

.empty-state h5 {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Enhanced Empty State (dashboard hero) */
.empty-state-hero {
  text-align: center;
  padding: 5rem 2rem 4rem;
  max-width: 600px;
  margin: 0 auto;
  animation: fadeIn 0.5s ease;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.75rem;
  font-size: 2rem;
  color: var(--accent);
}

.empty-state-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.625rem;
  color: var(--text-primary);
}

.empty-state-desc {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.empty-state-cta {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.empty-state-cta:active {
  transform: scale(0.97);
}

.empty-state-templates {
  margin-top: 3rem;
}

.empty-state-templates-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.empty-state-template-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  justify-content: center;
}

.empty-state-template {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.empty-state-template:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.empty-state-template i {
  font-size: 1rem;
  opacity: 0.7;
}

/* Skeleton Loading Cards */
.skeleton-card {
  pointer-events: none;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--hover-bg) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  margin-bottom: 0.75rem;
}

.skeleton-line.skeleton-title {
  height: 18px;
  width: 65%;
  margin-bottom: 1rem;
}

.skeleton-line.skeleton-text {
  width: 90%;
}

.skeleton-line.skeleton-text.short {
  width: 50%;
}

.skeleton-line.skeleton-bar {
  height: 8px;
  width: 100%;
  margin-top: 1rem;
  margin-bottom: 0;
  border-radius: 4px;
}

.skeleton-card:nth-child(even) .skeleton-line {
  animation-delay: 0.15s;
}

/* Badge - Modern Style */
.badge {
  font-weight: 500;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s ease;
}

.badge i {
  font-size: 13px;
}

.bg-success {
  background-color: var(--success) !important;
  color: white !important;
}

.bg-danger {
  background-color: var(--danger) !important;
  color: white !important;
}

.bg-warning {
  background-color: var(--warning) !important;
  color: white !important;
}

.bg-info {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

.bg-primary {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

.bg-secondary {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}

/* Category Badge */
.category-badge {
  font-size: 11px;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-primary) !important;
  transition: all 0.2s ease;
}

.category-badge:hover {
  background-color: var(--bg-tertiary);
  border-color: #3a3a3a;
}

/* Scrollbar - Minimal */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* Text Colors */
.text-muted {
  color: var(--text-muted) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

/* Links */
a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent);
}

/* Dropdown */
.dropdown-menu {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  min-width: 320px; /* Wider dropdowns to prevent text wrapping */
}

.dropdown-item {
  color: var(--text-secondary);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.dropdown-divider {
  border-top-color: var(--border);
}

/* Modal - Modern Card Style */
.modal-content {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.modal-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
}

.modal-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.modal-body {
  padding: 2rem;
  color: var(--text-primary);
}

.modal-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
}

.btn-close {
  filter: invert(1);
  opacity: 0.5;
}

body[data-theme="light"] .btn-close {
  filter: invert(0);
}

.btn-close:hover {
  opacity: 1;
}

/* Utility Classes */
.cursor-pointer {
  cursor: pointer;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
  #chatPanel {
    display: none;
  }

  #chatPanel.show {
    display: block;
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background-color: var(--bg-secondary);
  }
}

/* Loading Animation */
.loading-dots::after {
  content: "";
  animation: dots 1.5s steps(4, end) infinite;
}

/* Anthropic-style subtle animations */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus states - Minimal */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 2px;
}

/* Stack Selector - Minimal Card Style */
.stack-selector {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.stack-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.stack-card:hover {
  border-color: #404040;
  background-color: var(--hover-bg);
  transform: translateY(-2px);
}

.stack-card.selected {
  border-color: var(--accent);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 1px var(--accent);
}

.stack-icon {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.stack-card.selected .stack-icon {
  background-color: var(--bg-tertiary);
}

.stack-info {
  flex-grow: 1;
}

.stack-name {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stack-description {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.stack-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tech-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stack-card.selected .tech-badge {
  border-color: #404040;
  color: var(--text-primary);
}

.stack-components {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.stack-components i {
  margin-right: 0.25rem;
}

/* Stack Option Cards (new selector) */
.stack-option {
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0.5rem;
}

.stack-option:last-child {
  margin-bottom: 0;
}

.stack-option:hover {
  border-color: var(--text-muted);
  background: var(--hover-bg);
}

.stack-option.selected {
  border-color: var(--accent);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 1px var(--accent);
}

.stack-option-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.stack-option-icon {
  font-size: 1.1rem;
  color: var(--accent);
}

.stack-option-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.stack-option-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.stack-check {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stack-card.selected .stack-check {
  opacity: 1;
}

/* Stack badges with modern styling */
.badge.bg-info {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
}

/* Component Panel */
.component-panel {
  width: 0;
  overflow: hidden;
  transition: width 0.3s ease;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

.component-panel.show {
  width: 320px;
}

.component-panel-header {
  flex-shrink: 0;
  background-color: var(--bg-tertiary);
}

.component-panel-header h6 {
  color: var(--text-primary);
  font-weight: 600;
}

.component-panel-body {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

#componentGrid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Component Cards */
.component-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.component-card:hover {
  border-color: #3a3a3a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.component-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.component-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--text-primary);
}

.component-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.component-category {
  margin-top: 0.25rem;
}

.component-category .badge {
  font-size: 10px;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
}

.component-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.component-actions {
  margin-top: auto;
}

.insert-component-btn {
  font-size: 12px;
  padding: 0.5rem 0.75rem;
  transition: all 0.2s ease;
}

.insert-component-btn:hover {
  transform: scale(1.02);
}

.insert-component-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Toggle Button Active State */
#toggleComponentPanel.active {
  background-color: var(--hover-bg);
  color: var(--accent);
  border-color: var(--accent);
}

/* Legacy toast-notification (superseded by .tyga-toast) */

/* ============================================
   Keyboard Shortcut Help Overlay
   ============================================ */
.shortcut-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.shortcut-overlay.visible {
  opacity: 1;
}

.shortcut-dialog {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  animation: slideIn 0.25s ease;
}

.shortcut-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.shortcut-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.shortcut-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

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

.shortcut-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  max-height: calc(80vh - 70px);
}

.shortcut-group {
  margin-bottom: 1.25rem;
}

.shortcut-group:last-child {
  margin-bottom: 0.5rem;
}

.shortcut-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font-size: 0.85rem;
}

.shortcut-desc {
  color: var(--text-secondary);
}

.shortcut-keys {
  display: flex;
  gap: 3px;
}

.shortcut-keys kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--text-primary);
  min-width: 20px;
  text-align: center;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

/* Responsive Component Panel */
@media (max-width: 1200px) {
  .component-panel.show {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .component-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    width: 0 !important;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  }
  
  .component-panel.show {
    width: 100% !important;
    max-width: 320px !important;
  }
}

/* Migration UI Styles */
.stack-migration-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.stack-migration-card:hover {
  border-color: #3a3a3a;
  background-color: var(--hover-bg);
}

.migration-btn,
.rollback-btn {
  font-size: 12px;
  padding: 0.375rem 0.75rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

.migration-btn i,
.rollback-btn i {
  font-size: 12px;
}

/* Alert overrides for migration modals */
.modal-body .alert {
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.modal-body .alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
  color: var(--text-primary);
}

.modal-body .alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
  color: var(--text-primary);
}

/* Progress Modal Styling */
#migrationProgressModal .modal-content {
  background-color: var(--bg-secondary);
}

#migrationProgressModal .spinner-border {
  border-width: 3px;
}

/* Success Modal */
.modal-header.bg-success {
  background-color: var(--success) !important;
  border-bottom: none;
}

.modal-header.bg-success .modal-title {
  color: white;
}

/* Skeleton Loaders */
.skeleton-loader {
  padding: 0.5rem 0;
}

.skeleton-file-item {
  height: 28px;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--hover-bg) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.skeleton-file-item:nth-child(2) {
  width: 85%;
}

.skeleton-file-item:nth-child(4) {
  width: 90%;
}

.skeleton-file-item:nth-child(6) {
  width: 80%;
}

.skeleton-editor-line {
  height: 20px;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    var(--hover-bg) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 12px;
  margin-left: 1rem;
}

.skeleton-editor-line:nth-child(odd) {
  animation-delay: 0.1s;
}

/* Hide skeleton when content is loaded */
.skeleton-loader.hidden {
  display: none;
}

/* ===========================================
   Lovable.ai-Style Chat Interface (Phase 1)
   =========================================== */

/* Message Container - Lovable.ai Pattern */
.message {
  margin-bottom: 1.5rem;
  animation: slideIn 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Message Header - Avatar + Meta */
.message-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.message-assistant .message-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
}

.message-user .message-avatar {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border: none;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
}

.message-sender {
  font-weight: 600;
  color: var(--text-primary);
}

.message-timestamp {
  color: var(--text-muted);
  font-size: 12px;
}

/* Message Bubble - Clean Lovable Style */
.message-bubble {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  max-width: 100%;
  word-wrap: break-word;
  margin-left: 42px; /* Align with avatar */
  /* FIX: Ensure bubble fits content - no excess whitespace */
  display: inline-block;
  min-height: auto !important;
  height: auto !important;
}

.message-user .message-bubble {
  background-color: var(--primary);
  border-color: #2a2a2a;
}

body[data-theme="dark"] .message-user .message-bubble {
  background-color: #1a1a1a;
}

.message-content {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  white-space: normal; /* Don't preserve excessive whitespace */
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* FIX: Ensure content fits - no excess whitespace */
  display: block;
  margin: 0;
  padding: 0;
}

/* Remove trailing br tags' effect */
.message-content br:last-child {
  display: none;
}

.message-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.message-content em {
  font-style: italic;
  color: var(--text-secondary);
}

.message-content code {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 13px;
}

/* File Chips - Lovable Pattern */
.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-chip:hover {
  background-color: var(--hover-bg);
  border-color: #3a3a3a;
  transform: translateY(-1px);
}

.file-chip-created {
  border-left: 3px solid var(--success);
}

.file-chip-updated {
  border-left: 3px solid #3b82f6;
}

.file-chip strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Code Blocks - Syntax Highlighted */
.code-block-wrapper {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-secondary);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.875rem;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.code-language {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-code-btn {
  padding: 0.25rem 0.625rem;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s ease;
}

.copy-code-btn:hover {
  background-color: var(--hover-bg);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  background-color: var(--bg-primary);
}

.code-block-wrapper code {
  font-family: "SF Mono", "Monaco", "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Message Actions - Hover Reveal */
.message-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: 42px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.message:hover .message-actions {
  opacity: 1;
}

.message-action-btn {
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  border: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.message-action-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  border-color: #3a3a3a;
}

.message-action-btn i {
  font-size: 13px;
}

/* Typing Indicator - Animated Dots */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Chat Input Area - Enhanced Auto-Expand (Cline-style) */
#chatForm {
  flex-shrink: 0;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

#chatInput {
  resize: none;
  min-height: 44px;
  max-height: 200px;
  padding: 0.75rem 1rem;
  font-size: 14px;
  line-height: 1.5;
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow-y: hidden; /* Start with hidden, auto-expand will manage */
  font-family: inherit;
  
  /* Ensure textarea aligns with button */
  display: block;
  width: 100%;
}

/* Auto-expand class for identification */
.auto-expand-textarea {
  box-sizing: border-box;
}

#chatInput:focus {
  border-color: #3a3a3a;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* Ensure input group handles textarea properly */
#chatForm .input-group {
  align-items: flex-end; /* Align button to bottom when textarea expands */
}

/* Send button stays fixed height */
#chatForm .input-group .btn {
  flex-shrink: 0;
  align-self: stretch; /* Match the height of the input */
  min-height: 44px;
}

/* Chat Controls */
.chat-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-ghost {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.375rem 0.75rem;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background-color: var(--hover-bg);
  border-color: #3a3a3a;
  color: var(--text-primary);
}

/* Loading State - Message Skeleton */
[data-loading="true"] .message-bubble {
  min-height: 60px;
  display: flex;
  align-items: center;
}

/* Empty Chat State */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.chat-empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.chat-empty-state h5 {
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.chat-empty-state p {
  font-size: 13px;
  max-width: 300px;
}

/* Responsive Chat */
@media (max-width: 768px) {
  .message-bubble {
    margin-left: 0;
  }
  
  .message-actions {
    margin-left: 0;
  }
  
  .file-chips {
    flex-direction: column;
  }
  
  .file-chip {
    width: 100%;
  }
}

/* ===========================================
   Phase 2: Monaco Diff Editor & Changes Tab
   =========================================== */

/* Changes Tab Container */
#changesTab {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#changesTab > .d-flex.flex-column {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Diff Editor Container */
#diffEditorContainer {
  position: relative;
  flex: 1;
  min-height: 400px; /* CRITICAL: Monaco needs explicit minimum height */
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Monaco Diff Editor */
.monaco-diff-editor {
  font-family: "SF Mono", "Monaco", "Cascadia Code", monospace !important;
  font-size: 13px !important;
}

/* Diff Editor Empty State */
#diffEmptyState {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
}

#diffEmptyState .text-center {
  padding: 3rem 2rem;
}

#diffEmptyState i {
  color: var(--text-muted);
  opacity: 0.3;
}

#diffEmptyState p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 0.5rem;
}

#diffEmptyState small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Diff Stats Bar */
#diffStatsBar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.625rem 1rem;
}

#diffStatsBar .d-flex {
  font-size: 13px;
}

#diffStatsBar .text-success {
  color: var(--success) !important;
}

#diffStatsBar .text-danger {
  color: var(--danger) !important;
}

#diffStatsBar .text-primary {
  color: #3b82f6 !important;
}

#diffStatsBar strong {
  font-weight: 600;
  margin-left: 0.25rem;
  margin-right: 0.125rem;
}

/* Changes Toolbar */
#changesTab .border-bottom.p-2 {
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border) !important;
}

#changesFileName {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#changesFileNameText {
  color: var(--text-primary);
  font-weight: 500;
}

/* Diff View Mode Toggle */
#diffViewMode .btn-check:checked + label {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  border-color: #3a3a3a;
}

#diffViewMode label {
  padding: 0.375rem 0.75rem;
  font-size: 13px;
  transition: all 0.2s ease;
}

#diffViewMode label i {
  font-size: 14px;
}

/* Diff Navigation Buttons */
#prevChangeBtn,
#nextChangeBtn {
  padding: 0.375rem 0.75rem;
  font-size: 13px;
}

#prevChangeBtn i,
#nextChangeBtn i {
  font-size: 14px;
}

/* Accept/Reject Buttons */
#acceptChangesBtn,
#rejectChangesBtn {
  padding: 0.375rem 1rem;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

#acceptChangesBtn {
  background-color: var(--success);
  border-color: var(--success);
  color: white;
}

#acceptChangesBtn:hover:not(:disabled) {
  background-color: #0ea672;
  border-color: #0ea672;
}

#acceptChangesBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#rejectChangesBtn {
  background-color: var(--danger);
  border-color: var(--danger);
  color: white;
}

#rejectChangesBtn:hover:not(:disabled) {
  background-color: #dc2626;
  border-color: #dc2626;
}

#rejectChangesBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Vertical Divider in Toolbar */
.vr {
  background-color: var(--border);
  width: 1px;
  height: 24px;
  margin: 0 0.5rem;
}

/* Monaco Diff Editor Overrides for Theme */
body[data-theme="dark"] .monaco-diff-editor .original,
body[data-theme="dark"] .monaco-diff-editor .modified {
  background-color: var(--bg-primary) !important;
}

body[data-theme="dark"] .monaco-diff-editor .line-insert {
  background-color: rgba(16, 185, 129, 0.15) !important;
}

body[data-theme="dark"] .monaco-diff-editor .line-delete {
  background-color: rgba(239, 68, 68, 0.15) !important;
}

body[data-theme="dark"] .monaco-diff-editor .char-insert {
  background-color: rgba(16, 185, 129, 0.3) !important;
}

body[data-theme="dark"] .monaco-diff-editor .char-delete {
  background-color: rgba(239, 68, 68, 0.3) !important;
}

body[data-theme="light"] .monaco-diff-editor .line-insert {
  background-color: rgba(16, 185, 129, 0.1) !important;
}

body[data-theme="light"] .monaco-diff-editor .line-delete {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

body[data-theme="light"] .monaco-diff-editor .char-insert {
  background-color: rgba(16, 185, 129, 0.2) !important;
}

body[data-theme="light"] .monaco-diff-editor .char-delete {
  background-color: rgba(239, 68, 68, 0.2) !important;
}

/* Diff Gutter Decorations */
.monaco-diff-editor .line-numbers {
  color: var(--text-muted) !important;
}

.monaco-diff-editor .margin {
  background-color: var(--bg-secondary) !important;
}

/* Changes Tab Badge/Indicator */
.nav-tabs .nav-link[href="#changesTab"] {
  position: relative;
}

.nav-tabs .nav-link[href="#changesTab"].has-changes::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* Diff Loading State */
.diff-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.diff-loading .spinner-border {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
  margin-bottom: 1rem;
}

/* Diff Success/Error States */
.diff-alert {
  margin: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid;
  font-size: 14px;
}

.diff-alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--text-primary);
}

.diff-alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--text-primary);
}

/* Enhanced Monaco Features */
.monaco-editor .suggest-widget {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.monaco-editor .monaco-list-row {
  background-color: transparent !important;
  color: var(--text-primary) !important;
}

.monaco-editor .monaco-list-row.focused {
  background-color: var(--hover-bg) !important;
}

.monaco-editor .monaco-list-row.selected {
  background-color: var(--bg-tertiary) !important;
}

/* Breadcrumbs */
.monaco-editor .breadcrumbs-control {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}

/* Sticky Scroll */
.monaco-editor .sticky-widget {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* IntelliSense Documentation */
.monaco-editor .parameter-hints-widget {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* Hover Widget */
.monaco-editor .monaco-hover {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
}

.monaco-editor .monaco-hover-content {
  color: var(--text-primary) !important;
}

/* Find Widget */
.monaco-editor .find-widget {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Responsive Diff Editor */
@media (max-width: 768px) {
  #diffEditorContainer {
    font-size: 12px;
  }
  
  #diffStatsBar {
    flex-wrap: wrap;
  }
  
  #diffStatsBar .d-flex {
    flex-direction: column;
    gap: 0.5rem !important;
  }
  
  #acceptChangesBtn,
  #rejectChangesBtn {
    font-size: 12px;
    padding: 0.375rem 0.75rem;
  }
  
  #acceptChangesBtn span,
  #rejectChangesBtn span {
    display: none;
  }
}

/* Smooth Transitions */
.monaco-diff-editor,
#diffEditorContainer,
#diffStatsBar,
#changesTab .border-bottom {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Print Styles for Diff */
@media print {
  #changesTab .border-bottom.p-2,
  #diffStatsBar {
    display: none;
  }
  
  #diffEditorContainer {
    height: auto !important;
    overflow: visible !important;
  }
}

/* ===========================================
   Phase 3: AI Context Panel (MCP Integration)
   =========================================== */

/* Context Panel Container */
.context-panel {
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

.context-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-tertiary);
}

.context-header h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.context-header i {
  font-size: 16px;
  color: var(--text-secondary);
}

/* Token Stats */
.context-tokens {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-primary);
}

.token-stats {
  font-size: 13px;
}

.token-stats .small {
  color: var(--text-secondary);
  font-weight: 500;
}

.token-stats strong {
  color: var(--text-primary);
  font-weight: 600;
}

.token-stats .progress {
  height: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.token-stats .progress-bar {
  transition: width 0.3s ease;
}

.token-stats .text-muted {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Context Files Section */
.context-files {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.context-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg-tertiary);
}

.context-section-header span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.context-section-header small {
  font-size: 12px;
}

.context-files-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

/* Context File Item */
.context-file-item {
  margin-bottom: 0.25rem;
}

.context-file-item .form-check {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

.context-file-item .form-check:hover {
  background-color: var(--hover-bg);
}

.context-file-item .form-check-input {
  margin-top: 0.25rem;
  cursor: pointer;
  border-color: var(--border);
}

.context-file-item .form-check-input:checked {
  background-color: var(--success);
  border-color: var(--success);
}

.context-file-item .form-check-label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}

.context-file-item .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-file-item small {
  color: var(--text-muted);
  font-size: 11px;
}

.context-file-item i {
  flex-shrink: 0;
}

/* Context Actions */
.context-actions {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  display: flex;
  gap: 0.5rem;
}

.context-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

/* Context Badge in Accordion */
#contextBadge {
  font-size: 11px;
  padding: 0.25rem 0.5rem;
  font-weight: 500;
}

/* Accordion Overrides for Context Panel */
#contextAccordion .accordion-button {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border: none;
}

#contextAccordion .accordion-button:not(.collapsed) {
  background-color: var(--bg-secondary);
  box-shadow: none;
}

#contextAccordion .accordion-button:focus {
  box-shadow: none;
  border-color: var(--border);
}

#contextAccordion .accordion-button::after {
  background-size: 1rem;
  filter: invert(0.5);
}

body[data-theme="dark"] #contextAccordion .accordion-button::after {
  filter: invert(1);
}

#contextAccordion .accordion-item {
  border: none;
  background-color: transparent;
}

#contextAccordion .accordion-body {
  padding: 0;
  background-color: var(--bg-primary);
}

/* Empty State in Context Panel */
.context-files-list .text-center {
  padding: 2rem 1rem;
}

.context-files-list .text-center i {
  font-size: 2rem;
  opacity: 0.3;
  margin-bottom: 0.5rem;
}

/* Responsive Context Panel */
@media (max-width: 768px) {
  .context-panel {
    max-height: 250px;
  }
  
  #aiContextPanel {
    max-height: 250px !important;
  }
  
  .context-files-list {
    max-height: 150px;
  }
}

/* Context Panel Scrollbar */
.context-files-list::-webkit-scrollbar {
  width: 6px;
}

.context-files-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.context-files-list::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.context-files-list::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* Animation for Context Panel */
#contextPanelCollapse {
  transition: height 0.3s ease;
}

/* Token Warning Colors */
.token-stats .progress-bar.bg-success {
  background-color: var(--success) !important;
}

.token-stats .progress-bar.bg-warning {
  background-color: var(--warning) !important;
}

.token-stats .progress-bar.bg-danger {
  background-color: var(--danger) !important;
}

/* Context Panel Loading State */
.context-tokens .text-muted.text-center {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.context-tokens .bi-hourglass-split {
  animation: spin 2s linear infinite;
}

/* ===========================================
   Phase 4: Advanced Features
   =========================================== */

/* Conversation Tree */
.conversation-tree {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.current-branch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.branches-list {
  margin-top: 0.75rem;
}

.branches-list .list-group-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
}

.branches-list .list-group-item:hover {
  background-color: var(--hover-bg);
  border-color: #3a3a3a;
}

.branches-list .list-group-item.active {
  background-color: var(--bg-secondary);
  border-color: var(--success);
  border-left-width: 3px;
}

.branch-info strong {
  color: var(--text-primary);
  font-size: 13px;
}

.branch-actions {
  display: flex;
  gap: 0.375rem;
}

/* Multi-File Search */
.multi-file-search {
  padding: 1rem;
  background-color: var(--bg-primary);
}

.search-input-group .input-group {
  margin-bottom: 0.75rem;
}

.search-options {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
}

.search-results {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.results-summary {
  padding: 0.5rem 0;
  font-size: 12px;
  color: var(--text-muted);
}

.file-result {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.file-header {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.match-item {
  padding: 0.375rem 0.5rem;
  margin: 0.25rem 0;
  background-color: var(--bg-primary);
  border-radius: 4px;
  font-size: 12px;
}

.match-line {
  display: block;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.match-line mark {
  background-color: rgba(245, 158, 11, 0.3);
  border-radius: 2px;
  padding: 0.125rem 0.25rem;
}

/* Code Reviewer */
.code-reviewer {
  padding: 1rem;
  background-color: var(--bg-primary);
}

.reviewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.reviewer-header h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.review-options {
  padding: 0.75rem;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.review-results {
  min-height: 200px;
}

.review-summary {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.score-badge {
  font-size: 32px;
  font-weight: 700;
  margin: 0.5rem 0;
}

.issues-summary {
  margin: 1rem 0;
}

.issue-count {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.issue-count strong {
  display: block;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.issue-count.critical strong {
  color: var(--danger);
}

.issue-count.warning strong {
  color: var(--warning);
}

.issue-count.info strong {
  color: #3b82f6;
}

.issues-list {
  margin-top: 1rem;
}

.issue-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-left-width: 3px;
}

.issue-item.critical {
  border-left-color: var(--danger);
}

.issue-item.warning {
  border-left-color: var(--warning);
}

.issue-item.info {
  border-left-color: #3b82f6;
}

.severity-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.5rem;
}

.severity-badge.critical {
  background-color: var(--danger);
  color: white;
}

.severity-badge.warning {
  background-color: var(--warning);
  color: white;
}

.severity-badge.info {
  background-color: #3b82f6;
  color: white;
}

.issue-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.issue-suggestion {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
}

.issue-suggestion code {
  font-size: 12px;
  color: var(--text-primary);
}

/* AI Test Runner */
.ai-test-runner {
  padding: 1rem;
  background-color: var(--bg-primary);
}

.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.test-header h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.test-options {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.test-content {
  min-height: 300px;
  padding: 1rem 0;
}

.generated-tests {
  padding: 0;
}

.test-files-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.test-file-item.card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.test-file-item.card:hover {
  border-color: #3a3a3a;
  transform: translateY(-1px);
}

.test-results {
  padding: 0;
}

.results-summary {
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.test-details {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.test-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  transition: all 0.2s ease;
}

.test-item:hover {
  border-color: #3a3a3a;
}

.test-item.passed {
  border-left: 3px solid var(--success);
}

.test-item.failed {
  border-left: 3px solid var(--danger);
}

.error-message {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 12px;
  color: var(--danger);
  font-family: "SF Mono", "Monaco", monospace;
  overflow-x: auto;
}

/* Responsive Phase 4 */
@media (max-width: 768px) {
  .tree-header,
  .reviewer-header,
  .test-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .search-options {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .stat-card {
    padding: 0.75rem;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .branch-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Utility Animations for Phase 4 */
.file-result,
.issue-item,
.test-item {
  animation: slideInUp 0.3s ease;
}

/* Phase 4 Loading States */
.test-content .spinner-border,
.review-results .spinner-border {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

/* ===========================================
   Streaming Mode Styles
   =========================================== */

/* Streaming content container */
.streaming-content {
  display: inline;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Blinking cursor during streaming */
.streaming-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background-color: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursor-blink 1s infinite;
}

/* Settings dropdown styles */
.dropdown-menu .form-check-label {
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
  color: var(--text-primary);
}

.dropdown-menu .form-check-label small {
  font-size: 0.75rem;
  line-height: 1.2;
  margin-top: 2px;
  display: block;
}

/* Fix text-muted in dropdowns for dark mode readability */
.dropdown-menu .text-muted {
  color: var(--text-secondary) !important;
}

body[data-theme="dark"] .dropdown-menu .text-muted {
  color: #b3b3b3 !important;
}

.dropdown-menu .form-check {
  margin-bottom: 0;
}

.dropdown-menu .form-check-input {
  cursor: pointer;
}

/* Streaming message container */
.message.streaming {
  animation: none; /* Disable slide-in animation during streaming */
}

/* Smooth scroll behavior during streaming */
#chatMessages.streaming {
  scroll-behavior: smooth;
}

/* Light theme cursor color */
body[data-theme="light"] .streaming-cursor {
  background-color: #000000;
}

/* Dark theme cursor color */
body[data-theme="dark"] .streaming-cursor {
  background-color: #ffffff;
}

/* ===========================================
   File Tabs (Lovable.ai / VS Code Style)
   =========================================== */

/* File Tabs Container */
.file-tabs-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  min-height: 40px;
  max-height: 40px;
  scrollbar-width: thin;
}

.file-tabs-container::-webkit-scrollbar {
  height: 4px;
}

.file-tabs-container::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

.file-tabs-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Individual Tab */
.editor-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-right: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
  position: relative;
}

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

.editor-tab.active {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 500;
  border-bottom: 2px solid var(--accent);
}

.editor-tab i {
  flex-shrink: 0;
  font-size: 14px;
}

.tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

/* Modified Indicator (dot) */
.modified-indicator {
  color: var(--warning);
  font-size: 18px;
  line-height: 1;
  margin: 0 -0.25rem 0 0;
}

/* Close Button */
.tab-close {
  background: none;
  border: none;
  padding: 0.125rem 0.25rem;
  margin-left: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 3px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

.editor-tab:hover .tab-close {
  opacity: 1;
}

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

.editor-tab.active .tab-close {
  opacity: 1;
}

.tab-close i {
  font-size: 16px;
  font-weight: 600;
}

/* File type icon colors in tabs */
.editor-tab .bi-filetype-html {
  color: #e34c26 !important;
}

.editor-tab .bi-filetype-css {
  color: #264de4 !important;
}

.editor-tab .bi-filetype-js {
  color: #f0db4f !important;
}

.editor-tab .bi-filetype-json {
  color: #10b981 !important;
}

.editor-tab .bi-file-earmark-code.text-primary {
  color: #3178c6 !important; /* TypeScript blue for .tsx */
}

.editor-tab .bi-file-earmark-code.text-info {
  color: #3178c6 !important; /* TypeScript blue for .ts */
}

.editor-tab .bi-file-earmark-code.text-warning {
  color: #61dafb !important; /* React blue for .jsx */
}

/* Active tab icon colors remain visible */
.editor-tab.active i {
  opacity: 1;
}

/* Responsive tabs */
@media (max-width: 768px) {
  .editor-tab {
    padding: 0.375rem 0.5rem;
    font-size: 12px;
  }
  
  .tab-name {
    max-width: 100px;
  }
  
  .tab-close {
    opacity: 1; /* Always show on mobile */
  }
}

/* Animation for new tabs */
@keyframes tabSlideIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.editor-tab {
  animation: tabSlideIn 0.2s ease;
}

/* Empty state when no tabs */
.file-tabs-container:empty {
  display: none !important;
}

/* ===========================================
   Streaming Diff Visualization
   =========================================== */

/* Streaming indicator on Changes tab */
.nav-tabs .nav-link[href="#changesTab"] .streaming-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 3px;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0);
  }
}

.streaming-badge .bi-circle-fill {
  font-size: 6px;
  animation: blink 1s infinite;
}

/* Diff editor streaming state */
#diffEditorContainer.streaming {
  border: 2px solid var(--bs-primary);
  animation: diff-pulse 2s infinite;
  box-shadow: 0 0 20px rgba(0, 123, 255, 0.15);
}

@keyframes diff-pulse {
  0%, 100% { 
    opacity: 1;
    border-color: var(--bs-primary);
  }
  50% { 
    opacity: 0.9;
    border-color: rgba(0, 123, 255, 0.6);
  }
}

/* Status indicator in Changes toolbar */
.streaming-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: 4px;
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.streaming-status.complete {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: var(--success);
  color: var(--success);
}

.streaming-status .spinner-border {
  width: 12px;
  height: 12px;
  border-width: 2px;
}

/* File count badge during streaming */
.file-streaming-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.file-streaming-count .bi-hourglass-split {
  animation: rotate 2s linear infinite;
}

/* Diff line highlighting during streaming */
.monaco-diff-editor .modified-line.streaming-new {
  background-color: rgba(16, 185, 129, 0.2) !important;
  animation: highlight-fade 1s ease-out;
}

/* Smooth scroll indicator */
.diff-scroll-indicator {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  color: var(--text-secondary);
  display: none;
  z-index: 10;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-scroll-indicator.show {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.diff-scroll-indicator:hover {
  background-color: var(--hover-bg);
  border-color: #3a3a3a;
}

/* Pending changes badge pulsing */
.nav-tabs .nav-link .badge.streaming {
  animation: badge-pulse 1.5s ease-in-out infinite;
}

/* Visual feedback for file updates */
.file-update-flash {
  animation: flash 0.5s ease-out;
}

/* Responsive streaming indicators */
@media (max-width: 768px) {
  .streaming-badge {
    font-size: 9px;
    padding: 0.125rem 0.375rem;
  }
  
  .file-streaming-count {
    display: none;
  }
  
  .diff-scroll-indicator {
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 11px;
    padding: 0.375rem 0.5rem;
  }
}

/* ===========================================
   Login & Register Views - Modern Card Design
   =========================================== */

#loginView,
#registerView {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 4rem 1rem;
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#loginView .card,
#registerView .card {
  max-width: 480px;
  width: 100%;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

#loginView .card:hover,
#registerView .card:hover {
  transform: none; /* Don't lift login forms on hover */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

#loginView h2,
#registerView h2 {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
  letter-spacing: -0.02em;
}

#loginView .form-control,
#registerView .form-control {
  padding: 0.875rem 1.125rem;
  font-size: 15px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

#loginView .form-control:focus,
#registerView .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

body[data-theme="dark"] #loginView .form-control:focus,
body[data-theme="dark"] #registerView .form-control:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

#loginView .btn-primary,
#registerView .btn-primary {
  padding: 0.875rem 1.5rem;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
}

#loginView p,
#registerView p {
  color: var(--text-secondary);
  font-size: 14px;
}

#loginView a,
#registerView a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

#loginView a:hover,
#registerView a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* Auth Card Animation */
#loginView .card,
#registerView .card {
  animation: fadeInUp 0.5s ease;
}

/* ===========================================
   AI Management Dashboard - Card Layout
   =========================================== */

.ai-management-dashboard {
  background-color: var(--bg-primary);
  min-height: 100%;
}

.ai-management-content {
  padding: 2rem;
  background-color: var(--bg-primary);
}

.config-section {
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.config-section:hover {
  box-shadow: var(--shadow-md);
  border-color: #3a3a3a;
}

.config-section h5 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.config-section h5 i {
  font-size: 20px;
  color: var(--text-secondary);
}

.config-section p.text-muted {
  font-size: 13px;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Form enhancements in config sections */
.config-section .form-control,
.config-section .form-select,
.config-section .form-range {
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.config-section .form-control:focus,
.config-section .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

body[data-theme="dark"] .config-section .form-control:focus,
body[data-theme="dark"] .config-section .form-select:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* Range slider modern styling */
.form-range {
  height: 6px;
  background-color: var(--bg-tertiary);
  border-radius: 3px;
}

.form-range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  background-color: var(--accent);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.form-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background-color: var(--accent);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.form-range::-moz-range-thumb:hover {
  transform: scale(1.1);
}

/* Switch toggle modern styling - Circular & Compact */
.form-check-input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 50% !important; /* Make it circular */
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.125rem;
  flex-shrink: 0;
}

.form-check-input[type="checkbox"]:checked {
  background-color: var(--success);
  border-color: var(--success);
}

.form-check-input[type="checkbox"]:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  border-color: var(--success);
}

body[data-theme="dark"] .form-check-input[type="checkbox"]:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Check mark inside circle */
.form-check-input[type="checkbox"]:checked::before {
  content: '✓';
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Form check wrapper in dropdowns */
.dropdown-menu .form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0.875rem;
  margin-bottom: 0;
}

.form-check-label {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  flex: 1;
  cursor: pointer;
}

/* Button group in config sections */
.config-section .d-flex.gap-2 {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.config-section .btn {
  padding: 0.75rem 2rem;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
}

/* Responsive config sections */
@media (max-width: 768px) {
  .ai-management-content {
    padding: 1rem;
  }
  
  .config-section {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  .config-section h5 {
    font-size: 16px;
  }
}

/* ==========================================
   WYSIWYG Visual Editor Styles
   ========================================== */

/* Modified input indicator for properties that have been changed */
.property-input-modified {
  border-left: 3px solid #0d6efd !important;
  background-color: #f0f8ff !important;
  transition: all 0.2s ease;
}

/* Focus state for modified inputs */
.property-input-modified:focus {
  background-color: #e6f2ff !important;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Revert button styling */
#revertChangesBtn {
  transition: all 0.2s ease;
}

#revertChangesBtn:hover {
  background-color: #6c757d;
  border-color: #6c757d;
  color: white;
}

/* Apply button with badge */
#propertyForm button[type="submit"] .badge {
  animation: pulse 1s infinite;
}

/* END WYSIWYG Visual Editor Styles */

/* ===========================================
   Documentation Panel - Modern Tab Grid
   =========================================== */

/* Diagram tabs grid - responsive with max 5 per row */
.diagram-tabs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Modern tab-style button */
.diagram-tabs-grid .btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-tertiary);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diagram-tabs-grid .btn:hover {
  background-color: var(--hover-bg);
  border-color: #3a3a3a;
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.diagram-tabs-grid .btn.active {
  background-color: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.diagram-tabs-grid .btn i {
  flex-shrink: 0;
  font-size: 16px;
}

/* Responsive - 5 columns on large screens */
@media (min-width: 1400px) {
  .diagram-tabs-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 4 columns on desktop */
@media (min-width: 992px) and (max-width: 1399px) {
  .diagram-tabs-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* 3 columns on tablet */
@media (min-width: 768px) and (max-width: 991px) {
  .diagram-tabs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 2 columns on mobile landscape */
@media (min-width: 576px) and (max-width: 767px) {
  .diagram-tabs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 1 column on mobile portrait */
@media (max-width: 575px) {
  .diagram-tabs-grid {
    grid-template-columns: 1fr;
  }
  
  .diagram-tabs-grid .btn {
    padding: 0.875rem 1rem;
  }
}

/* Documentation panel container */
.documentation-panel {
  padding: 1.5rem;
}

.documentation-panel .panel-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.documentation-panel .panel-header h3 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.documentation-panel .panel-header h3 i {
  font-size: 26px;
  color: var(--text-secondary);
}

/* Diagram container */
.diagram-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  min-height: 400px;
}

.diagram-description {
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
}

.mermaid-diagram {
  overflow-x: auto;
  padding: 1rem;
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
}

/* Diagram legend */
.diagram-legend {
  padding: 1.5rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.diagram-legend h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.diagram-legend .badge {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Smooth animations */
.diagram-tabs-grid .btn {
  animation: fadeInScale 0.3s ease;
}

/* Active tab indicator animation */
.diagram-tabs-grid .btn.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--success));
  opacity: 0.1;
  z-index: -1;
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% {
    opacity: 0.1;
  }
  50% {
    opacity: 0.2;
  }
}

/* ===========================================
   Task Badge Styles (Chat Integration)
   =========================================== */

/* Task Badge Container */
.task-badge-container {
  margin-top: 0.75rem;
}

.task-badge {
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.task-badge:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.task-badge .btn {
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.task-badge .btn:hover {
  transform: translateY(-1px);
}

.task-badge .progress {
  margin-top: 0.5rem;
  height: 6px;
  border-radius: 3px;
  background-color: var(--bg-tertiary);
}

.task-badge .progress-bar {
  transition: width 0.3s ease;
}

/* Task Progress Details */
.task-progress {
  margin-top: 0.5rem;
}

.task-progress small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

/* Task Badge Status Colors */
.task-badge.alert-info {
  background-color: rgba(13, 202, 240, 0.1);
  border-color: #0dcaf0;
}

.task-badge.alert-primary {
  background-color: rgba(13, 110, 253, 0.1);
  border-color: #0d6efd;
}

.task-badge.alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  border-color: #ffc107;
}

.task-badge.alert-success {
  background-color: rgba(25, 135, 84, 0.1);
  border-color: #198754;
}

.task-badge.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
}

/* Task Modal Styles */
.task-details .agent-item {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: background-color 0.2s ease;
}

.task-details .agent-item:hover {
  background-color: var(--hover-bg);
}

/* Task Badge Animation for Status Updates */
@keyframes task-update-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.02);
    opacity: 0.95;
  }
}

.task-badge.updating {
  animation: task-update-pulse 1s ease-in-out;
}

/* Responsive Task Badges */
@media (max-width: 768px) {
  .task-badge {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .task-badge .btn {
    margin-top: 0.5rem;
    width: 100%;
  }
}

/* ===========================================
   ICP Cards - Polished Hover Effects
   =========================================== */

.icp-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.icp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===========================================
   Console Tab Flash Animation
   =========================================== */

/* Flash animation for Console tab when errors occur */
@keyframes tab-flash {
  0%, 100% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(239, 68, 68, 0.2);
  }
}

.nav-tabs .nav-link.tab-flash {
  animation: tab-flash 1s ease-in-out;
}

/* Console Error Entry Styles */
.console-error-entry {
  animation: slideInError 0.3s ease;
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===========================================
   API Request Loading Bubble (Agent Progress)
   =========================================== */

/* API Request Loading Bubble - Visible & Animated */
.message.api-request-loading {
  opacity: 1 !important;
  visibility: visible !important;
  display: flex !important;
  animation: fadeIn 0.3s ease;
}

.message.api-request-loading .message-bubble {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.message.api-request-loading .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.message.api-request-loading .text-muted {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

/* Scraped Content Preview - Sitemap Streaming */
.scraped-content-preview {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
}

.scraped-content-preview .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.scraped-markdown-content {
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.scraped-markdown-content.show {
  display: block;
}

.scraped-markdown-content pre {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  color: #e0e0e0;
}

body[data-theme="light"] .scraped-markdown-content .card {
  background-color: #2d2d2d !important;
}

/* Progress step bubble - Base styles for agent progress messages */
.message-bubble.progress-step {
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.5rem;
  padding: 0.75rem 1rem !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  /* Force text visibility regardless of theme */
  color: #333 !important;
}

body[data-theme="dark"] .message-bubble.progress-step {
  color: #e5e5e5 !important;
}

.message-bubble.progress-step i {
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 0.1rem;
  color: inherit !important;
}

.message-bubble.progress-step .progress-message {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  /* Force text visibility */
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.message-bubble.progress-step code {
  background-color: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8em;
}

/* Progress step bubble with scraped content */
.progress-step .scraped-content-preview {
  max-width: 100%;
}

.progress-step .scraped-content-preview .badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
}

/* ============================================================================
   GIT TAB STYLES
   ============================================================================ */

/* Git Tab - Generation View */
.git-generation-view {
  animation: fadeIn 0.3s ease;
}

.generation-header {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border);
}

.generation-header h6 {
  color: var(--text-primary);
}

/* Worktree Cards */
.worktree-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.worktree-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.worktree-card.worktree-complete {
  opacity: 0.7;
}

.worktree-card .card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.worktree-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.worktree-current-file {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.75rem;
}

/* Worktree progress bar animation */
.worktree-card .progress-bar {
  transition: width 0.3s ease;
}

.worktree-card .progress-bar.bg-success {
  animation: pulse-success 1s ease-in-out;
}

@keyframes pulse-success {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Worktree Group Card (container for file cards) */
.worktree-group-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.worktree-group-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.worktree-group-card.worktree-complete {
  border-color: var(--success);
}

.worktree-group-header {
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.worktree-group-header h6 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 200px;
}

.worktree-group-status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.worktree-file-count {
  font-size: 0.75rem;
  opacity: 0.7;
}

.commit-hash {
  font-size: 0.65rem;
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* Files Grid within worktree group */
.worktree-files-grid {
  padding: 12px;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  align-content: start;
}

/* Single page group - expand file grid */
.col-12 .worktree-files-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-height: 500px;
}

.file-card-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Individual File Card */
.file-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.file-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.file-card.file-complete {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.file-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.file-card .file-icon {
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

.file-card .file-name {
  flex: 1;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card .file-status-badge {
  flex-shrink: 0;
}

.file-card .file-status-badge .badge {
  font-size: 0.6rem;
  padding: 2px 4px;
}

.file-card-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-card-progress .progress {
  flex: 1;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.file-card-progress .file-progress-bar {
  background: var(--accent);
  transition: width 0.3s ease;
}

.file-card-progress .file-progress-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}

/* File Card Action Buttons */
.file-card-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.btn-file-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.btn-file-action:hover {
  background: var(--bg-tertiary);
  transform: scale(1.05);
}

.btn-file-action.btn-accept:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.btn-file-action.btn-reject:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-file-action.btn-view:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* File Card Review States */
.file-card.file-ready-for-review {
  border-color: var(--warning);
  animation: pulse-review 2s ease-in-out infinite;
}

@keyframes pulse-review {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
}

.file-card.file-accepted {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.file-card.file-accepted .file-progress-bar {
  background: var(--success) !important;
}

.file-card.file-rejected {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  opacity: 0.6;
}

.file-card.file-rejected .file-progress-bar {
  background: var(--danger) !important;
}

/* Worktree Review Actions Panel */
.worktree-review-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.worktree-review-actions .btn {
  font-size: 0.75rem;
  padding: 4px 10px;
}

.worktree-review-actions .btn-commit-accepted {
  min-width: 100px;
}

.worktree-review-actions .accepted-count {
  font-weight: 700;
}

/* Worktree group footer with overall progress */
.worktree-group-footer {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.worktree-group-footer .progress {
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
}

.worktree-overall-progress {
  background: var(--accent);
  transition: width 0.3s ease;
}

/* Spinning animation for generating files */
.spin {
  animation: spin 1s linear infinite;
}

/* Git Tab - Branch View */
.git-branch-view h6 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
}

.git-branch-view h6 i {
  color: var(--text-secondary);
}

/* Branch List */
#gitBranchList .list-group-item {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
}

#gitBranchList .list-group-item:hover {
  background: var(--hover-bg);
}

#gitBranchList .list-group-item.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

#gitBranchList .list-group-item i.bi-robot {
  color: var(--success);
}

/* Commit List */
.commit-list {
  max-height: 300px;
  overflow-y: auto;
}

.commit-item {
  padding: 0.5rem 0;
}

.commit-item:last-child {
  border-bottom: none !important;
}

.commit-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
}

.commit-dot::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: calc(100% + 1rem);
  background: var(--border);
  transform: translateX(-50%);
}

.commit-item:last-child .commit-dot::before {
  display: none;
}

.commit-dot.agent {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.commit-dot.merge {
  background: var(--warning);
  width: 12px;
  height: 12px;
}

.commit-item code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Git Tab - Placeholder Styles */
#gitBranchPlaceholder,
#gitCommitPlaceholder {
  color: var(--text-muted);
}

#gitBranchPlaceholder i {
  opacity: 0.5;
}

/* Git Tab Toolbar */
#gitTab .border-bottom {
  border-color: var(--border) !important;
}

#gitBranchName {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

/* Spin animation for loading buttons */
.spin {
  animation: spin 1s linear infinite;
}

/* Fade in animation */
/* Git Tab Badge */
.git-worktree-badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.4rem;
  min-width: 18px;
  animation: badge-pulse 2s infinite;
}

/* Dark theme adjustments */
body[data-theme="dark"] .worktree-card {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .worktree-group-card {
  background: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .worktree-group-header {
  background: rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .file-card {
  background: var(--bg-secondary);
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .file-card:hover {
  border-color: var(--accent);
}

body[data-theme="dark"] .file-card.file-complete {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

body[data-theme="dark"] .file-card.file-ready-for-review {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

body[data-theme="dark"] .file-card.file-accepted {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.5);
}

body[data-theme="dark"] .file-card.file-rejected {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.4);
}

body[data-theme="dark"] .btn-file-action {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .btn-file-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

body[data-theme="dark"] .worktree-group-footer {
  background: rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .generation-header {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, #252525 100%);
}

body[data-theme="dark"] .commit-item code {
  background: #2a2a2a;
}

body[data-theme="dark"] #gitBranchList .list-group-item.active {
  background: #ffffff;
  color: #0a0a0a;
}

/* ============================================
   SCALABLE GENERATION STYLES
   ============================================ */

/* Scalable mode indicator badge */
#scalableModeIndicator {
  animation: scalable-badge-glow 2s ease-in-out infinite;
}

@keyframes scalable-badge-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4); }
  50% { box-shadow: 0 0 10px 2px rgba(13, 110, 253, 0.6); }
}

/* Pool worker status dots */
.pool-worker-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.pool-worker-dot.available {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

.pool-worker-dot.in-use {
  background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
  box-shadow: 0 0 4px rgba(255, 193, 7, 0.5);
  animation: worker-active-pulse 1s ease-in-out infinite;
}

.pool-worker-dot.waiting {
  background: linear-gradient(135deg, #6c757d 0%, #adb5bd 100%);
  box-shadow: 0 0 4px rgba(108, 117, 125, 0.5);
}

@keyframes worker-active-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

/* Scalable stats panel cards */
#scalableStatsPanel .card {
  transition: all 0.2s ease;
}

#scalableStatsPanel .card:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#scalableStatsPanel .card i {
  font-size: 1.2rem;
}

/* Context savings badge animation */
#contextSavingsBadge {
  animation: savings-highlight 3s ease-in-out infinite;
}

@keyframes savings-highlight {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; background-color: #198754; }
}

/* LLM queue count styles */
#llmActiveCount {
  font-weight: 700;
}

#llmQueuedCount {
  font-weight: 700;
}

/* Dark theme adjustments for scalable generation */
body[data-theme="dark"] #scalableStatsPanel .card {
  background: var(--bg-tertiary) !important;
}

body[data-theme="dark"] .pool-worker-dot.available {
  background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

body[data-theme="dark"] #scalableModeIndicator {
  background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Template Selection Cards - Welcome Screen
   ═══════════════════════════════════════════════════════════════════════════════ */

.template-welcome-container .template-bubble {
  max-width: 100%;
  width: 100%;
  padding: 1.25rem;
}

.template-welcome {
  padding: 0.5rem 0;
}

.template-welcome .welcome-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.template-welcome .welcome-header h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.template-welcome .welcome-header p {
  font-size: 14px;
  margin: 0;
  color: var(--text-muted);
}

.template-categories {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.template-category .category-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

.template-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.template-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.template-card.selected {
  border-color: var(--accent);
  background: var(--hover-bg);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

body[data-theme="dark"] .template-card.selected {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.template-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.template-card:hover .template-card-icon {
  color: var(--accent);
}

.template-card-content {
  flex: 1;
  min-width: 0;
}

.template-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.template-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .template-cards-grid {
    grid-template-columns: 1fr;
  }

  .template-card {
    padding: 0.75rem;
  }

  .template-welcome .welcome-header h4 {
    font-size: 16px;
  }
}

/* Dark mode adjustments */
body[data-theme="dark"] .template-card {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .template-card:hover {
  background: var(--hover-bg);
}

body[data-theme="dark"] .template-card-icon {
  background: var(--bg-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Brief Tab - Template Selection View
   ═══════════════════════════════════════════════════════════════════════════════ */

.brief-template-selection {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.template-selection-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.template-selection-header i {
  font-size: 2.5rem;
  color: var(--warning);
  margin-bottom: 0.75rem;
  display: block;
}

.template-selection-header h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.template-selection-header p {
  font-size: 0.875rem;
  margin: 0;
}

.template-selection-content {
  max-width: 1200px;
  margin: 0 auto;
}

/* Brief tab uses larger grid for more space */
.brief-template-selection .template-cards-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.brief-template-selection .template-card {
  padding: 1rem;
}

.brief-template-selection .template-card-icon {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.brief-template-selection .template-card-title {
  font-size: 14px;
}

.brief-template-selection .template-card-desc {
  font-size: 12px;
  -webkit-line-clamp: 3;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Brief Tab - Reference Selection View
   Show reference site options for user to choose before brief generation
   ═══════════════════════════════════════════════════════════════════════════════ */

.reference-selection {
  padding: 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.reference-selection-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.reference-selection-header i {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: block;
}

.reference-selection-header h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.reference-selection-header p {
  font-size: 0.875rem;
  margin: 0;
}

.reference-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

.reference-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.reference-card:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.reference-card.selected {
  border-color: var(--accent);
  background: var(--hover-bg);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.reference-card-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.reference-favicon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.reference-icon-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
}

.reference-card-content {
  flex: 1;
  min-width: 0;
}

/* Title link - clickable to preview site */
.reference-card-title-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  max-width: 100%;
  transition: color 0.2s ease;
}

.reference-card-title-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.reference-card-title-link .bi-box-arrow-up-right {
  font-size: 10px;
  opacity: 0.6;
  flex-shrink: 0;
}

.reference-card-title-link:hover .bi-box-arrow-up-right {
  opacity: 1;
}

/* Hostname link - also clickable */
.reference-card-hostname-link {
  display: block;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.reference-card-hostname-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.reference-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Action area with select button */
.reference-card-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Select button */
.reference-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.875rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.reference-select-btn:hover {
  background: var(--accent);
  color: white;
}

.reference-select-btn .bi-check-circle {
  font-size: 14px;
}

.reference-card.selected .reference-select-btn {
  background: var(--accent);
  color: white;
}

.reference-selection-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.reference-selection-footer p {
  font-size: 0.8125rem;
  margin: 0;
}

.reference-selection-footer .bi-info-circle {
  margin-right: 0.25rem;
}

.skip-reference-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.skip-reference-link:hover {
  text-decoration: underline;
}

/* Responsive adjustments for reference cards */
@media (max-width: 768px) {
  .reference-cards-grid {
    grid-template-columns: 1fr;
  }

  .reference-card {
    padding: 0.875rem;
  }

  .reference-card-icon {
    width: 38px;
    height: 38px;
  }

  .reference-favicon {
    width: 20px;
    height: 20px;
  }
}

/* Dark mode adjustments for reference cards */
body[data-theme="dark"] .reference-card {
  background: var(--bg-tertiary);
}

body[data-theme="dark"] .reference-card:hover {
  background: var(--hover-bg);
}

body[data-theme="dark"] .reference-card-icon {
  background: var(--bg-secondary);
}

body[data-theme="dark"] .reference-card.selected {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* Simple welcome message in chat */
.welcome-message-simple {
  padding: 0.25rem 0;
}

.welcome-message-simple p {
  margin: 0 0 0.5rem 0;
}

.welcome-message-simple p:last-child {
  margin-bottom: 0;
}

.welcome-message-simple .switch-to-brief-btn {
  vertical-align: baseline;
  padding: 0.15rem 0.5rem;
  font-size: 0.8125rem;
}

/* ============================================================
   CODE GENERATION PROGRESS UI
   Animated progress display during TYGA code generation
   (Similar pattern to project-brief-tab.css brainstorming)
   ============================================================ */

.codegen-progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 2rem;
  min-height: 400px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  flex: 1;
}

/* Orbital Animation Visual */
.codegen-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.codegen-orbital-container {
  position: relative;
  width: 160px;
  height: 160px;
  animation: codegen-orbit-pulse 3s ease-in-out infinite;
}

.codegen-orbital-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 140px;
  height: 140px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: codegen-ring-spin 20s linear infinite;
}

.codegen-orbital-ring-2 {
  width: 100px;
  height: 100px;
  border-color: rgba(118, 75, 162, 0.3);
  animation: codegen-ring-spin 15s linear infinite reverse;
}

.codegen-center-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
  animation: codegen-core-pulse 2s ease-in-out infinite;
}

.codegen-planet {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: codegen-planet-bob 3s ease-in-out infinite;
}

.codegen-planet-1 {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f093fb, #f5576c);
  animation-delay: 0s;
}

.codegen-planet-2 {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  animation-delay: 0.5s;
}

.codegen-planet-3 {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #43e97b, #38f9d7);
  animation-delay: 1s;
}

.codegen-planet-4 {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #fa709a, #fee140);
  animation-delay: 1.5s;
}

/* Phase Text with Typing Indicator */
.codegen-phase-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.codegen-typing-dots {
  display: flex;
  gap: 3px;
}

.codegen-dot {
  width: 6px;
  height: 6px;
  background: #667eea;
  border-radius: 50%;
  animation: codegen-typing-dot 1.4s ease-in-out infinite;
}

.codegen-dot:nth-child(2) { animation-delay: 0.2s; }
.codegen-dot:nth-child(3) { animation-delay: 0.4s; }

/* Progress Section */
.codegen-progress-section {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.codegen-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.codegen-progress-header h5 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.codegen-progress-header h5 i {
  color: #667eea;
  animation: codegen-gear-spin 3s linear infinite;
}

#codegenProgressPercent {
  font-weight: 600;
  color: #667eea;
}

/* Progress Bar */
.codegen-progress-bar-container {
  width: 100%;
}

.codegen-progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.codegen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2, #4facfe);
  background-size: 200% 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  position: relative;
  animation: codegen-gradient-shift 3s ease infinite;
}

.codegen-progress-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: codegen-shimmer 2s ease-in-out infinite;
}

/* Agent Chips */
.codegen-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.codegen-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.3s ease;
}

.codegen-chip i {
  font-size: 0.85rem;
}

.codegen-chip.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-color: transparent;
  animation: codegen-chip-pulse 1.5s ease-in-out infinite;
}

/* Current Action Display */
.codegen-current-action {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border-left: 3px solid #667eea;
}

.codegen-action-icon {
  color: #667eea;
  animation: codegen-icon-pulse 1.5s ease-in-out infinite;
}

.codegen-action-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex: 1;
}

.codegen-action-text.flash-update {
  animation: codegen-flash 0.5s ease;
}

/* Activity Log */
.codegen-activity-log {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 200px;
}

.codegen-activity-header {
  padding: 0.5rem 0.75rem;
  background: rgba(102, 126, 234, 0.1);
  font-size: 0.75rem;
  font-weight: 600;
  color: #667eea;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.codegen-activity-entries {
  max-height: 150px;
  overflow-y: auto;
  padding: 0.5rem;
}

.codegen-activity-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.codegen-activity-entry:last-child {
  margin-bottom: 0;
}

.codegen-entry-new {
  animation: codegen-slide-in 0.3s ease;
  background: rgba(102, 126, 234, 0.08);
}

.codegen-entry-time {
  color: var(--text-muted);
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.7rem;
  white-space: nowrap;
}

.codegen-entry-message {
  color: var(--text-secondary);
  flex: 1;
}

/* Animations */
@keyframes codegen-orbit-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes codegen-ring-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes codegen-core-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5); }
  50% { box-shadow: 0 4px 40px rgba(102, 126, 234, 0.8); }
}

@keyframes codegen-planet-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.15); }
}

@keyframes codegen-typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

@keyframes codegen-gear-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes codegen-gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes codegen-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes codegen-chip-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes codegen-icon-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes codegen-flash {
  0% { opacity: 0.5; background-color: rgba(102, 126, 234, 0.2); }
  100% { opacity: 1; background-color: transparent; }
}

@keyframes codegen-slide-in {
  0% { opacity: 0; transform: translateX(-10px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* Dark mode adjustments */
body[data-theme="dark"] .codegen-progress-container {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-primary) 100%);
}

body[data-theme="dark"] .codegen-orbital-ring {
  border-color: rgba(102, 126, 234, 0.2);
}

body[data-theme="dark"] .codegen-orbital-ring-2 {
  border-color: rgba(118, 75, 162, 0.2);
}

body[data-theme="dark"] .codegen-chip {
  border-color: var(--border);
}

body[data-theme="dark"] .codegen-activity-entry.codegen-entry-new {
  background: rgba(102, 126, 234, 0.15);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .codegen-progress-container {
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  .codegen-orbital-container {
    width: 120px;
    height: 120px;
  }

  .codegen-orbital-ring {
    width: 100px;
    height: 100px;
  }

  .codegen-orbital-ring-2 {
    width: 70px;
    height: 70px;
  }

  .codegen-center-core {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .codegen-planet {
    width: 10px;
    height: 10px;
  }

  .codegen-progress-section {
    max-width: 100%;
  }

  .codegen-agent-chips {
    gap: 0.35rem;
  }

  .codegen-chip {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
  }
}

/* ============================================================
   LIFECYCLE PROGRESS BAR & STAGE-AWARE WELCOME
   Displays project lifecycle stages with visual progress
   ============================================================ */

/* Lifecycle Progress Bar */
.lifecycle-progress {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.lifecycle-track {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  padding: 0 8px;
}

.lifecycle-track::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 24px;
  right: 24px;
  height: 2px;
  background: var(--border-color);
  z-index: 0;
}

.lifecycle-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  min-width: 48px;
}

.stage-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-dot i {
  font-size: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.lifecycle-stage.completed .stage-dot {
  background: var(--success);
  border-color: var(--success);
}

.lifecycle-stage.completed .stage-dot i {
  font-size: 8px;
  opacity: 1;
  color: white;
}

.lifecycle-stage.current .stage-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 99, 102, 241), 0.2);
  width: 16px;
  height: 16px;
}

.lifecycle-stage.current .stage-dot i {
  font-size: 9px;
  opacity: 1;
  color: white;
}

.stage-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
  font-weight: 500;
}

.lifecycle-stage.completed .stage-label {
  color: var(--success);
}

.lifecycle-stage.current .stage-label {
  color: var(--primary);
  font-weight: 600;
}

/* Stage Welcome Container */
.stage-welcome-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 0 !important;
}

.stage-welcome-container .message-content {
  padding: 0;
}

.stage-welcome-container .message-header {
  padding: 16px 16px 8px;
}

.stage-welcome-container .message-bubble {
  max-width: 100%;
  border-radius: 0;
  background: transparent;
  border: none;
  padding: 0 16px;
}

/* Stage Welcome Content */
.stage-welcome {
  padding: 16px 0;
  text-align: center;
}

.stage-welcome .stage-icon {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.stage-welcome h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.stage-welcome .subtitle {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 14px;
}

.stage-welcome .suggestions {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin: 0 auto;
  max-width: 400px;
}

.stage-welcome .suggestions strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.stage-welcome .suggestions ul {
  margin: 0;
  padding-left: 20px;
}

.stage-welcome .suggestions li {
  padding: 3px 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}

/* Quick Action Buttons Bar */
.quick-actions-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  justify-content: center;
  flex-wrap: wrap;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.quick-action-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.quick-action-btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb, 99, 102, 241), 0.3);
}

.quick-action-btn i {
  font-size: 14px;
}

/* Dark theme adjustments */
body[data-theme="dark"] .lifecycle-progress {
  background: var(--bg-secondary);
}

body[data-theme="dark"] .stage-welcome .suggestions {
  background: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .quick-actions-bar {
  background: var(--bg-secondary);
}

body[data-theme="dark"] .quick-action-btn {
  background: var(--bg-tertiary);
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .lifecycle-track {
    padding: 0 4px;
  }

  .lifecycle-stage {
    min-width: 36px;
  }

  .stage-label {
    font-size: 8px;
  }

  .stage-welcome .stage-icon {
    font-size: 36px;
  }

  .stage-welcome h3 {
    font-size: 16px;
  }

  .quick-actions-bar {
    padding: 8px 12px;
    gap: 6px;
  }

  .quick-action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ============================================
   Visual Editor: Breadcrumb + Element Tree
   ============================================ */
.element-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 0.7rem;
  font-family: monospace;
  color: var(--text-muted);
  padding: 4px 0;
}

.breadcrumb-item {
  padding: 1px 4px;
  border-radius: 2px;
  transition: color var(--transition-fast);
}

.breadcrumb-item:hover:not(.active) {
  color: var(--accent);
  background: var(--hover-bg);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.5;
  margin: 0 1px;
}

.element-tree-container {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.7rem;
  font-family: monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 0.75rem;
  background: var(--bg-tertiary);
}

.tree-node {
  line-height: 1.6;
}

.tree-label {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 0 2px;
  border-radius: 2px;
}

.tree-label:hover {
  color: var(--accent);
  background: var(--hover-bg);
}

.tree-selected > .tree-label {
  color: var(--accent);
  font-weight: 600;
  background: var(--hover-bg);
}

.property-input-modified {
  border-color: var(--warning) !important;
  background: rgba(245, 158, 11, 0.05) !important;
}

/* ============================================
   Device Preview Frames
   ============================================ */
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.preview-devices {
  display: flex;
  gap: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 2px;
}

.preview-device-btn {
  background: none;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.preview-device-btn:hover {
  color: var(--text-primary);
}

.preview-device-btn.active {
  background: var(--bg-primary);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.preview-size-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.preview-container {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  background: var(--bg-tertiary);
  padding: 1rem;
}

.preview-device-frame {
  width: 100%;
  height: 100%;
  transition: width 0.3s ease;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.preview-device-frame.mobile {
  width: 375px;
  max-width: 100%;
  border-radius: 32px;
  border: 3px solid var(--text-muted);
  box-shadow: var(--shadow-lg);
}

.preview-device-frame.mobile::before {
  content: '';
  display: block;
  width: 80px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 3px;
  margin: 8px auto;
}

.preview-device-frame.tablet {
  width: 768px;
  max-width: 100%;
  border-radius: 16px;
  border: 3px solid var(--text-muted);
  box-shadow: var(--shadow-lg);
}

.preview-device-frame iframe {
  border: none;
}

/* ============================================
   Responsive: Editor Mobile Layout
   ============================================ */
@media (max-width: 768px) {
  /* Stack panels vertically on mobile */
  .editor-panels {
    flex-direction: column;
  }

  .editor-panel-left {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    height: 45vh;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }

  .panel-resize-handle {
    display: none;
  }

  .editor-panel-right {
    min-width: 0;
    flex: 1;
  }

  /* Scrollable tab bar on mobile */
  .editor-tabs-grouped {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .editor-tabs-grouped .nav-link {
    white-space: nowrap;
    font-size: 9px;
    padding: 0.375rem 0.5rem;
  }

  .tab-divider {
    margin: 0.25rem 0.25rem;
  }

  /* Dashboard responsive grid */
  #dashboardView .container-fluid {
    padding: 1rem;
  }

  #dashboardView h2 {
    font-size: 1.35rem;
  }

  .empty-state-hero {
    padding: 3rem 1rem 2rem;
  }

  .empty-state-title {
    font-size: 1.35rem;
  }

  .empty-state-template-cards {
    gap: 0.5rem;
  }

  .empty-state-template {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
  }
}

@media (max-width: 576px) {
  /* Small mobile */
  .auth-headline {
    font-size: 1.5rem;
  }

  .auth-form-container {
    max-width: 100%;
  }

  .onboarding-card {
    padding: 1.75rem;
  }

  .onboarding-title {
    font-size: 1.15rem;
  }

  .tyga-toast-container {
    top: 0.5rem;
    right: 0.5rem;
    left: 0.5rem;
  }
}
