/* ============================================================
   CodeSense AI — Design System (Stitch MCP Generated Tokens)
   IDE-native dark theme with purple/cyan accents
   ============================================================ */

/* --- Typography: fonts loaded via HTML <link> for better performance ---
   Inter + JetBrains Mono loaded in index.html <head> */

/* --- Design Tokens (from Stitch MCP) --- */
:root {
  /* Surface colors - Dark theme */
  --surface: #10141a;
  --surface-dim: #10141a;
  --surface-bright: #353940;
  --surface-container-lowest: #0a0e14;
  --surface-container-low: #181c22;
  --surface-container: #1c2026;
  --surface-container-high: #262a31;
  --surface-container-highest: #31353c;
  --on-surface: #dfe2eb;
  --on-surface-variant: #c8c4d7;
  --outline: #928ea0;
  --outline-variant: #474554;
  --surface-tint: #c6bfff;

  /* Primary */
  --primary: #c6bfff;
  --on-primary: #2900a0;
  --primary-container: #6c5ce7;
  --on-primary-container: #faf6ff;

  /* Secondary (Cyan) */
  --secondary: #45edee;
  --on-secondary: #003737;
  --secondary-container: #00d0d1;

  /* Tertiary */
  --tertiary: #c5c0ff;
  --tertiary-container: #6d66c4;

  /* Semantic */
  --error: #ffb4ab;
  --error-container: #93000a;
  --success: #00b894;
  --warning: #fdcb6e;

  /* Raw accent colors */
  --accent-purple: #6c5ce7;
  --accent-cyan: #00d2d3;
  --accent-purple-light: #a29bfe;

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing (4px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --header-height: 52px;
  --status-bar-height: 28px;
  --sidebar-width: 48px;
}

/* --- Light Theme Override --- */
[data-theme="light"] {
  --surface: #f8f9fa;
  --surface-dim: #f0f1f3;
  --surface-bright: #ffffff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f5f6f8;
  --surface-container: #eef0f2;
  --surface-container-high: #e8eaed;
  --surface-container-highest: #dfe2e6;
  --on-surface: #1a1c20;
  --on-surface-variant: #44464f;
  --outline: #74777f;
  --outline-variant: #c4c6d0;
  --surface-tint: #5847d2;
  --primary: #5847d2;
  --on-primary: #ffffff;
  --primary-container: #e4dfff;
  --on-primary-container: #160066;
  --secondary: #006a6b;
  --on-secondary: #ffffff;
  --secondary-container: #56f9f9;
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --accent-purple: #5847d2;
  --accent-cyan: #006a6b;
  --accent-purple-light: #7c6ff0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* Smooth theme transition on all panels & surfaces */
.app-header, .panel-header, .status-bar, .chat-input-area,
.review-summary, .issue-card, .chat-message.assistant {
  transition: background var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
}

/* --- LeetCode Style Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(116, 119, 127, 0.3); /* subtle grey */
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(116, 119, 127, 0.6);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(68, 70, 79, 0.2);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(68, 70, 79, 0.4);
}

/* --- App Layout --- */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- Header --- */
.app-header {
  height: var(--header-height);
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  gap: var(--space-md);
  flex-shrink: 0;
  z-index: 100;
  animation: headerSlideDown 0.4s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes headerSlideDown {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.app-logo svg { width: 24px; height: 24px; }

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

/* --- Selects & Buttons --- */
.control-select {
  background: var(--surface-container);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23928ea0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color var(--transition-fast);
}

.control-select:hover { border-color: var(--outline); }
.control-select:focus { border-color: var(--accent-purple); box-shadow: 0 0 0 2px rgba(108,92,231,0.2); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}
.btn-primary:hover { background: #7c6ff0; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
}
.btn-secondary:hover { border-color: var(--outline); background: var(--surface-container-high); }

.btn-ghost {
  background: transparent;
  color: var(--on-surface-variant);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--surface-container-high); color: var(--on-surface); }

/* --- Theme Toggle --- */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px;
}

.theme-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-normal);
}

.theme-toggle-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent-purple);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-normal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="light"] .theme-toggle-thumb { transform: translateX(16px); }

.theme-toggle-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

/* --- Main Content Area --- */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* --- Panels --- */
.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-md);
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  flex-shrink: 0;
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--on-surface-variant);
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: var(--space-md);
}

/* --- Editor Panel (Right side now for LeetCode style) --- */
.editor-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelSlideLeft 0.5s cubic-bezier(0.22,1,0.36,1) both;
}

/* --- Resizer for Main Layout --- */
.pane-resizer {
  width: 5px;
  cursor: col-resize;
  background: var(--surface-container-high);
  border-left: 1px solid var(--outline-variant);
  border-right: 1px solid var(--outline-variant);
  z-index: 10;
  transition: background 0.2s;
}
.pane-resizer:hover, .main-content.resizing .pane-resizer {
  background: var(--primary);
  opacity: 0.5;
}

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

.monaco-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
}

