@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #252836;
  --bg-hover: #2a2d3a;
  --accent: #6c5ce7;
  --accent-hover: #7c6df7;
  --accent-soft: rgba(108, 92, 231, 0.12);
  --text: #e8e8ed;
  --text-dim: #8b8d9a;
  --text-muted: #5a5c6a;
  --border: #2a2d3a;
  --success: #2ed573;
  --warning: #ffa502;
  --danger: #ff4757;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

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

/* Auth pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-card .subtitle { color: var(--text-dim); margin-bottom: 2rem; font-size: 0.9rem; }
.auth-card .logo { font-size: 1.5rem; font-weight: 700; color: var(--accent); margin-bottom: 1.5rem; display: block; }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-dim); margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.75rem 1rem; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-group .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-group .char-count { font-size: 0.75rem; color: var(--text-muted); text-align: right; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

.link { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.link:hover { text-decoration: underline; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 0.5rem; }

/* Dashboard layout */
.dashboard { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 1.5rem; display: flex; flex-direction: column;
}
.sidebar .logo { font-size: 1.25rem; font-weight: 700; color: var(--accent); margin-bottom: 2rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1rem;
  border-radius: var(--radius-sm); color: var(--text-dim); text-decoration: none;
  font-size: 0.9rem; transition: all 0.15s; margin-bottom: 0.25rem;
}
.sidebar nav a:hover, .sidebar nav a.active { background: var(--accent-soft); color: var(--text); }
.sidebar .user-info { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.sidebar .user-info .name { font-weight: 600; }
.sidebar .user-info .role { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }

.main-content { flex: 1; padding: 2rem; max-width: 1000px; }
.main-content h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }

/* Status badges */
.badge {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-building { background: rgba(255, 165, 2, 0.15); color: var(--warning); }
.badge-preview { background: var(--accent-soft); color: var(--accent); }
.badge-published { background: rgba(46, 213, 115, 0.15); color: var(--success); }
.badge-maintenance { background: rgba(255, 71, 87, 0.15); color: var(--danger); }

/* Wizard */
.wizard { max-width: 640px; margin: 0 auto; }
.wizard-progress { display: flex; gap: 0.5rem; margin-bottom: 2.5rem; }
.wizard-progress .step {
  flex: 1; height: 4px; background: var(--bg-input); border-radius: 2px; transition: background 0.3s;
}
.wizard-progress .step.done { background: var(--accent); }
.wizard-progress .step.active { background: var(--accent); opacity: 0.6; }

.wizard-step { display: none; animation: fadeIn 0.3s ease; }
.wizard-step.active { display: block; }
.wizard-step h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.wizard-step .step-desc { color: var(--text-dim); margin-bottom: 2rem; font-size: 0.95rem; }

.wizard-nav { display: flex; gap: 1rem; margin-top: 2rem; }
.wizard-nav .btn { flex: 1; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Style cards (wizard step 4) */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.style-card {
  aspect-ratio: 1; background: var(--bg-input); border: 2px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s;
  font-size: 0.85rem; font-weight: 600; text-align: center; padding: 1rem;
}
.style-card:hover { border-color: var(--text-muted); }
.style-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.style-card .count-badge { display: none; }

/* Color palette cards */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.palette-card {
  border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: all 0.2s;
}
.palette-card:hover { border-color: var(--text-muted); }
.palette-card.selected { border-color: var(--accent); }
.palette-colors { display: flex; height: 60px; }
.palette-colors span { flex: 1; }
.palette-card .palette-name { padding: 0.5rem 0.75rem; font-size: 0.8rem; font-weight: 500; background: var(--bg-input); }

/* Font cards */
.font-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.font-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 1.5rem;
  cursor: pointer; transition: all 0.2s;
}
.font-card:hover { border-color: var(--text-muted); }
.font-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.font-card .display-sample { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.font-card .body-sample { font-size: 0.95rem; color: var(--text-dim); }
.font-card .font-name { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.75rem; }

/* Tags */
.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 48px; }
.tag { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.75rem; background: var(--accent-soft); color: var(--accent); border-radius: 20px; font-size: 0.85rem; }
.tag button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 1rem; line-height: 1; }
.tag-input-wrap input { flex: 1; min-width: 120px; background: none; border: none; color: var(--text); font-family: var(--font); font-size: 0.9rem; outline: none; }

/* CTA radio cards */
.cta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.cta-card {
  border: 2px solid var(--border); border-radius: var(--radius); padding: 1.25rem;
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.cta-card:hover { border-color: var(--text-muted); }
.cta-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.cta-card .cta-label { font-weight: 600; font-size: 0.95rem; }

/* Loading */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { margin-top: 1rem; color: var(--text-dim); }

/* Preview */
.preview-layout { display: flex; gap: 1.5rem; height: calc(100vh - 4rem); }
.preview-frame { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.preview-frame iframe { width: 100%; height: 100%; border: none; }
.preview-sidebar { width: 320px; display: flex; flex-direction: column; gap: 1rem; }
.version-indicator { font-size: 0.85rem; color: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
  .dashboard { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; padding: 1rem; overflow-x: auto; }
  .sidebar nav { display: flex; gap: 0.5rem; }
  .sidebar .user-info { display: none; }
  .main-content { padding: 1rem; }
  .style-grid { grid-template-columns: repeat(2, 1fr); }
  .preview-layout { flex-direction: column; height: auto; }
  .preview-sidebar { width: 100%; }
}
