@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-foreground: #ffffff;
  --input-bg: #f9fafb;
  --card-bg: #ffffff;
  --radius: 8px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-height: 64px;
  --sticky-height: 180px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --border: #1e293b;
  --accent: #3b82f6;
  --accent-foreground: #ffffff;
  --input-bg: #1e293b;
  --card-bg: #1e293b;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
  padding-top: var(--header-height);
}

/* Header & Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.header-content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover, nav a.active {
  color: var(--fg);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0 4rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  margin-bottom: 1rem;
  color: var(--fg);
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--muted);
  margin-bottom: 0;
}

/* Layout & Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.builder-shell {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Sticky Output Layout */
.sticky-output {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  background: var(--bg);
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.output-card-top {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.output-actions-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.output-box-top {
  width: 100%;
  height: 80px;
  padding: 0.75rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  resize: none;
}

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

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

.builder-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
}

.builder-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  border-color: var(--accent);
}

.builder-card h3 {
  margin-bottom: 0.5rem;
}

.builder-card p {
  color: var(--muted);
  font-size: 0.875rem;
  flex-grow: 1;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

input, select, textarea {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-primary:hover {
  opacity: 0.9;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--fg);
  background: var(--input-bg);
}

.btn-success {
  background: #10b981 !important;
  color: white !important;
  border-color: #10b981 !important;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Option Rows */
.option-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.option-row:last-child {
  border-bottom: none;
}

.option-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.option-row label {
  margin-bottom: 0;
  flex: 0 0 100px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.option-row select {
  flex: 1;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  height: 2rem;
}

/* Theme Toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: var(--input-bg);
}

/* Search Bar */
.search-container {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  padding-left: 2.5rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Mobile */
@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  nav {
    gap: 1rem;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 0.5rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
}
