/* Zyrln Setup Page — Stylesheet */

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

:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --secondary: #3b82f6;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --bg-gray: #1a2332;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.4);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  font-size: 15px;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

/* ─── Header ──────────────────────────────────────── */
.header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 28px;
}

.logo h1 {
  font-size: 24px;
  margin: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  background: var(--primary);
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: bold;
}

.nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav a {
  color: var(--text-dim);
  font-size: 14px;
}

.nav a:hover {
  color: var(--primary);
}

@media (max-width: 640px) {
  .nav {
    display: none;
  }
}

/* ─── Hero ────────────────────────────────────────── */
.hero {
  padding: 60px 0;
  text-align: center;
  background: radial-gradient(circle at top, rgba(16, 185, 129, 0.1), transparent 50%);
}

.hero h2 {
  font-size: 36px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}

.subtitle {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.stat {
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: var(--radius);
  min-width: 160px;
  border: 1px solid var(--border);
}

.stat strong {
  display: block;
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat span {
  font-size: 13px;
  color: var(--text-dim);
}

.cta-button {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 14px 32px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
  color: white;
}

.cta-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── Sections ───────────────────────────────────── */
.section {
  padding: 60px 0;
}

.section h3 {
  font-size: 28px;
  margin-bottom: 12px;
  text-align: center;
}

.section h4 {
  font-size: 18px;
  margin: 16px 0 12px;
  color: var(--text);
}

.section h5 {
  font-size: 16px;
  margin: 12px 0 8px;
  color: var(--text-dim);
}

.section-desc {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 40px;
}

.bg-gray {
  background: var(--bg-gray);
}

/* ─── Flow diagram ──────────────────────────────── */
.flow {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.flow-step {
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  min-width: 130px;
  border: 1px solid var(--border);
}

.flow-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.flow-label {
  font-size: 13px;
  color: var(--text-dim);
}

.flow-label small {
  display: block;
  font-size: 11px;
  margin-top: 2px;
  color: var(--text-muted);
}

.flow-arrow {
  font-size: 28px;
  color: var(--primary);
}

@media (max-width: 640px) {
  .flow {
    flex-direction: column;
  }
  .flow-arrow {
    transform: rotate(90deg);
  }
}

/* ─── Setup steps ───────────────────────────────── */
.step {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.2s;
}

.step[open] {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.step summary {
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  list-style: none;
}

.step summary::-webkit-details-marker {
  display: none;
}

.step summary::after {
  content: "▼";
  margin-right: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.step[open] summary::after {
  transform: rotate(180deg);
}

.step-num {
  background: var(--primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.step-title {
  font-size: 16px;
  font-weight: bold;
}

.step-time {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 10px;
  border-radius: 999px;
}

.step-content {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.step-content ol,
.step-content ul {
  padding-right: 24px;
  margin: 12px 0;
}

.step-content li {
  margin: 8px 0;
  line-height: 1.8;
}

.step-content code {
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
  color: #fde68a;
}

.example {
  display: block;
  margin: 8px 0;
  padding: 12px !important;
  font-size: 14px !important;
  word-break: break-all;
}

/* ─── Forms ─────────────────────────────────────── */
.form {
  margin-top: 20px;
}

.form label,
.form-label-block {
  display: block;
  margin-bottom: 16px;
}

.form label span,
.form-label-block span {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form label small,
.form-label-block small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form input,
.form-label-block input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
  direction: ltr;
  text-align: left;
}

.form input:focus,
.form-label-block input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-label-block {
  margin: 20px 0;
}

/* ─── Hints / Notes ─────────────────────────────── */
.hint {
  background: rgba(59, 130, 246, 0.1);
  border-right: 3px solid var(--secondary);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  color: var(--text-dim);
}

.hint strong {
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.warning {
  background: rgba(245, 158, 11, 0.1);
  border-right: 3px solid var(--warning);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  color: var(--text-dim);
}

.warning strong {
  color: var(--warning);
  display: block;
  margin-bottom: 4px;
}

.warning ul {
  padding-right: 20px;
  margin-top: 8px;
}

.perms {
  background: var(--bg);
  padding: 12px 28px;
  border-radius: 8px;
  margin: 12px 0;
  border: 1px solid var(--border);
}

.perms li {
  list-style: none;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  padding: 4px 0;
}

/* ─── Cards ─────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.card h4 {
  margin-bottom: 12px;
  font-size: 17px;
}

.card ul {
  padding-right: 0;
  list-style: none;
}

.card li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.card li:last-child {
  border-bottom: none;
}

/* ─── Code box ──────────────────────────────────── */
.code-box {
  position: relative;
  margin: 12px 0;
}

.code-box pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  color: var(--text);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.copy-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  z-index: 1;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
}

/* ─── Build result ─────────────────────────────── */
#build-result {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
}

.result-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--success);
  color: var(--text);
}

.result-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--text);
}

.result-loading {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--secondary);
  color: var(--text);
  text-align: center;
}

.result-loading::before {
  content: "⏳ ";
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-data {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  margin-top: 12px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  direction: ltr;
  text-align: left;
}

/* ─── Credits ───────────────────────────────────── */
.credits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.credit-item {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.credit-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
}

.credit-item small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ─── Footer ────────────────────────────────────── */
.footer {
  background: var(--bg-card);
  padding: 30px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  margin-top: 60px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-dim);
}

/* ─── Helpers ───────────────────────────────────── */
kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 11px;
  color: var(--text);
}

.config-box {
  background: var(--bg-gray);
  padding: 20px;
  border-radius: var(--radius);
  margin: 16px 0;
  border: 2px solid var(--primary);
}

/* ─── Mobile ────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h2 {
    font-size: 26px;
  }
  
  .subtitle {
    font-size: 15px;
  }
  
  .section {
    padding: 40px 0;
  }
  
  .section h3 {
    font-size: 22px;
  }
  
  .step summary {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  
  .step-title {
    font-size: 14px;
  }
  
  .container {
    padding: 0 16px;
  }
}
