/* ===================================
   IDE THEME - VS CODE INSPIRED
   =================================== */
:root {
  /* Editor Colors - Dark Theme */
  --bg-base: #1e1e1e;
  --bg-surface: #252526;
  --bg-elevated: #2d2d2d;
  --bg-hover: #3c3c3c;
  --bg-active: #094771;

  /* Borders */
  --border-color: #3c3c3c;
  --border-active: #007acc;

  /* Text Colors */
  --text-primary: #cccccc;
  --text-secondary: #8b8b8b;
  --text-muted: #6a6a6a;
  --text-bright: #ffffff;

  /* Syntax Highlighting */
  --syntax-keyword: #569cd6;
  --syntax-string: #ce9178;
  --syntax-number: #b5cea8;
  --syntax-comment: #6a9955;
  --syntax-function: #dcdcaa;
  --syntax-variable: #9cdcfe;
  --syntax-type: #4ec9b0;
  --syntax-property: #9cdcfe;
  --syntax-tag: #569cd6;
  --syntax-attribute: #9cdcfe;
  --syntax-jsx-text: #d4d4d4;

  /* Markdown */
  --md-heading: #569cd6;
  --md-link: #3794ff;
  --md-code: #ce9178;
  --md-list: #6a9955;

  /* UI Colors */
  --accent-blue: #007acc;
  --accent-green: #89d185;
  --accent-yellow: #cca700;
  --accent-red: #f14c4c;
  --accent-orange: #ce9178;

  /* Activity Bar */
  --activity-bg: #333333;
  --activity-icon: #858585;
  --activity-icon-active: #ffffff;

  /* Sidebar */
  --sidebar-bg: #252526;
  --sidebar-width: 240px;

  /* Tabs */
  --tab-bg: #2d2d2d;
  --tab-active-bg: #1e1e1e;
  --tab-border: #252526;

  /* Status Bar */
  --statusbar-bg: #007acc;
  --statusbar-text: #ffffff;

  /* Fonts */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Sizes */
  --titlebar-height: 30px;
  --tabs-height: 35px;
  --statusbar-height: 22px;
  --activity-width: 48px;
  --line-height: 22px;
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 13px;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ===================================
   IDE CONTAINER
   =================================== */
.ide-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-base);
  overflow: hidden;
  /* Safe area for notched phones */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ===================================
   TITLE BAR
   =================================== */
.titlebar {
  display: flex;
  justify-content: center;
  align-items: center;
  height: var(--titlebar-height);
  background: var(--bg-elevated);
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
}

.titlebar-drag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.titlebar-icon {
  font-size: 16px;
}

/* ===================================
   IDE MAIN LAYOUT
   =================================== */
.ide-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===================================
   ACTIVITY BAR
   =================================== */
.activity-bar {
  width: var(--activity-width);
  background: var(--activity-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border-right: 1px solid var(--border-color);
}

.activity-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  color: var(--activity-icon);
  transition: color 0.15s;
}

.activity-btn svg {
  width: 24px;
  height: 24px;
}

.activity-btn:hover { color: var(--text-primary); }
.activity-btn.active { color: var(--activity-icon-active); }
.activity-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-blue);
}

.activity-spacer { flex: 1; }

/* ===================================
   SIDEBAR
   =================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 10px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 10px;
}

.tree-section {
  user-select: none;
}

.tree-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
}

.tree-arrow {
  font-size: 10px;
  transition: transform 0.15s;
}

.tree-header:not(.open) .tree-arrow { transform: rotate(-90deg); }
.tree-header:not(.open) + .tree-content { display: none; }

.tree-content {
  padding-left: 12px;
}

.tree-file {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 16px;
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}

.tree-file:hover { background: var(--bg-hover); }
.tree-file.active { background: var(--bg-active); }

.file-icon {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 1px 3px;
  border-radius: 2px;
}

.file-icon.tsx { color: #519aba; }
.file-icon.ts { color: #3178c6; }
.file-icon.json { color: #cbcb41; }
.file-icon.md { color: #519aba; }

/* ===================================
   EDITOR AREA
   =================================== */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  overflow: hidden;
}

/* TABS */
.tabs-bar {
  display: flex;
  background: var(--tab-bg);
  border-bottom: 1px solid var(--border-color);
  height: var(--tabs-height);
  overflow-x: auto;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 100%;
  background: var(--tab-bg);
  border: none;
  border-right: 1px solid var(--tab-border);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}

.tab:hover { background: var(--bg-hover); }
.tab.active {
  background: var(--tab-active-bg);
  color: var(--text-bright);
  border-top: 1px solid var(--accent-blue);
  margin-top: -1px;
}