#monaco-editor {
  width: 100%;
  height: 100%;
}

.char-count {
  font-size: 11px;
  color: var(--outline);
  font-family: var(--font-code);
}

/* --- Run & Save Buttons --- */
.btn-run, .btn-save {
  background: var(--success);
  color: #fff;
}
.btn-run:hover, .btn-save:hover { background: #00a884; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-run:active, .btn-save:active { transform: translateY(0); }
.btn-run:disabled, .btn-save:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* --- Stdin / Custom Input Panel --- */
.stdin-panel {
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 110px;
  min-height: 36px;
  transition: height 0.25s ease;
}
.stdin-panel.collapsed {
  height: 36px !important;
  overflow: hidden;
}
.stdin-panel.collapsed .stdin-content { display: none; }
.stdin-header { border-bottom: 1px solid var(--outline-variant); }
.stdin-content {
  flex: 1;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  padding: 8px 14px;
  overflow-y: auto;
}
.stdin-content::placeholder { color: var(--outline); }

/* --- Inline stdin bar inside output panel --- */
.stdin-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
  flex-shrink: 0;
}
.stdin-label {
  font-size: 11px;
  font-family: var(--font-code);
  font-weight: 600;
  color: var(--accent-cyan);
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.stdin-inline-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font-code);
  font-size: 12px;
  padding: 2px 0;
  caret-color: var(--accent-cyan);
}
.stdin-inline-input::placeholder { color: var(--outline); font-style: italic; }

/* ============================================================
   STDIN Section — new improved version
   ============================================================ */
.stdin-section {
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.stdin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--outline-variant);
}

.stdin-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
}

.stdin-info-tooltip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--outline);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
  transition: all var(--transition-fast);
  user-select: none;
}
.stdin-info-tooltip:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(198,191,255,0.08);
}

/* Smart warning banner */
.stdin-warn-banner {
  padding: 6px 12px;
  background: rgba(253, 203, 110, 0.1);
  border-bottom: 1px solid rgba(253, 203, 110, 0.3);
  font-size: 12px;
  color: var(--warning);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Textarea */
.stdin-textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 160px;
  background: var(--surface-container-lowest);
  border: none;
  outline: none;
  color: var(--on-surface);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.6;
  padding: 8px 12px;
  width: 100%;
  caret-color: var(--accent-cyan);
}
.stdin-textarea::placeholder {
  color: var(--outline);
  font-style: italic;
  font-size: 11px;
  line-height: 1.5;
}
.stdin-textarea:focus {
  background: var(--surface-container-low);
  box-shadow: inset 0 0 0 1px var(--accent-cyan);
}

/* --- Output / Terminal Panel --- */
.output-panel {
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-container-lowest);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 250px; /* Default height, controlled via JS for resize */
  min-height: 36px;
  animation: outputSlideUp 0.35s cubic-bezier(0.22,1,0.36,1) both;
  position: relative;
  transition: height 0.3s ease; /* For toggle collapse/expand */
}

/* Disable transition during dragging for smooth resize */
.output-panel.resizing {
  transition: none;
}

.output-resizer {
  height: 5px;
  width: 100%;
  cursor: row-resize;
  position: absolute;
  top: -2px;
  left: 0;
  z-index: 10;
  background: transparent;
}
.output-resizer:hover, .output-panel.resizing .output-resizer {
  background: var(--primary);
  opacity: 0.5;
}

/* Generic Horizontal Resizer for flex layouts */
.horizontal-resizer {
  height: 5px;
  width: 100%;
  cursor: row-resize;
  background: var(--surface-container-high);
  border-top: 1px solid var(--outline-variant);
  border-bottom: 1px solid var(--outline-variant);
  z-index: 10;
  transition: background 0.2s;
  flex-shrink: 0;
}
.horizontal-resizer:hover, .right-panel.resizing-vert .horizontal-resizer {
  background: var(--primary);
  opacity: 0.5;
}

.output-panel.collapsed {
  height: 36px !important;
  overflow: hidden;
}

.output-panel.collapsed .output-content { display: none; }

@keyframes outputSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--space-md);
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  flex-shrink: 0;
  cursor: pointer;
}

.output-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 14px 18px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
  color: #dfe2eb;
  background: #111216; /* Deep dark VS Code terminal background */
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  margin: 0;
  white-space: pre-wrap;       /* preserve \n, wrap long lines */
  word-break: break-all;      /* break long words/lines */
  min-height: 80px;
  max-height: 340px;           /* more room for output */
  tab-size: 4;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.output-placeholder {
  color: var(--outline);
  font-style: italic;
  user-select: none;
}

/* stdout — normal text color, clear line breaks */
.output-stdout {
  color: #dfe2eb;
  display: block;
  white-space: pre-wrap;
}

/* stderr — red, clearly separated */
.output-stderr {
  color: var(--error);
  display: block;
  white-space: pre-wrap;
  border-left: 2px solid var(--error);
  padding-left: 8px;
  margin-top: 4px;
  opacity: 0.9;
}

