/* GhostPen App UI — matches landing page design tokens */

:root {
  --bg: #0a0a0f;
  --bg-elevated: #12121a;
  --bg-card: #16161f;
  --fg: #e8e6e1;
  --fg-muted: #8a8780;
  --accent: #c9a84c;
  --accent-glow: rgba(201, 168, 76, 0.15);
  --accent-subtle: rgba(201, 168, 76, 0.08);
  --negative: #5a5550;
  --radius: 12px;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --success: #4caf7d;
  --danger: #e05252;
  --warning: #c9a84c;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── LAYOUT ── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  letter-spacing: -0.5px;
}

.sidebar-logo span { color: var(--fg-muted); font-weight: 400; font-size: 0.75rem; display: block; margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.nav-item.active { background: var(--accent-subtle); color: var(--accent); }
.nav-item svg { flex-shrink: 0; }

.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-subtle);
  border: 1px solid rgba(201,168,76,0.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent);
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.75rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  padding: 32px 40px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.5px;
}

.page-header p { color: var(--fg-muted); margin-top: 4px; font-size: 0.9rem; }

.page-body {
  padding: 32px 40px;
  flex: 1;
}

/* ── CARDS ── */

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

.card-sm { padding: 16px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── BUTTONS ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover { background: #d4b35a; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.1);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-ghost { background: none; color: var(--fg-muted); padding: 6px 12px; }
.btn-ghost:hover { color: var(--fg); }

.btn-danger { background: rgba(224,82,82,0.15); color: var(--danger); border: 1px solid rgba(224,82,82,0.3); }
.btn-danger:hover { background: rgba(224,82,82,0.25); }

.btn-success { background: rgba(76,175,125,0.15); color: var(--success); border: 1px solid rgba(76,175,125,0.3); }
.btn-success:hover { background: rgba(76,175,125,0.25); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

/* ── FORMS ── */

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--fg-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  background: rgba(201,168,76,0.04);
}

.form-textarea { resize: vertical; min-height: 120px; }
.form-select { cursor: pointer; }

.form-hint { font-size: 0.8rem; color: var(--fg-muted); margin-top: 6px; }

/* ── STATUS BADGES ── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pending { background: rgba(201,168,76,0.15); color: var(--accent); }
.badge-approved { background: rgba(76,175,125,0.15); color: var(--success); }
.badge-rejected { background: rgba(224,82,82,0.15); color: var(--danger); }
.badge-scheduled { background: rgba(100,160,255,0.15); color: #64a0ff; }
.badge-published { background: rgba(255,255,255,0.08); color: var(--fg-muted); }

/* ── CONTENT LIST ── */

.content-list { display: flex; flex-direction: column; gap: 12px; }

.content-item {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
  cursor: pointer;
}

.content-item:hover { border-color: rgba(201,168,76,0.3); }

.content-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.content-type-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-muted);
  font-weight: 600;
}

.content-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

.content-preview {
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.content-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.content-meta { font-size: 0.78rem; color: var(--fg-muted); margin-top: 10px; }

/* ── MODALS ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close { background: none; border: none; color: var(--fg-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--fg); }

/* ── AUTH PAGES ── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.auth-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.auth-box {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.auth-tagline { text-align: center; color: var(--fg-muted); margin-bottom: 32px; font-size: 0.9rem; }

.auth-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 32px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.auth-switch { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--fg-muted); }
.auth-switch a { color: var(--accent); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ── ONBOARDING ── */

.onboarding-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.onboarding-glow {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.onboarding-box {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 580px;
}

.onboarding-header { text-align: center; margin-bottom: 40px; }
.onboarding-header h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--fg); letter-spacing: -1px; }
.onboarding-header p { color: var(--fg-muted); margin-top: 8px; }

.step-indicator {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 40px;
}

.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transition: all 0.3s;
}

.step-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }
.step-dot.done { background: var(--success); }

.onboarding-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 40px;
}

.onboarding-card h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.onboarding-card .step-sub { color: var(--fg-muted); margin-bottom: 32px; }

.onboarding-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; }

/* Cadence selector */
.cadence-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.cadence-option {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: rgba(255,255,255,0.03);
}
.cadence-option:hover { border-color: rgba(201,168,76,0.4); }
.cadence-option.selected { border-color: var(--accent); background: var(--accent-subtle); }
.cadence-option .cadence-label { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: var(--fg); }
.cadence-option .cadence-sub { font-size: 0.78rem; color: var(--fg-muted); margin-top: 4px; }

/* ── GENERATE BUTTON AREA ── */

.generate-bar {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.generate-bar .form-group { margin-bottom: 0; flex: 1; min-width: 200px; }

/* ── EMPTY STATE ── */

.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--fg-muted); margin-bottom: 24px; }

/* ── ALERTS ── */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.alert-error { background: rgba(224,82,82,0.1); border: 1px solid rgba(224,82,82,0.3); color: #f08080; }
.alert-success { background: rgba(76,175,125,0.1); border: 1px solid rgba(76,175,125,0.3); color: #7ecba3; }

/* ── LOADING SPINNER ── */

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ── CONTENT EDITOR ── */

.editor-body {
  width: 100%;
  min-height: 300px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 16px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
}

.editor-body:focus { border-color: var(--accent); }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid rgba(255,255,255,0.06); margin: 24px 0; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .page-header, .page-body { padding: 20px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .generate-bar { flex-direction: column; }
  .cadence-options { grid-template-columns: 1fr; }
}

/* ── TOPBAR for mobile ── */
.topbar {
  display: none;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

@media (max-width: 768px) {
  .topbar { display: flex; }
}

.tab-bar {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active { background: var(--bg-card); color: var(--fg); }

/* ── LANDING PAGE NAV ── */
.lp-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.lp-nav-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: -0.5px;
  text-decoration: none;
}

.lp-nav-actions { display: flex; gap: 12px; align-items: center; }
