/* ═══════════════════════════════════════════════════
   constellate — shared design system
   ═══════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --sidebar-w: 240px;
  --bg: #faf8f6;
  --card-bg: #fff;
  --text: #1a1a1a;
  --text-muted: #777;
  --text-light: #aaa;
  --border: #eee;
  --accent: #00ff00;
  --accent-light: #e0ffe0;
  --accent-hover: #ff00ff;
  --green: #22c55e;
  --green-light: #dcfce7;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.1);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #00ff00 0%, #ff00ff 100%);
  border-radius: 8px;
  display: grid; place-items: center;
  color: #000; font-weight: 700; font-size: 14px;
}

.sidebar-brand span {
  font-weight: 600; font-size: 15px; letter-spacing: -.02em;
}

.sidebar-section { padding: 12px; }

.sidebar-section-title {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-light);
  padding: 4px 8px 8px; font-weight: 600;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-muted);
  text-decoration: none; cursor: pointer;
  transition: all .15s;
}

.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active { background: var(--accent-light); color: #006600; font-weight: 600; }
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: 4px 12px; }

.sidebar-link.disabled { opacity: .55; cursor: default; }
.sidebar-link.disabled:hover { background: transparent; color: var(--text-muted); }
.coming-soon-pill {
  margin-left: auto; padding: 1px 7px; border-radius: 100px;
  background: var(--bg); color: var(--text-light);
  font-size: 9.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; border: 1px solid var(--border);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; font-size: 13px;
}

.sidebar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #f472b6);
  display: grid; place-items: center;
  color: #fff; font-size: 11px; font-weight: 600;
}

.sidebar-user .name { font-weight: 500; }
.sidebar-user .email { font-size: 11px; color: var(--text-light); }

/* ── TOP BAR ── */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex; align-items: center; gap: 12px;
}

.topbar-right {
  display: flex; align-items: center; gap: 12px;
}

.topbar-title {
  font-size: 15px; font-weight: 600;
}

.topbar-back {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  font-size: 12px; font-family: inherit;
  cursor: pointer; transition: all .12s;
  text-decoration: none;
}

.topbar-back:hover { border-color: var(--accent); color: var(--accent); }
.topbar-back svg { width: 14px; height: 14px; }

/* ── BUTTONS ── */
.btn {
  padding: 8px 18px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer;
  transition: all .12s; border: none;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #000; font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: none;
}
.btn-ghost:hover { color: var(--text); }

.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn svg { width: 14px; height: 14px; }

/* ── CARDS ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow .2s;
}

.card:hover { box-shadow: var(--shadow-md); }

/* ── CONTENT AREA ── */
.content { padding: 28px 32px 48px; max-width: 1120px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label { display:block; font-size:12px; font-weight:600; color:var(--text); margin-bottom:6px; }
.form-group input, .form-group textarea, .form-group select { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:6px; font-size:13px; font-family:inherit; outline:none; }
.form-group input:focus, .form-group textarea:focus { border-color:var(--accent); }
.form-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:18px; }

.form-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .03em;
}

.form-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .12s;
  background: var(--card-bg);
}

.form-input:focus { border-color: var(--accent); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: #1a1a1a; color: #fff;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px); opacity: 0;
  transition: all .3s ease; z-index: 9999;
  font-family: 'DM Sans', sans-serif;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 1000;
  place-items: center;
}
.modal-overlay.open { display: grid; }

.modal-box {
  background: #fff; border-radius: var(--radius);
  width: 560px; max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); padding: 24px;
}

.modal-box h2 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal-box .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.modal-close {
  float: right; width: 28px; height: 28px;
  border: none; background: var(--bg);
  border-radius: 50%; cursor: pointer;
  font-size: 16px; color: var(--text-muted);
  display: grid; place-items: center;
}
.modal-close:hover { background: #eee; }

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--bg);
}

.login-box {
  width: 380px; background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px;
  box-shadow: var(--shadow-md);
}

.login-box .logo-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 32px;
}

.login-box .logo-row .logo {
  width: 36px; height: 36px; background: var(--accent);
  border-radius: 8px; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 16px;
}

.login-box .logo-row span { font-weight: 700; font-size: 18px; }

.login-box h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-box .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

.login-box .btn-primary {
  width: 100%; justify-content: center;
  padding: 12px; font-size: 14px;
}

.login-error {
  background: #fef2f2; color: #dc2626;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px;
  display: none;
}

.login-toggle {
  text-align: center; margin-top: 16px;
  font-size: 13px; color: var(--text-muted);
}

.login-toggle a {
  color: var(--accent); text-decoration: none;
  font-weight: 500; cursor: pointer;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* ── PAGE CARDS ── */
.pages-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.page-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: all .15s;
}

.page-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.page-card-preview {
  height: 140px; background: var(--bg);
  display: grid; place-items: center;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}

.page-card-preview iframe {
  width: 200%; height: 200%;
  transform: scale(.5); transform-origin: top left;
  pointer-events: none; border: none;
}

.page-card-body { padding: 16px; }
.page-card-body h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.page-card-body .slug { font-size: 12px; color: var(--text-light); font-family: 'Space Mono', monospace; }

.page-card-actions {
  display: flex; gap: 8px; padding: 0 16px 16px;
}

/* ── BADGE ── */
.badge {
  display: inline-flex; padding: 3px 8px;
  border-radius: 100px; font-size: 11px;
  font-weight: 600; letter-spacing: .02em;
}
.badge-green { background: var(--green-light); color: #15803d; }
.badge-amber { background: var(--amber-light); color: #92400e; }

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .4s ease both; }
.fade-in-1 { animation-delay: .05s; }
.fade-in-2 { animation-delay: .1s; }
.fade-in-3 { animation-delay: .15s; }
.fade-in-4 { animation-delay: .2s; }