.output-exit-code {
  display: inline-block;
  margin-top: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}

.output-exit-code.success { background: rgba(0,184,148,0.15); color: var(--success); }
.output-exit-code.error { background: rgba(255,180,171,0.15); color: var(--error); }
.output-exit-code.timeout { background: rgba(253,203,110,0.15); color: var(--warning); }

/* stdin values echoed inline — shown in cyan like a real terminal */
.output-stdin-echo {
  color: #00cec9;
  font-weight: 600;
}

/* each terminal line preserves whitespace */
.terminal-line {
  display: block;
  white-space: pre-wrap;
  min-height: 1.2em;
}

/* VS Code style terminal command prompt line */
.terminal-command-line {
  margin-bottom: 12px;
  font-family: var(--font-code);
  font-size: 13px;
  line-height: 1.6;
}
.terminal-prompt-prefix {
  color: #55efc4; /* Pastel green prompt prefix */
  font-weight: 600;
}
.terminal-command-text {
  color: #ffeaa7; /* Pastel yellow command text */
  margin-left: 4px;
}

/* ============================================================
   VS Code Terminal Interactive Styles
   ============================================================ */
.terminal-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.terminal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 4px 5px 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.terminal-tab:hover {
  color: var(--on-surface);
}

.terminal-tab.active {
  color: #ffffff;
  border-bottom-color: var(--primary, #007acc);
}

.terminal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #121316;
}

.terminal-output {
  background: #121316 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 12px 16px !important;
  height: 100% !important;
  max-height: none !important;
}

.terminal-prompt {
  color: #00b894;
  font-weight: 600;
}

.terminal-cursor {
  display: inline-block;
  color: #55efc4;
  animation: terminalBlink 1s step-end infinite;
  font-weight: bold;
}

@keyframes terminalBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.terminal-input-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  margin: 2px 0;
}

.terminal-input-prompt {
  color: #dfe2eb;
  white-space: pre;
}

.terminal-inline-input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #00cec9 !important;
  font-family: var(--font-code) !important;
  font-size: 13px !important;
  line-height: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  flex: 1 !important;
  min-width: 80px !important;
  caret-color: #00cec9 !important;
}

.terminal-inline-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
  font-style: italic;
  font-size: 11px;
}



.output-status {
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--outline);
}

/* --- Right Panel (Now on the Left for LeetCode style) --- */
.right-panel {
  width: 440px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  animation: panelSlideRight 0.5s cubic-bezier(0.22,1,0.36,1) 0.1s both;
}

@keyframes panelSlideRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.review-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--outline-variant);
  min-height: 0;
}

.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* --- Review Output --- */
.review-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.review-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--outline);
  text-align: center;
  gap: var(--space-md);
}

.review-empty-icon { font-size: 48px; opacity: 0.3; }
.review-empty p { font-size: 13px; max-width: 260px; line-height: 1.6; }

/* Risk Badge */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.risk-low { background: rgba(0,184,148,0.15); color: var(--success); }
.risk-medium { background: rgba(253,203,110,0.15); color: var(--warning); }
.risk-high { background: rgba(255,180,171,0.15); color: var(--error); }
.risk-unknown { background: var(--surface-container-high); color: var(--outline); }

/* Review Summary */
.review-summary {
  padding: var(--space-md);
  background: var(--surface-container);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-purple);
  margin-bottom: var(--space-md);
}

.review-summary h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--primary);
}

.review-summary p {
  font-size: 13px;
  color: var(--on-surface-variant);
  line-height: 1.6;
}