.tab-icon {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.tab-icon.tsx { color: #519aba; }
.tab-icon.ts { color: #3178c6; }
.tab-icon.json { color: #cbcb41; }
.tab-icon.md { color: #519aba; }

.tab-close {
  margin-left: 4px;
  opacity: 0;
  font-size: 14px;
  line-height: 1;
  transition: opacity 0.1s;
}

.tab:hover .tab-close { opacity: 0.6; }
.tab-close:hover { opacity: 1; }

/* ===================================
   EDITOR SCROLL & PANELS
   =================================== */
.editor-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.editor-panel {
  display: none;
  min-height: 100%;
}

.editor-panel.active {
  display: block;
}

.code-container {
  padding: 10px 0 0 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: var(--line-height);
}

/* ===================================
   CODE LINES
   =================================== */
.line {
  display: flex;
  min-height: var(--line-height);
  padding-right: 16px;
}

.line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.line.highlight {
  background: rgba(255, 255, 0, 0.05);
  border-left: 2px solid var(--accent-yellow);
}

.line-number {
  display: inline-block;
  width: 50px;
  padding: 0 16px 0 0;
  text-align: right;
  color: #5a5a5a;
  user-select: none;
  flex-shrink: 0;
  background: var(--bg-base);
}

.code {
  flex: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  padding-left: 8px;
}

/* ===================================
   SYNTAX HIGHLIGHTING
   =================================== */
.keyword { color: var(--syntax-keyword); }
.string { color: var(--syntax-string); }
.number { color: var(--syntax-number); }
.comment { color: var(--syntax-comment); font-style: italic; }
.function { color: var(--syntax-function); }
.variable { color: var(--syntax-variable); }
.type { color: var(--syntax-type); }
.property { color: var(--syntax-property); }
.tag { color: var(--syntax-tag); }
.attribute { color: var(--syntax-attribute); }
.jsx-text { color: var(--syntax-jsx-text); }

/* Markdown Syntax */
.md-h1 { color: var(--md-heading); font-weight: 700; font-size: 2.5em; }
.md-h2 { color: var(--md-heading); font-weight: 600; font-size: 1.2em; }
.md-text { color: var(--text-primary); }
.md-link { color: var(--md-link); text-decoration: underline; }
.md-code { color: var(--md-code); background: rgba(255,255,255,0.05); padding: 2px 6px; border-radius: 3px; }
.md-list { color: var(--md-list); }
.md-hr { color: var(--text-muted); }
.md-italic { font-style: italic; color: var(--text-secondary); }
.md-bold { color: #4ec9b0; font-weight: 600; }
.md-strike { color: var(--text-muted); text-decoration: line-through; opacity: 0.7; }
/* Dialog - subtle but distinct */
.dev-a { color: #d4d4d4; } /* Bright - skeptik */
.dev-b { color: #848a94; } /* Dimmed - 10x dev */

/* List marker for preview mode */
.md-list-marker { color: var(--md-list); margin-right: 8px; }

/* ===================================
   ASCII ART & FLOW DIAGRAMS
   =================================== */

/* ===================================
   FLOW DIAGRAM
   =================================== */
.flow-diagram {
  padding: 2em;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1em;
  max-width: 650px;
  margin: 0 auto;
}

.flow-section {
  margin-bottom: 0.3em;
}

.section-label {
  text-align: center;
  color: #606060;
  font-size: 0.9em;
  letter-spacing: 3px;
  margin-bottom: 0.8em;
  text-transform: uppercase;
}

.section-label.cyan-label {
  color: #4ec9b0;
  font-size: 1em;
  font-weight: 500;
  text-shadow: 0 0 20px rgba(78, 201, 176, 0.3);
}

.flow-row {
  display: flex;
  justify-content: center;
  gap: 1em;
}

.flow-connector {
  text-align: center;
  color: #4ec9b0;
  font-size: 0.9em;
  line-height: 1.4;
  padding: 0.3em 0;
  opacity: 0.6;
}

.flow-box {
  border: 1px solid;
  padding: 0.6em 1.2em;
  min-width: 100px;
  text-align: center;
  transition: all 0.2s ease;
}

.flow-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.flow-box.small {
  min-width: 80px;
  padding: 0.5em 0.8em;
}

/* Color variants */
.flow-box.purple {
  border-color: #c586c0;
  background: rgba(197, 134, 192, 0.08);
}
.flow-box.purple .box-title { color: #c586c0; }

.flow-box.yellow {
  border-color: #dcdcaa;
  background: rgba(220, 220, 170, 0.08);
}
.flow-box.yellow .box-title { color: #dcdcaa; }

.flow-box.cyan {
  border-color: #4ec9b0;
  background: rgba(78, 201, 176, 0.08);
}
.flow-box.cyan .box-title { color: #4ec9b0; }

.flow-box.orange {
  border-color: #ce9178;
  background: rgba(206, 145, 120, 0.08);
}
.flow-box.orange .box-title { color: #ce9178; }

.flow-box.green {
  border-color: #6a9955;
  background: rgba(106, 153, 85, 0.08);
}
.flow-box.green .box-title { color: #b5cea8; }

.box-title {
  font-size: 1em;
  letter-spacing: 0.5px;
}

.box-items {
  color: #606060;
  font-size: 0.85em;
  margin-top: 0.4em;
}

/* Agent section - main container */
.agent-section {
  border: 1px solid #4ec9b0;
  padding: 1.2em 1.5em;
  background: rgba(78, 201, 176, 0.04);
  box-shadow: 0 0 30px rgba(78, 201, 176, 0.1);
}

.agent-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
}

.agent-col {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  flex: 1;
}

.agent-col.center-col {
  flex: 1.2;
  align-items: center;
}

.agent-col.center-col .flow-box {
  width: 100%;
}

/* Terminal-style prompts */
.terminal-prompt {
  color: #4ec9b0;
  font-family: 'JetBrains Mono', monospace;
}

.terminal-output {
  color: #808080;
}

.terminal-response {
  color: #dcdcaa;
  animation: blink-cursor 1s infinite;
}

/* Progress bar styles */
.progress-done {
  color: #4ec9b0;
  letter-spacing: 2px;
}

.progress-partial {
  color: #dcdcaa;
  letter-spacing: 2px;
}

.progress-empty {
  color: #3c3c3c;
  letter-spacing: 2px;
}

.step-label {
  color: #9cdcfe;
  margin-left: 8px;
}

/* LinkedIn link */
.linkedin-link a {
  color: #569cd6;
  text-decoration: none;
  font-weight: 500;
  padding: 0.3em 0.6em;
  border: 1px solid #569cd6;
  background: rgba(86, 156, 214, 0.1);
  transition: all 0.2s ease;
}

.linkedin-link a:hover {
  background: rgba(86, 156, 214, 0.25);
  box-shadow: 0 0 15px rgba(86, 156, 214, 0.3);
}

/* Inline link (within text) */
.inline-link {
  color: #569cd6;
  text-decoration: none;
  border-bottom: 1px dashed #569cd6;
  transition: all 0.2s ease;
}

.inline-link:hover {
  color: #7ecbff;
  border-bottom-color: #7ecbff;
}

/* Call to action text */
.cta-text {
  color: #4ec9b0;
  font-weight: 500;
  font-size: 1.1em;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 5px rgba(78, 201, 176, 0.3); }
  50% { text-shadow: 0 0 20px rgba(78, 201, 176, 0.6); }
}

@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ===================================
   TYPING ANIMATION
   =================================== */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background: var(--text-primary);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: none;
}

.typing-cursor.blink {
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ===================================
   STATUS BAR
   =================================== */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--statusbar-height);
  background: var(--statusbar-bg);
  padding: 0 10px;
  font-size: 12px;
  color: var(--statusbar-text);
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.status-item.branch {
  padding: 0 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

/* ===================================
   MOBILE RESPONSIVE
   =================================== */

/* Tablets */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .ide-container {
    margin: 0;
    border-radius: 0;
  }

  .code-container {
    font-size: 13px;
  }
}

/* Mobile phones */
@media (max-width: 600px) {
  :root {
    --line-height: 26px;
    --tabs-height: 44px;
  }

  html {
    font-size: 14px;
  }

  .activity-bar {
    display: none;
  }

  /* Tabs - horizontal scrollable */
  .tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 4px;
  }

  .tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .tab {
    padding: 0 12px;
    font-size: 13px;
    min-width: auto;
    flex-shrink: 0;
    height: 44px;
  }

  .tab-icon {
    display: none;
  }

  .tab-close {
    display: none;
  }

  /* Editor content */
  .code-container {
    font-size: 14px;
    padding: 12px 0;
  }

  .line {
    padding: 2px 12px 2px 0;
    min-height: 28px;
  }

  .line-number {
    width: 40px;
    min-width: 40px;
    padding: 0 10px 0 12px;
    font-size: 12px;
  }

  .code {
    padding-right: 16px;
  }

  /* Better touch targets */
  .editor-scroll {
    padding-bottom: 60px;
  }

  /* Status bar hidden on mobile */
  .statusbar {
    display: none;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .tab {
    padding: 0 10px;
    font-size: 12px;
  }

  .line-number {
    width: 32px;
    min-width: 32px;
    padding: 0 6px 0 8px;
  }

  .code-container {
    font-size: 13px;
  }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --tabs-height: 36px;
    --line-height: 22px;
  }

  .tab {
    height: 36px;
    font-size: 12px;
  }

  .line {
    min-height: 24px;
  }

  .code-container {
    font-size: 13px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .tab {
    min-height: 44px;
  }

  .line {
    min-height: 28px;
  }

  /* Disable hover effects */
  .tab:hover {
    background: var(--tab-bg);
  }

  .tab.active:hover {
    background: var(--tab-active-bg);
  }

  .line:hover {
    background: transparent;
  }
}

/* ===================================
   SCROLLBAR STYLING
   =================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===================================
   ACCESSIBILITY
   =================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--accent-blue);
  color: var(--text-bright);
}
