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

:root {
  --bg: #0c0f14;
  --bg-card: #141820;
  --bg-input: #1a1f2b;
  --bg-hover: #1e2433;
  --border: #2a3040;
  --border-focus: #10b981;
  --text: #e2e8f0;
  --text-muted: #7c8698;
  --text-dim: #4a5568;
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --blue: #3b82f6;
  --amber: #f59e0b;
  --coral: #f97066;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-w: 720px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 15, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
}
.logo-icon {
  font-size: 20px;
  color: var(--accent);
}
.header-cta {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 20px;
  transition: all 0.2s;
}
.header-cta:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ===== Container ===== */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Hero ===== */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 14px;
  letter-spacing: -0.5px;
}
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto;
}

/* ===== Generator ===== */
.generator { padding-bottom: 60px; }

/* Input Area */
.input-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.prompt-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 14px 16px;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s;
}
.prompt-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.prompt-textarea::placeholder { color: var(--text-dim); }
.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.char-count { font-size: 12px; color: var(--text-dim); }

/* Generate Button */
.btn-generate {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-generate:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Examples */
.examples { margin-bottom: 32px; }
.examples-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.examples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.example-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.example-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

/* ===== Result Area ===== */
.result-area { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.result-title {
  font-size: 18px;
  font-weight: 600;
}
.result-meta { display: flex; gap: 8px; flex-shrink: 0; }
.meta-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}
.meta-badge.difficulty { background: rgba(59,130,246,0.15); color: var(--blue); }
.meta-badge.lines { background: rgba(245,158,11,0.15); color: var(--amber); }

/* Code Container */
.code-container {
  position: relative;
  background: #1e1e2e;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.25);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-lang { font-size: 12px; color: rgba(255,255,255,0.4); font-family: var(--mono); }
.btn-copy {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-copy:hover { background: rgba(255,255,255,0.15); color: #fff; }
.code-container pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}
.code-container code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
}

/* Blur overlay */
.code-blur {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65%;
  background: linear-gradient(transparent, #1e1e2e 40%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 24px;
}
.blur-message p {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  font-style: italic;
}

/* Email Gate */
.email-gate {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease-out;
}
.email-gate-inner {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.email-gate-text {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.email-form {
  display: flex;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
}
.email-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
}
.email-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.btn-unlock {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-unlock:hover { background: var(--accent-hover); }
.email-privacy {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 10px;
}

/* Explanation */
.explanation {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease-out;
}
.explanation h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.explanation-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Remaining */
.remaining-badge {
  text-align: center;
  margin-bottom: 20px;
}
.remaining-badge span {
  display: inline-block;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 20px;
}

/* CTA Box */
.cta-box { margin-bottom: 24px; }
.cta-inner {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(59,130,246,0.08));
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.cta-inner h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.cta-inner p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.btn-course {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
}
.btn-course:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* Limit Message */
.limit-message { animation: fadeIn 0.3s ease-out; }
.limit-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.limit-inner h3 { font-size: 18px; margin-bottom: 8px; color: var(--amber); }
.limit-inner p { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.limit-cta { margin-top: 20px; }
.limit-cta p { margin-bottom: 14px; }

/* Error */
.error-message {
  background: rgba(249, 112, 102, 0.1);
  border: 1px solid rgba(249, 112, 102, 0.3);
  border-radius: var(--radius);
  padding: 16px 20px;
  animation: fadeIn 0.3s ease-out;
}
.error-message p { font-size: 14px; color: var(--coral); }

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.footer p { font-size: 13px; color: var(--text-dim); }
.footer a { color: var(--accent); text-decoration: none; }
.footer-note { margin-top: 6px; font-size: 11px; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero { padding: 40px 0 28px; }
  .hero h1 { font-size: 26px; }
  .email-form { flex-direction: column; }
  .result-header { flex-direction: column; }
  .examples-grid { gap: 6px; }
  .example-chip { font-size: 12px; padding: 5px 10px; }
}