/* Issue Card */
.issue-card {
  background: var(--surface-container);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  animation: cardSlideUp 0.35s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.issue-card:nth-child(2) { animation-delay: 0.05s; }
.issue-card:nth-child(3) { animation-delay: 0.1s; }
.issue-card:nth-child(4) { animation-delay: 0.15s; }
.issue-card:nth-child(5) { animation-delay: 0.2s; }

.issue-card:hover { border-color: var(--outline); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.issue-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.issue-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.issue-type-bug { background: rgba(255,180,171,0.15); color: var(--error); }
.issue-type-security { background: rgba(255,180,171,0.2); color: #ff6b6b; }
.issue-type-performance { background: rgba(253,203,110,0.15); color: var(--warning); }
.issue-type-style { background: rgba(198,191,255,0.15); color: var(--primary); }
.issue-type-logic { background: rgba(69,237,238,0.15); color: var(--secondary); }

.issue-severity {
  font-size: 10px;
  color: var(--outline);
  margin-left: auto;
}

.issue-line {
  font-size: 11px;
  color: var(--accent-cyan);
  font-family: var(--font-code);
}

.issue-description {
  font-size: 13px;
  color: var(--on-surface);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.issue-suggestion {
  font-size: 12px;
  color: var(--on-surface-variant);
  padding: var(--space-sm);
  background: var(--surface-container-high);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-cyan);
}

.issue-suggestion::before {
  content: '💡 ';
}

.issue-fixed-code {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Suggestions & Positives */
.review-section {
  margin-bottom: var(--space-md);
}

.review-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--on-surface-variant);
  margin-bottom: var(--space-sm);
}

.review-list {
  list-style: none;
}

.review-list li {
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-container);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  font-size: 13px;
  line-height: 1.5;
  border-left: 2px solid var(--accent-purple);
}

.review-list.positives li {
  border-left-color: var(--success);
}

/* Raw Response */
.raw-response {
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  padding: var(--space-md);
  background: var(--surface-container-lowest);
  border-radius: var(--radius-md);
  border: 1px solid var(--outline-variant);
  color: var(--on-surface-variant);
  max-height: 400px;
  overflow-y: auto;
}

/* --- Chat Interface --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.chat-message {
  max-width: 90%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.6;
  animation: msgSlideIn 0.3s ease;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  align-self: flex-end;
  background: var(--accent-purple);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--surface-container-high);
  color: var(--on-surface);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-message.assistant code {
  font-family: var(--font-code);
  font-size: 12px;
  background: var(--surface-container-lowest);
  padding: 1px 5px;
  border-radius: 3px;
}

.chat-message.assistant pre {
  background: var(--surface-container-lowest);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: var(--space-sm) 0;
  font-family: var(--font-code);
  font-size: 12px;
  line-height: 1.5;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 24px;
}

.robot-avatar-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.robot-avatar-container.waiting {
  animation: robot-float 3s ease-in-out infinite;
}

.robot-glow-ring {
  position: absolute;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
  border: 1.5px solid rgba(0, 242, 254, 0.25);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.robot-avatar-svg {
  width: 100%;
  height: 100%;
  z-index: 2;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

@keyframes robot-float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0px); }
}

.chat-empty-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.4;
  max-width: 285px;
  margin: 0 0 8px 0;
}

.chat-empty-subtitle {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: 0.65;
  margin: 0;
}

.chat-decorator-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px 16px;
  background: var(--surface-container-low);
  border-top: 1px solid var(--outline-variant);
  flex-shrink: 0;
}

.decorator-dots {
  display: flex;
  gap: 5px;
}

.decorator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.decorator-dot.d-red { background: #ff4757; opacity: 0.7; }
.decorator-dot.d-yellow { background: #ffa502; opacity: 0.7; }
.decorator-dot.d-gray { background: rgba(255, 255, 255, 0.2); }

.decorator-star {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

/* --- Chat Quick Suggestions --- */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 12px 16px;
  background: var(--surface-container-low);
  flex-shrink: 0;
}

.suggestion-chip {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--on-surface-variant);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-surface);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* --- Typing Indicator --- */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  flex-shrink: 0;
}
.chat-typing[hidden],
#chat-typing[hidden] {
  display: none !important;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(1) { background: #ff4757; }
.typing-dot:nth-child(2) { background: #ffa502; animation-delay: 0.2s; }
.typing-dot:nth-child(3) { background: #ffffff; animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* --- Panel Header Actions --- */
.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-ui);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.panel-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--on-surface);
  border-color: rgba(255, 255, 255, 0.25);
}

/* --- AI Action Bar (Above 3-Color Dots) --- */
.chat-ai-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: var(--surface-container-low);
  border-top: 1px solid var(--outline-variant);
  flex-shrink: 0;
}

.chat-ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.28);
  border-radius: 20px;
  padding: 4px 12px 4px 7px;
  cursor: pointer;
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-ui);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-ai-action-btn:hover {
  background: rgba(0, 242, 254, 0.18);
  border-color: #00f2fe;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.35);
  transform: translateY(-1px);
}

.chat-ai-action-btn:active {
  transform: scale(0.97);
}

.ai-btn-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-btn-logo-svg {
  width: 17px;
  height: 17px;
  filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.7));
}

.chat-history-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-ui);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-history-pill-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.chat-history-badge {
  background: var(--accent-purple, #a855f7);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  padding: 0 5px;
  min-width: 15px;
  text-align: center;
  line-height: 15px;
}

/* --- Old Chats History Overlay --- */
.chat-history-overlay {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(14, 18, 24, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  animation: fadeInHistory 0.2s ease-out;
}

.chat-history-overlay[hidden] {
  display: none !important;
}

@keyframes fadeInHistory {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  flex-shrink: 0;
}

.history-overlay-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--on-surface);
}

.history-overlay-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-quick-new-btn {
  background: rgba(0, 242, 254, 0.10);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: #00f2fe;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-quick-new-btn:hover {
  background: rgba(0, 242, 254, 0.22);
  border-color: #00f2fe;
}

.history-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.history-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}

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

.history-chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 10px;
}

.history-chat-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 242, 254, 0.3);
  transform: translateX(2px);
}

.history-chat-item.active {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
}

