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

:root {
  --bg:        #FAFAFA;
  --surface:   #FFFFFF;
  --surface2:  #F4F4F5;
  --border:    #E4E4E7;
  --border2:   #D1D1D6;
  --accent:    #18181B;
  --accent-v:  #6366F1;
  --accent2:   #EC4899;
  --accent3:   #10B981;
  --text:      #18181B;
  --muted:     #71717A;
  --muted2:    #A1A1AA;
  --danger:    #EF4444;
  --orange:    #F97316;
  --purple:    #8B5CF6;
}

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

body {
  font-family:'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}

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

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width:232px; min-width:232px;
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  padding:20px 0;
  position:sticky; top:0; height:100vh;
}

.logo { padding:0 20px 20px; border-bottom:1px solid var(--border); margin-bottom:12px; }
.logo-mark {
  font-size:18px; font-weight:700; letter-spacing:-0.5px;
  color:var(--text);
}
.logo-mark span { color:var(--accent-v); }
.logo-sub { font-size:10px; color:var(--muted2); letter-spacing:1.5px; text-transform:uppercase; margin-top:2px; font-family:'Geist Mono',monospace; }

.nav-section { padding:8px 12px 4px; font-size:10px; color:var(--muted2); letter-spacing:1px; text-transform:uppercase; font-family:'Geist Mono',monospace; }

.nav-item {
  display:flex; align-items:center; gap:9px;
  padding:8px 12px; margin:1px 8px;
  font-size:13.5px; font-weight:500; color:var(--muted);
  cursor:pointer; transition:all .15s;
  border-radius:8px;
  user-select:none;
}
.nav-item:hover { color:var(--text); background:var(--surface2); }
.nav-item.active { color:var(--text); background:var(--surface2); font-weight:600; }
.nav-icon { font-size:15px; width:18px; text-align:center; flex-shrink:0; opacity:.7; }
.nav-item.active .nav-icon { opacity:1; }

.sidebar-footer { margin-top:auto; padding:16px 20px; border-top:1px solid var(--border); }
.profile-pill { display:flex; align-items:center; gap:10px; }
.avatar {
  width:30px; height:30px; border-radius:50%;
  background:linear-gradient(135deg, var(--accent-v), var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; color:white; flex-shrink:0;
}
.profile-name  { font-size:12.5px; font-weight:600; }
.profile-handle { font-size:11px; color:var(--muted); }
#api-status-dot { width:7px; height:7px; border-radius:50%; background:var(--border2); flex-shrink:0; transition:background .4s; margin-left:auto; }
#api-status-dot.ok  { background:var(--accent3); }
#api-status-dot.err { background:var(--danger); }

/* Plan badge sidebar */
.plan-badge { margin:12px 12px 0; padding:10px 12px; background:var(--surface2); border:1px solid var(--border); border-radius:10px; }
.plan-badge-name { font-size:11.5px; font-weight:600; color:var(--accent-v); margin-bottom:3px; }
.plan-badge-action { font-size:11px; color:var(--muted); cursor:pointer; transition:color .15s; }
.plan-badge-action:hover { color:var(--text); }

/* ── Main ──────────────────────────────── */
.main { flex:1; padding:32px 40px; overflow-y:auto; background:var(--bg); }
.page { display:none; animation:fadeIn .18s ease; }
.page.active { display:block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} }

.page-header { margin-bottom:28px; }
.page-title { font-size:22px; font-weight:700; letter-spacing:-.4px; }
.page-desc { font-size:13px; color:var(--muted); margin-top:4px; }

/* ── Cards ──────────────────────────────── */
.card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:20px;
}
.card-title { font-size:13px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:14px; }

/* ── Grids ──────────────────────────────── */
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }

/* ── Stat cards ─────────────────────────── */
.stat-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:18px; position:relative; overflow:hidden;
}
.stat-card::after { content:''; position:absolute; top:0; left:0; right:0; height:2px; border-radius:12px 12px 0 0; }
.stat-card.purple::after { background:var(--accent-v); }
.stat-card.teal::after   { background:var(--accent3); }
.stat-card.pink::after   { background:var(--accent2); }
.stat-card.orange::after { background:var(--orange); }
.stat-label { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:8px; font-family:'Geist Mono',monospace; }
.stat-value { font-size:26px; font-weight:700; letter-spacing:-.5px; }

