/* ========================
   Portfolio Admin Dashboard
   ======================== */

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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #f1f5f9;
  --muted: #64748b;
  --radius: 12px;
  --sidebar-w: 220px;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Login ── */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 48px 40px; width: 360px; text-align: center;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.login-card p  { color: var(--muted); font-size: 0.875rem; margin-bottom: 32px; }
.login-card input {
  width: 100%; padding: 12px 16px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  font-size: 0.95rem; margin-bottom: 12px; outline: none;
  transition: border-color 0.2s;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .error { color: var(--red); font-size: 0.8rem; margin-bottom: 10px; min-height: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { opacity: 0.85; }

/* ── App Shell ── */
#app { display: none; }
#app.visible { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  padding: 24px 0; z-index: 10;
}
.sidebar-logo {
  padding: 0 20px 24px; border-bottom: 1px solid var(--border);
  font-size: 1rem; font-weight: 700; letter-spacing: -0.3px;
}
.sidebar-logo span { color: var(--accent); }
.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; cursor: pointer; font-size: 0.875rem; color: var(--muted);
  transition: all 0.15s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-footer small { color: var(--muted); font-size: 0.75rem; }

/* ── Main content ── */
.main { margin-left: var(--sidebar-w); flex: 1; padding: 32px; max-width: calc(100vw - var(--sidebar-w)); }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-header p  { color: var(--muted); font-size: 0.875rem; margin-top: 4px; }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); margin-bottom: 12px; }

/* ── Stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-sub { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ── Bar chart ── */
.chart-wrap { margin-top: 24px; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: 0.85; min-height: 4px; transition: opacity 0.2s; }
.bar:hover { opacity: 1; }
.bar-label { font-size: 0.6rem; color: var(--muted); }

/* ── Token prompt ── */
.token-prompt { display: flex; gap: 10px; margin-bottom: 20px; }
.token-prompt input {
  flex: 1; padding: 10px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.875rem; outline: none;
}
.token-prompt input:focus { border-color: var(--accent); }

/* ── Contact cards ── */
.contact-list { display: flex; flex-direction: column; gap: 12px; }
.contact-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 20px; display: flex; flex-direction: column; gap: 6px;
}
.contact-card.unread { border-left: 3px solid var(--accent); }
.contact-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.contact-name { font-weight: 600; }
.contact-email { color: var(--accent); font-size: 0.85rem; cursor: pointer; }
.contact-date { color: var(--muted); font-size: 0.75rem; margin-left: auto; }
.contact-msg { color: var(--text); font-size: 0.875rem; line-height: 1.5; }
.contact-actions { display: flex; gap: 8px; margin-top: 6px; }
.badge-unread { background: rgba(99,102,241,0.2); color: var(--accent); font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; }

/* ── Editor ── */
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .editor-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.form-group input, .form-group textarea {
  padding: 10px 14px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.875rem; outline: none;
  font-family: inherit; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.editor-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }

/* ── Deploy section ── */
.deploy-card { display: flex; flex-direction: column; gap: 16px; }
.deploy-cmd {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 18px; font-family: 'Courier New', monospace; font-size: 0.85rem;
  color: var(--green); display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.status-dot.yellow { background: var(--yellow); }

/* ── Skeleton ── */
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; height: 16px; }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 20px;
  font-size: 0.875rem; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateY(80px); opacity: 0; transition: all 0.3s; z-index: 999;
}
#toast.show { transform: translateY(0); opacity: 1; }