.history-chat-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-chat-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-chat-meta {
  font-size: 10px;
  color: var(--on-surface-variant);
  opacity: 0.7;
  display: flex;
  gap: 6px;
}

.history-delete-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.history-delete-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  transform: scale(1.1);
}

/* --- YouTube Video Recommendations & Links --- */
.chat-link {
  color: var(--accent-cyan) !important;
  text-decoration: underline;
  font-weight: 600;
  transition: color var(--transition-fast);
}
.chat-link:hover {
  color: var(--secondary) !important;
}

.youtube-results-container {
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.youtube-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.youtube-loading .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: youtube-spin 0.8s linear infinite;
}

@keyframes youtube-spin {
  to { transform: rotate(360deg); }
}

.youtube-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.youtube-videos-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.youtube-video-card {
  display: flex;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 6px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.youtube-video-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(198, 191, 255, 0.2);
  transform: translateY(-1px);
}

.youtube-thumbnail-wrapper {
  position: relative;
  width: 100px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}

.youtube-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.youtube-duration {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 10px;
  padding: 1px 3px;
  border-radius: 2px;
  font-weight: 500;
}

.youtube-video-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.youtube-video-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.youtube-channel-name {
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: 0.8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-meta-text {
  font-size: 10px;
  color: var(--on-surface-variant);
  opacity: 0.6;
  display: flex;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-no-results,
.youtube-error {
  font-size: 12px;
  color: var(--on-surface-variant);
  opacity: 0.8;
  padding: 4px 0;
}

.chat-input-area {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
}

.chat-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(108,92,231,0.2);
}

.chat-input::placeholder { color: var(--outline); }

.chat-send-btn {
  padding: 8px 12px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.chat-send-btn:hover { background: #7c6ff0; }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Loading States --- */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--outline-variant);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  color: var(--on-surface-variant);
  font-size: 13px;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* --- Status Bar --- */
.status-bar {
  height: var(--status-bar-height);
  background: var(--surface-container-low);
  border-top: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  padding: 0 var(--space-md);
  font-size: 11px;
  color: var(--outline);
  gap: var(--space-md);
  flex-shrink: 0;
}

.status-bar.active {
  background: var(--accent-purple);
  color: #fff;
}

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

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.disconnected { background: var(--error); }
.status-dot.loading { background: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-container-highest); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline-variant); }

/* --- Responsive --- */
@media (max-width: 900px) {
  .main-content { flex-direction: column; }
  .editor-panel { border-right: none; border-bottom: 1px solid var(--outline-variant); min-height: 300px; }
  .right-panel { width: 100%; height: auto; flex: 1; }
  .chat-panel { height: 220px; }
}

@media (max-width: 600px) {
  .app-header { padding: 0 var(--space-sm); gap: var(--space-sm); }
  .app-logo span { display: none; }
  .header-controls { gap: 4px; }
  .control-select { font-size: 11px; padding: 4px 22px 4px 6px; }
}

/* --- Utility --- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Premium splash screen --- */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  color: #f6f8ff;
  background:
    radial-gradient(circle at 50% 35%, rgba(79, 136, 255, 0.32), transparent 34%),
    linear-gradient(135deg, #050b18 0%, #0d1f48 46%, #07101f 100%);
  transition: opacity 520ms ease, visibility 520ms ease;
}

.splash-screen::before,
.splash-screen::after {
  content: '';
  position: absolute;
  inset: -20%;
  pointer-events: none;
  filter: blur(42px);
  opacity: 0.68;
}

.splash-screen::before {
  background:
    linear-gradient(120deg, rgba(55, 120, 255, 0.16), transparent 34%),
    linear-gradient(300deg, transparent 58%, rgba(69, 237, 238, 0.16));
  animation: splashDrift 5s ease-in-out infinite alternate;
}

.splash-screen::after {
  background:
    linear-gradient(30deg, transparent 18%, rgba(198, 191, 255, 0.13), transparent 58%),
    linear-gradient(210deg, rgba(20, 86, 220, 0.18), transparent 44%);
  animation: splashDrift 6s ease-in-out infinite alternate-reverse;
}

.splash-background {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
  opacity: 0.42;
}

.splash-logo {
  position: relative;
  width: 96px;
  height: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(198, 191, 255, 0.34);
  border-radius: 22px;
  color: #c6bfff;
  background: rgba(11, 19, 36, 0.5);
  box-shadow: 0 0 38px rgba(86, 138, 255, 0.42), inset 0 1px 0 rgba(255,255,255,0.14);
  backdrop-filter: blur(18px);
  animation: splashLogoIn 900ms cubic-bezier(0.22,1,0.36,1) both, splashPulse 1800ms ease-in-out 900ms infinite;
}

.splash-logo svg {
  width: 54px;
  height: 54px;
}

.splash-copy {
  position: relative;
  text-align: center;
  animation: splashTextIn 900ms cubic-bezier(0.22,1,0.36,1) 180ms both;
}

.splash-copy h1 {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

.splash-copy p {
  margin-top: 8px;
  color: rgba(246, 248, 255, 0.76);
  font-size: 14px;
  font-weight: 600;
}

.splash-complete .splash-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.is-splashing .app-container {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.app-container {
  transition: opacity 420ms ease, transform 420ms ease;
}

@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashPulse {
  0%, 100% { box-shadow: 0 0 38px rgba(86, 138, 255, 0.42), inset 0 1px 0 rgba(255,255,255,0.14); }
  50% { box-shadow: 0 0 58px rgba(69, 237, 238, 0.48), inset 0 1px 0 rgba(255,255,255,0.18); }
}

@keyframes splashDrift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to { transform: translate3d(1.5%, 1%, 0) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen,
  .splash-screen::before,
  .splash-screen::after,
  .splash-logo,
  .splash-copy,
  .app-container {
    animation: none;
    transition-duration: 1ms;
  }
}

/* --- Smooth Review Section Entrance --- */
.review-summary {
  animation: cardSlideUp 0.3s cubic-bezier(0.22,1,0.36,1) both;
}
.review-section {
  animation: cardSlideUp 0.35s cubic-bezier(0.22,1,0.36,1) 0.08s both;
}
.review-list li {
  animation: cardSlideUp 0.3s cubic-bezier(0.22,1,0.36,1) both;
}
.review-list li:nth-child(2) { animation-delay: 0.04s; }
.review-list li:nth-child(3) { animation-delay: 0.08s; }
.review-list li:nth-child(4) { animation-delay: 0.12s; }

/* Status bar entrance */
.status-bar {
  animation: headerSlideDown 0.4s cubic-bezier(0.22,1,0.36,1) 0.2s both;
  transition: background var(--transition-normal), color var(--transition-normal);
}

/* --- Professional app shell and authentication --- */
.app-header {
  min-height: var(--header-height);
  height: auto;
  padding: 10px 18px;
  background: rgba(24, 28, 34, 0.96);
  backdrop-filter: blur(16px);
}

[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.94);
}

.app-logo {
  font-size: 18px;
  letter-spacing: 0;
}

.app-logo svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.header-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  color: var(--on-surface-variant);
  background: var(--surface-container);
  font-size: 11px;
  font-weight: 700;
}

.header-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn svg,
.icon-button svg,
.chat-send-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface-variant);
  background: var(--surface-container);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.icon-button:hover {
  color: var(--on-surface);
  border-color: var(--outline);
  background: var(--surface-container-high);
  transform: translateY(-1px);
}