/* ── Buttons ────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; gap:7px;
  padding:8px 16px; border-radius:8px;
  font-size:13px; font-weight:500; cursor:pointer;
  border:none; transition:all .15s;
  font-family:'Geist',sans-serif;
  white-space:nowrap;
  text-decoration:none;
}
.btn:disabled { opacity:.45; cursor:not-allowed; }

.btn-primary {
  background:var(--text); color:white;
}
.btn-primary:not(:disabled):hover { background:#3F3F46; transform:translateY(-1px); box-shadow:0 4px 12px rgba(0,0,0,.15); }

.btn-ghost {
  background:transparent; border:1px solid var(--border); color:var(--text);
}
.btn-ghost:not(:disabled):hover { background:var(--surface2); border-color:var(--border2); }

.btn-teal {
  background:rgba(16,185,129,.08); border:1px solid rgba(16,185,129,.2); color:#059669;
}
.btn-teal:not(:disabled):hover { background:rgba(16,185,129,.15); }

.btn-danger {
  background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.2); color:var(--danger);
}

.btn-full { width:100%; justify-content:center; }
.btn-sm   { padding:5px 10px; font-size:12px; }

/* ── Inputs ─────────────────────────────── */
.input, .textarea, .select {
  width:100%;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:8px;
  padding:9px 12px;
  color:var(--text);
  font-family:'Geist',sans-serif;
  font-size:13.5px;
  transition:border-color .15s, box-shadow .15s;
  outline:none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color:var(--accent-v);
  box-shadow:0 0 0 3px rgba(99,102,241,.1);
}
.textarea { resize:vertical; min-height:100px; line-height:1.6; }
.select { cursor:pointer; }
option { background:white; }
label {
  display:block; font-size:11.5px; color:var(--muted);
  margin-bottom:5px; font-weight:500; letter-spacing:.3px;
}
.form-group { margin-bottom:12px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* ── Chips ──────────────────────────────── */
.chip { display:inline-block; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:500; margin:2px; }
.chip-purple { background:rgba(139,92,246,.1); color:#7C3AED; border:1px solid rgba(139,92,246,.2); }
.chip-teal   { background:rgba(16,185,129,.1);  color:#059669; border:1px solid rgba(16,185,129,.2); }
.chip-pink   { background:rgba(236,72,153,.1);  color:#DB2777; border:1px solid rgba(236,72,153,.2); }
.chip-orange { background:rgba(249,115,22,.1);  color:#EA580C; border:1px solid rgba(249,115,22,.2); }

/* ── Spinner ────────────────────────────── */
.spinner {
  width:16px; height:16px;
  border:2px solid rgba(0,0,0,.1);
  border-top-color:var(--text);
  border-radius:50%;
  animation:spin .6s linear infinite;
  display:inline-block; flex-shrink:0;
}
.btn-primary .spinner { border-color:rgba(255,255,255,.25); border-top-color:white; }
@keyframes spin { to{transform:rotate(360deg)} }

/* ── GENERATOR ──────────────────────────── */
.generator-layout { display:grid; grid-template-columns:300px 1fr; gap:18px; align-items:start; }
.gen-config { }
.cost-estimate { font-size:11px; color:var(--muted2); text-align:center; margin-top:8px; font-family:'Geist Mono',monospace; }

.image-panel-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.img-placeholder {
  background:var(--surface); border:1.5px dashed var(--border2);
  border-radius:12px; aspect-ratio:1/1;
  display:flex; align-items:center; justify-content:center; text-align:center;
}
.img-placeholder-inner { padding:20px; }
.img-preview { width:100%; display:block; border-radius:10px; }
.img-preview-wrap { position:relative; border-radius:10px; overflow:hidden; background:var(--surface2); }
.img-overlay { position:absolute; bottom:8px; left:8px; right:8px; display:flex; justify-content:space-between; pointer-events:none; }
.img-style-badge { background:rgba(0,0,0,.6); backdrop-filter:blur(6px); color:white; font-size:10px; font-weight:500; padding:3px 8px; border-radius:20px; text-transform:capitalize; }
.img-cost-badge { background:rgba(16,185,129,.15); border:1px solid rgba(16,185,129,.25); color:#059669; font-size:10px; font-weight:500; padding:3px 8px; border-radius:20px; }
.img-loading { padding:36px 16px; text-align:center; color:var(--muted); }
.img-loading p { margin-top:12px; font-size:13px; color:var(--text); }
.img-loading-sub { font-size:11px !important; color:var(--muted) !important; margin-top:3px !important; }
.img-error { padding:28px 16px; text-align:center; color:var(--danger); }
.img-error p { font-size:13px; margin-top:8px; line-height:1.5; color:var(--muted); }

.caption-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; flex-wrap:wrap; gap:8px; }
.caption-box {
  background:var(--bg); border:1px solid var(--border); border-radius:8px;
  padding:14px; font-size:13.5px; line-height:1.75; color:var(--text);
  white-space:pre-wrap; min-height:100px;
}

/* ── Library ────────────────────────────── */
.lib-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }
.lib-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; overflow:hidden;
  transition:transform .15s, box-shadow .15s; cursor:pointer;
}
.lib-card:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(0,0,0,.08); border-color:var(--border2); }
.lib-card-img { width:100%; aspect-ratio:1/1; object-fit:cover; display:block; background:var(--surface2); }
.lib-card-img-placeholder { width:100%; aspect-ratio:1/1; background:var(--surface2); display:flex; align-items:center; justify-content:center; font-size:28px; }
.lib-card-img-wrap { position:relative; }
.lib-card-video-badge { position:absolute; top:7px; right:7px; background:rgba(0,0,0,.55); backdrop-filter:blur(4px); color:white; font-size:10px; font-weight:600; padding:2px 7px; border-radius:20px; }
.lib-card-body { padding:12px; }
.lib-card-topic { font-size:13.5px; font-weight:600; margin-bottom:5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lib-card-meta { display:flex; align-items:center; justify-content:space-between; }
.lib-card-date { font-size:11px; color:var(--muted); font-family:'Geist Mono',monospace; }
.status-badge { font-size:10px; padding:2px 7px; border-radius:20px; font-weight:500; }
.status-draft     { background:var(--surface2); color:var(--muted); border:1px solid var(--border); }
.status-scheduled { background:rgba(16,185,129,.1); color:#059669; border:1px solid rgba(16,185,129,.2); }
.status-published { background:rgba(99,102,241,.1); color:#4F46E5; border:1px solid rgba(99,102,241,.2); }

/* ── Trends ─────────────────────────────── */
.trend-item { display:flex; align-items:flex-start; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); }
.trend-item:last-child { border-bottom:none; }
.trend-rank { font-size:18px; font-weight:700; color:var(--border2); min-width:28px; font-family:'Geist Mono',monospace; }
.trend-content { flex:1; }
.trend-topic { font-size:13px; font-weight:500; margin-bottom:2px; }
.trend-meta  { font-size:11.5px; color:var(--muted); }
.week-card { flex:1; min-width:130px; background:var(--surface2); border:1px solid var(--border); border-radius:10px; padding:12px; }
.week-card-emoji { font-size:20px; margin-bottom:6px; }
.week-card-day   { font-size:11.5px; font-weight:600; margin-bottom:3px; }
.week-card-desc  { font-size:11px; color:var(--muted); line-height:1.4; }

/* ── Ideas ──────────────────────────────── */
.idea-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:16px; cursor:pointer;
  transition:all .15s; position:relative; overflow:hidden;
}
.idea-card:hover { border-color:var(--accent-v); transform:translateY(-2px); box-shadow:0 4px 16px rgba(0,0,0,.07); }
.idea-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; background:linear-gradient(90deg,var(--accent-v),var(--accent2)); opacity:0; transition:opacity .2s; }
.idea-card:hover::before { opacity:1; }
.idea-emoji  { font-size:22px; margin-bottom:6px; }
.idea-format { font-size:10px; text-transform:uppercase; letter-spacing:1.2px; color:var(--muted); margin-bottom:4px; font-family:'Geist Mono',monospace; }
.idea-title  { font-size:13.5px; font-weight:600; margin-bottom:5px; line-height:1.3; }
.idea-desc   { font-size:12px; color:var(--muted); line-height:1.5; }
.idea-tags   { margin-top:8px; }

/* ── Calendar ───────────────────────────── */
.cal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.cal-month  { font-size:16px; font-weight:700; letter-spacing:-.3px; }
.cal-nav    { display:flex; gap:6px; }
.cal-nav-btn { width:30px; height:30px; border-radius:7px; background:var(--surface2); border:1px solid var(--border); color:var(--text); cursor:pointer; font-size:14px; display:flex; align-items:center; justify-content:center; transition:background .15s; }
.cal-nav-btn:hover { background:var(--border); }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; }
.cal-day-name { text-align:center; font-size:10.5px; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); padding:3px 0 8px; font-family:'Geist Mono',monospace; }
.cal-day { min-height:64px; background:var(--bg); border:1px solid var(--border); border-radius:7px; padding:5px; cursor:pointer; transition:border-color .15s; }
.cal-day:hover { border-color:var(--accent-v); }
.cal-day.today { border-color:var(--accent-v); background:rgba(99,102,241,.04); }
.cal-day.other-month { opacity:.3; pointer-events:none; }
.cal-day-num { font-size:11px; font-weight:500; margin-bottom:3px; color:var(--muted); font-family:'Geist Mono',monospace; }
.cal-day.today .cal-day-num { color:var(--accent-v); font-weight:700; }
.cal-event { font-size:10px; padding:2px 5px; border-radius:4px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-event.reel     { background:rgba(139,92,246,.12); color:#7C3AED; }
.cal-event.carousel { background:rgba(236,72,153,.1);  color:#DB2777; }
.cal-event.quote    { background:rgba(16,185,129,.1);  color:#059669; }
.cal-event.story    { background:rgba(239,68,68,.1);   color:#DC2626; }
.cal-event.post     { background:rgba(249,115,22,.1);  color:#EA580C; }
.cal-legend { display:flex; gap:12px; flex-wrap:wrap; }
.cal-legend-item { display:flex; align-items:center; gap:5px; font-size:11.5px; color:var(--muted); }
.cal-legend-dot  { width:9px; height:9px; border-radius:3px; }

/* ── Modal ──────────────────────────────── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.4); backdrop-filter:blur(4px); z-index:1000; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; width:460px; max-width:95vw; max-height:88vh; overflow-y:auto; animation:modalIn .18s ease; box-shadow:0 20px 60px rgba(0,0,0,.15); }
@keyframes modalIn { from{opacity:0;transform:scale(.96) translateY(8px)} }
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.modal-title  { font-size:16px; font-weight:700; letter-spacing:-.3px; }
.modal-close  { background:none; border:none; color:var(--muted); font-size:20px; cursor:pointer; padding:2px 6px; border-radius:6px; width:28px; height:28px; display:flex; align-items:center; justify-content:center; }
.modal-close:hover { color:var(--text); background:var(--surface2); }
.divider { height:1px; background:var(--border); margin:16px 0; }

/* ── Instagram mock ─────────────────────── */
.insta-mock { background:white; border:1px solid var(--border); border-radius:12px; padding:12px; max-width:280px; margin:0 auto 18px; }
.insta-header { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.insta-avatar { width:26px; height:26px; border-radius:50%; background:linear-gradient(135deg,var(--accent-v),var(--accent2)); flex-shrink:0; }
.insta-username { font-size:12px; font-weight:600; color:#18181B; }
.insta-image { width:100%; aspect-ratio:1/1; border-radius:8px; background:var(--surface2); display:flex; align-items:center; justify-content:center; margin-bottom:8px; overflow:hidden; }
.insta-caption { font-size:11px; color:#3F3F46; line-height:1.5; }

/* ── Upgrade modal ──────────────────────── */
.plan-card { background:var(--bg); border:1px solid var(--border); border-radius:12px; padding:16px; position:relative; }
.plan-card.featured { border:2px solid var(--accent-v); }
.plan-badge-top { position:absolute; top:-10px; left:50%; transform:translateX(-50%); background:var(--accent-v); color:white; font-size:10px; font-weight:600; padding:2px 12px; border-radius:20px; white-space:nowrap; }
.plan-card-name  { font-size:15px; font-weight:700; margin-bottom:6px; }
.plan-card-price { font-size:26px; font-weight:700; margin-bottom:12px; letter-spacing:-.5px; }
.plan-card-price span { font-size:13px; color:var(--muted); font-weight:400; }
.plan-features { list-style:none; margin-bottom:14px; }
.plan-features li { font-size:12px; color:var(--text); padding:3px 0; display:flex; align-items:center; gap:6px; }
.plan-features li::before { content:'✓'; color:var(--accent3); font-weight:700; font-size:11px; }
.plan-features li.disabled { color:var(--muted2); }
.plan-features li.disabled::before { content:'—'; color:var(--border2); }

/* ── Post detail ────────────────────────── */
.post-detail-caption { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:12px; font-size:13px; line-height:1.7; white-space:pre-wrap; max-height:200px; overflow-y:auto; }
.post-detail-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:14px; }

/* ── Video ──────────────────────────────── */
.video-divider { display:flex; align-items:center; gap:10px; margin:12px 0; }
.video-divider::before,.video-divider::after { content:''; flex:1; height:1px; background:var(--border); }
.video-divider span { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.8px; white-space:nowrap; font-family:'Geist Mono',monospace; }
.btn-video { background:var(--text); color:white; font-weight:500; }
.btn-video:hover { background:#3F3F46; }
.btn-video:disabled { opacity:.45; }
.video-plan-info { font-size:11px; color:var(--muted2); text-align:center; margin-top:7px; font-family:'Geist Mono',monospace; }
.video-player { width:100%; border-radius:10px; display:block; background:var(--surface2); }
.video-loading { padding:28px 16px; text-align:center; color:var(--muted); background:var(--surface2); border:1px solid var(--border); border-radius:10px; }
.video-loading p { margin-top:10px; font-size:13px; color:var(--text); }
.video-loading .sub { font-size:11px; color:var(--muted); margin-top:3px; }

/* ── API Banner ─────────────────────────── */
#api-banner { display:none; background:rgba(239,68,68,.06); border:1px solid rgba(239,68,68,.2); border-radius:9px; padding:10px 14px; margin-bottom:20px; font-size:13px; color:#DC2626; align-items:center; gap:8px; }
#api-banner.show { display:flex; }

/* ── Toast ──────────────────────────────── */
#toast { position:fixed; bottom:24px; right:24px; background:var(--text); border-radius:9px; padding:11px 16px; font-size:13px; z-index:9999; transform:translateY(70px); opacity:0; transition:all .25s; display:flex; align-items:center; gap:9px; box-shadow:0 8px 24px rgba(0,0,0,.18); color:white; }
#toast.show { transform:translateY(0); opacity:1; }
.toast-dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.toast-dot.ok  { background:var(--accent3); }
.toast-dot.err { background:var(--danger); }

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }

/* ── Responsive ─────────────────────────── */
@media (max-width:900px) {
  .generator-layout { grid-template-columns:1fr; }
  .grid-3 { grid-template-columns:1fr 1fr; }
  .grid-4 { grid-template-columns:1fr 1fr; }
}
@media (max-width:680px) {
  .sidebar { width:58px; min-width:58px; }
  .sidebar .nav-item span:not(.nav-icon) { display:none; }
  .logo-sub,.logo-mark,.profile-name,.profile-handle { display:none; }
  .main { padding:18px 14px; }
  .grid-2,.grid-3,.grid-4 { grid-template-columns:1fr; }
}
