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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #0f172a;
  --bg-light: #1e293b;
  --bg-lighter: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #475569;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.logo h1 {
  font-size: 1.5rem;
  color: var(--primary);
}

.version {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-lighter);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.nav-links {
  list-style: none;
  flex: 1;
}

.nav-links li {
  margin-bottom: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--bg-lighter);
  color: var(--text);
}

.nav-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.nav-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

/* Main Content */
.content {
  margin-left: 260px;
  padding: 2rem 3rem;
  max-width: 1200px;
  width: 100%;
}

section {
  margin-bottom: 4rem;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

a {
  color: var(--primary);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

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

.stat-value {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Code Blocks */
pre {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  color: var(--text);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-bar input,
.filter-bar select {
  padding: 0.75rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.875rem;
}

.filter-bar input {
  flex: 1;
}

.filter-bar input::placeholder {
  color: var(--text-muted);
}

/* Tools Grid */
.tools-grid {
  display: grid;
  gap: 1rem;
}

.tool-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.tool-card:hover {
  border-color: var(--primary);
}

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

.tool-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.tool-category {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  background: var(--primary);
  color: white;
  border-radius: 4px;
}

.tool-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.tool-params {
  margin-top: 1rem;
}

.tool-params h4 {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.param {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.param-name {
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--primary);
}

.param-type {
  color: var(--warning);
}

.param-required {
  background: var(--error);
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

.param-desc {
  color: var(--text-muted);
  flex: 1;
}

/* Schema Toggle */
.schema-toggle {
  margin-top: 1rem;
}

.schema-toggle summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.schema-toggle pre {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* Learnings */
.learning-card {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

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

.app-version {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.learning-dates {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.element-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
}

.element-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.element-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

.success-count {
  color: var(--success);
}

.fail-count {
  color: var(--error);
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
  }

  .filter-bar {
    flex-direction: column;
  }
}