.icon-button.compact {
  width: 30px;
  height: 30px;
}

[data-theme="dark"] .theme-icon-light,
[data-theme="light"] .theme-icon-dark {
  display: none;
}

.account-menu {
  display: flex;
  align-items: center;
  position: relative;
}

.save-btn-wrapper {
  position: relative;
  display: inline-block;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px 3px 6px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  background: var(--surface-container);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.user-chip:hover {
  background: var(--surface-container-high);
  border-color: var(--outline);
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  width: 290px;
  margin-top: 8px;
  background: rgba(16, 20, 26, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(255, 255, 255, 0.05);
  z-index: 1000;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  
  /* Opening/closing transitions */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#profile-dropdown[hidden],
#dropdown-backdrop[hidden] {
  display: none !important;
}

#profile-dropdown.open {
  display: flex !important;
}

/* --- Save Workspace Popover --- */
.save-popover {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  width: 260px;
  margin-top: 8px;
  background: rgba(16, 20, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(255, 255, 255, 0.05);
  z-index: 1000;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  /* Transitions for smooth slide-down + fade-in */
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.save-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--on-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.popover-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popover-body label {
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: 0.8;
  display: block;
  margin-bottom: 4px;
}

.popover-body input,
.popover-body textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  font-size: 12px;
  padding: 6px 10px;
  transition: border-color var(--transition-fast);
}

.popover-body input:focus,
.popover-body textarea:focus {
  border-color: var(--primary);
  outline: none;
}

/* --- Active File Badge next to Title --- */
.active-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(108, 92, 231, 0.12);
  border: 1px solid rgba(108, 92, 231, 0.22);
  color: #a29bfe;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-left: 10px;
  vertical-align: middle;
  transition: all 0.2s ease;
}

.active-file-badge svg {
  opacity: 0.8;
  stroke: #a29bfe;
}

/* --- Active File Details in Dropdown --- */
.active-file-info {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.info-label {
  color: var(--on-surface-variant);
  opacity: 0.65;
}

.info-value {
  color: var(--on-surface);
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-file-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.active-file-actions .btn {
  font-size: 11px;
  padding: 4px 8px;
  height: auto;
}

.dropdown-profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.dropdown-user-info {
  flex: 1;
  min-width: 0;
}

.dropdown-username {
  font-size: 13px;
  font-weight: 700;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-email {
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-action-btn {
  color: #ff4757;
  transition: all var(--transition-fast);
}
.logout-action-btn:hover {
  background: rgba(255, 71, 87, 0.1) !important;
  color: #ff6b81 !important;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

.dropdown-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dropdown-section-title {
  font-size: 10px;
  font-weight: 850;
  color: var(--on-surface-variant);
  opacity: 0.7;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-current-action {
  display: flex;
  gap: 6px;
}

.save-current-action input {
  flex: 1;
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font-ui);
}

.save-current-action input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  min-height: auto;
}

.saved-files-list,
.chat-sessions-list {
  max-height: 120px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
}

.saved-files-list::-webkit-scrollbar,
.chat-sessions-list::-webkit-scrollbar {
  width: 4px;
}
.saved-files-list::-webkit-scrollbar-thumb,
.chat-sessions-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.empty-list-msg {
  font-size: 11px;
  color: var(--on-surface-variant);
  opacity: 0.5;
  text-align: center;
  padding: 8px 0;
  font-style: italic;
}

.workspace-item,
.chat-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.workspace-item:hover,
.chat-history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.05);
}

.workspace-item-content,
.chat-history-item-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.workspace-item-title,
.chat-history-item-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-item-lang {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 2px;
  color: var(--on-surface-variant);
  opacity: 0.8;
  font-family: var(--font-code);
  text-transform: uppercase;
  margin-left: auto;
}

.add-workspace-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--outline-variant);
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: auto;
  padding: 0;
}

.add-workspace-btn:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
  transform: scale(1.08);
}

