:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #64748b;
  --accent: #0ea5e9;
  --background: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'Roboto Mono', monospace;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Layout */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

.brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-item:hover, .nav-item.active {
  color: var(--primary);
}

.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
}

.hero-section {
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
  color: white;
  padding: 5rem 2rem;
  text-align: center;
  width: 100%;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: white;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin: 0 auto 2.5rem;
  max-width: 700px;
  opacity: 0.9;
  color: #e0e7ff;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-white {
  background: white;
  color: var(--primary);
  border: none;
}
.btn-white:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-outline-white {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
}
.btn-outline-white:hover {
  background: rgba(255,255,255,0.1);
  border-color: white;
}

/* Typography */
h1, h2, h3 {
  margin-top: 0;
  color: var(--text-main);
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.8rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { color: var(--text-muted); }

/* Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  font-size: 0.95rem;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-main);
}

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

.btn-block {
  width: 100%;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

/* Sidebar Layout (for Research/Docs) */
.layout-sidebar {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 3rem;
  align-items: start;
}

.sidebar-nav {
  position: sticky;
  top: 100px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 1rem;
}

.sidebar-link {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  margin-bottom: 0.25rem;
}

.sidebar-link:hover {
  background: var(--background);
  color: var(--primary);
}

.sidebar-link.active {
  background: #e0e7ff;
  color: var(--primary);
  font-weight: 600;
}

.article-content {
  background: var(--surface);
  padding: 3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.article-content h2 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  margin-top: 3rem;
}

.article-content h2:first-child {
  margin-top: 0;
}

/* Standards Page */
.standards-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.standard-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.standard-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-switch.active {
  background: var(--primary);
}

.toggle-switch.active::after {
  transform: translateX(20px);
}

/* Editor Specifics */
.editor-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 600px;
  background: var(--code-bg);
}

.editor-pane {
  display: flex;
  flex-direction: column;
}

.editor-header {
  background: #2d3748;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #4a5568;
  color: #e2e8f0;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-content {
  flex: 1;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--code-text);
  overflow-y: auto;
  white-space: pre;
}

.diff-add { background-color: rgba(16, 185, 129, 0.2); }
.diff-del { background-color: rgba(239, 68, 68, 0.2); text-decoration: line-through; opacity: 0.7; }
.diff-marker { display: inline-block; width: 1.5em; color: var(--text-muted); user-select: none; }

.divider {
  width: 1px;
  background: #4a5568;
  height: 100%;
}

/* Analysis Visualization */
.ast-viz {
  padding: 2rem;
  background: var(--background);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  min-height: 300px;
}

.tree-level {
  display: flex;
  gap: 3rem;
  position: relative;
  justify-content: center;
}

.node-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.node {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  box-shadow: var(--shadow-sm);
  z-index: 2;
  position: relative;
}

.node.dirty {
  border-color: var(--danger);
  background: #fef2f2;
}

.node.clean {
  border-color: var(--success);
  background: #ecfdf5;
}

/* Connector lines - simplified for wireframe */
.tree-level::before {
  content: '';
  position: absolute;
  top: -1rem;
  left: 50%;
  width: 2px;
  height: 1rem;
  background: var(--border);
}
.tree-level:first-child::before { display: none; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge {
  display: inline-flex;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }

/* Upload Area */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--background);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: #f1f5f9;
}

.step-indicator {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
  gap: 2rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.step.active {
  color: var(--primary);
  font-weight: 600;
}

.step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.step.active .step-circle {
  background: var(--primary);
  color: white;
}

/* Footer */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem;
  margin-top: auto;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar-nav {
    position: static;
    margin-bottom: 2rem;
  }
  .grid-2, .grid-3, .stats-grid, .editor-panel {
    grid-template-columns: 1fr;
  }
  .editor-panel {
    height: auto;
  }
  .editor-pane {
    height: 300px;
  }
  .divider {
    width: 100%;
    height: 1px;
  }
  .hero-title {
    font-size: 2.5rem;
  }
  .hero-section {
    padding: 3rem 1.5rem;
  }
}