.item-delete-btn {
  background: transparent;
  border: none;
  color: var(--on-surface-variant);
  opacity: 0.5;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
  margin-left: 6px;
}

.item-delete-btn:hover {
  opacity: 1;
  color: #ff4757;
  background: rgba(255, 71, 87, 0.1);
}

.dropdown-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.dropdown-logout-link {
  background: transparent;
  border: none;
  color: var(--on-surface-variant);
  opacity: 0.6;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.dropdown-logout-link:hover {
  opacity: 1;
  color: #ff4757;
  background: rgba(255, 71, 87, 0.08);
}

.user-avatar {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--on-primary);
  font-size: 10px;
  font-weight: 800;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--on-surface);
  font-size: 12px;
  font-weight: 700;
}

.panel {
  background: var(--surface-container-lowest);
}

.panel-header {
  min-height: 42px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.review-empty-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  color: var(--primary);
  background: var(--surface-container);
}

.review-empty-icon svg {
  width: 30px;
  height: 30px;
}

.chat-empty-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline-variant);
  border-radius: 50%;
  color: var(--primary);
  font-weight: 800;
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  justify-content: center;
}

.status-version {
  margin-left: auto;
}

.auth-status {
  color: var(--on-surface-variant);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 14, 0.72);
  backdrop-filter: blur(12px);
}

.modal-backdrop[hidden] {
  display: none;
}

.login-modal {
  width: min(440px, 100%);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  background: var(--surface-container-low);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-brand {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--outline-variant);
}

.login-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  color: var(--primary);
  background: var(--surface-container);
}

.login-mark svg {
  width: 28px;
  height: 28px;
}

.login-kicker {
  color: var(--secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-brand h1 {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 22px;
}

.field-label {
  color: var(--on-surface-variant);
  font-size: 12px;
  font-weight: 700;
}

.form-input {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface);
  background: var(--surface-container-lowest);
  font: 500 14px var(--font-ui);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(198, 191, 255, 0.18);
}

.login-submit {
  justify-content: center;
  margin-top: 8px;
  height: 42px;
}

.login-error {
  min-height: 18px;
  color: var(--error);
  font-size: 12px;
  font-weight: 600;
}

/* Login tagline */
.login-tagline {
  padding: 10px 22px 6px;
  font-size: 12.5px;
  color: var(--on-surface-variant);
  line-height: 1.5;
}

/* ── Auth tabs ────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-container);
}

.auth-tab {
  flex: 1;
  padding: 11px 0;
  font: 600 13px var(--font-ui);
  color: var(--outline);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
}
.auth-tab:hover { color: var(--on-surface); }
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--surface-container-low);
}

/* ── Auth panels ─────────────────────────── */
.auth-panel { padding: 4px 0 0; }
.auth-panel[hidden] { display: none; }

/* Field-level inline errors */
.field-error {
  font-size: 11px;
  font-weight: 600;
  color: var(--error);
  min-height: 14px;
  line-height: 1.4;
}

/* Sub-label hint (e.g. "not your Gmail password") */
.field-label-sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--outline);
  margin-left: 4px;
}

/* Password strength bar */
.pwd-strength-bar {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.pwd-strength-bar span {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--outline-variant);
  transition: background 0.3s;
}
.pwd-strength-bar.s1 span:nth-child(1) { background: var(--error); }
.pwd-strength-bar.s2 span:nth-child(-n+2) { background: #fdcb6e; }
.pwd-strength-bar.s3 span:nth-child(-n+3) { background: #74b9ff; }
.pwd-strength-bar.s4 span { background: var(--success, #00b894); }

/* Inline link button (for "Create account →" inside hint) */
.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font: 600 12px var(--font-ui);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { opacity: 0.8; }

/* Field group wrapper */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Password wrapper with eye toggle */
.password-wrapper {
  position: relative;
}
.password-wrapper .form-input {
  padding-right: 40px;
}
.pwd-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--outline);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.pwd-toggle:hover { color: var(--on-surface); }
.pwd-toggle svg { width: 16px; height: 16px; }

/* Hint text */
.login-hint {
  font-size: 11px;
  color: var(--outline);
  text-align: center;
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .header-meta {
    display: none;
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
  }

  .header-controls {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .control-select {
    flex: 1 1 130px;
  }

  .btn span {
    display: none;
  }

  .user-name {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-logo span {
    display: inline;
  }

  .right-panel {
    min-width: 0;
  }

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

/* ==========================================================================
   PROBLEM LIST (DSA PATTERN PLAYBOOK) STYLES
   ========================================================================== */

/* Header Toolbar Bar (Image 2 style) */
.problem-list-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 3px 8px;
  transition: all 0.2s ease;
}

.problem-list-nav-bar:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
}

.problem-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  padding: 2px 4px;
}

.problem-list-icon {
  color: #00f2fe;
}

.problem-list-text {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.problem-list-quick-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 6px;
  margin-left: 2px;
}

.nav-arrow-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.nav-arrow-btn:hover {
  color: #00f2fe;
  background: rgba(255, 255, 255, 0.1);
}

/* Problem List Modal Container */
.problem-list-modal-container {
  width: 92%;
  max-width: 1040px;
  max-height: 88vh;
  background: #0f141c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.pl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  background: #141a24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 12px;
}

.pl-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pl-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00f2fe;
}

.pl-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.5px;
}

.pl-modal-subtitle {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  margin: 2px 0 0 0;
}

.pl-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pl-topic-nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pl-topic-dropdown {
  background: #1a2230;
  color: #00f2fe;
  font-weight: 600;
  font-size: 12.5px;
  border-color: rgba(0, 242, 254, 0.3);
  border-radius: 6px;
  padding: 5px 10px;
}

.pl-nav-btn {
  font-size: 11.5px;
  padding: 4px 10px;
}

/* Filter Bar */
.pl-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: #111722;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 16px;
  flex-wrap: wrap;
}

.pl-search-wrapper {
  position: relative;
  flex: 1 1 240px;
}

.pl-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
}

.pl-search-input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  background: #1a2230;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 12.5px;
  outline: none;
  transition: all 0.2s ease;
}

.pl-search-input:focus {
  border-color: #00f2fe;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

.pl-difficulty-filters {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pl-filter-label {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 4px;
}

.pl-diff-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pl-diff-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.pl-diff-chip.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: #00f2fe;
  color: #00f2fe;
}

.pl-diff-chip.diff-easy.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #4ade80;
}

.pl-diff-chip.diff-medium.active {
  background: rgba(234, 179, 8, 0.15);
  border-color: #eab308;
  color: #fde047;
}

.pl-diff-chip.diff-hard.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

/* Topic Banner */
.pl-topic-banner {
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(16, 22, 34, 0.9), rgba(24, 32, 48, 0.9));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pl-topic-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.pl-topic-badge {
  background: rgba(168, 85, 247, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.pl-topic-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
}

.pl-topic-concept {
  font-size: 13px;
  color: #cbd5e1;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.pl-takeaways-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
}

.pl-takeaways-heading {
  font-size: 11.5px;
  color: #00f2fe;
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}

.pl-takeaways-box ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #94a3b8;
}

.pl-takeaways-box li {
  margin-bottom: 2px;
}

/* Questions Table */
.pl-table-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.pl-table th {
  position: sticky;
  top: 0;
  background: #141b26;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.pl-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  vertical-align: middle;
}

.pl-table tbody tr {
  transition: background 0.15s ease;
}

.pl-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.pl-cell-num {
  font-family: var(--font-code);
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.pl-problem-link {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}

.pl-problem-link:hover {
  color: #00f2fe;
  text-decoration: underline;
}

.pl-lc-tag {
  background: rgba(255, 161, 22, 0.12);
  border: 1px solid rgba(255, 161, 22, 0.3);
  color: #ffa116;
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.pl-diff-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.diff-badge-easy {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.diff-badge-medium {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.diff-badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pl-cell-pattern {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.pl-cell-action {
  text-align: center;
}

.btn-leetcode-practice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 161, 22, 0.15), rgba(255, 161, 22, 0.25));
  border: 1px solid rgba(255, 161, 22, 0.5);
  color: #ffa116;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-leetcode-practice:hover {
  background: #ffa116;
  color: #000000;
  box-shadow: 0 0 12px rgba(255, 161, 22, 0.4);
  transform: translateY(-1px);
}

.pl-no-results {
  text-align: center;
  padding: 40px !important;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

