/* Reuse color tokens, fonts and base reset from the public site */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');
@import url('../../css/style.css');

/* ---------- Layout ---------- */
body.admin-body {
  overflow-x: hidden;
  min-height: 100vh;
}

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

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow-glow);
}
.login-card h1 {
  font-size: 22px;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-card h1 .dot { color: var(--accent); }
.login-card p.sub { color: var(--text-dim); font-size: 14px; margin: 0 0 24px; }

/* ---------- Form basics ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.checkbox-field input { width: auto; }
.checkbox-field label { margin: 0; text-transform: none; font-size: 14px; color: var(--text); }
.hint { color: var(--text-faint); font-size: 12px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn { cursor: pointer; border: none; font-family: var(--font-display); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn-danger {
  background: rgba(255, 92, 138, .12);
  color: var(--accent-3);
  border: 1px solid rgba(255, 92, 138, .3);
}
.btn-danger:hover { background: rgba(255, 92, 138, .2); }
.btn-outline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--text-dim); }

.error-msg {
  background: rgba(255, 92, 138, .1);
  border: 1px solid rgba(255, 92, 138, .3);
  color: var(--accent-3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

/* ---------- Shell: sidebar + main ---------- */
.admin-shell { width: 100%; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  padding: 0 8px;
}
.sidebar .brand .dot { color: var(--accent); font-family: var(--font-mono); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
  background: transparent;
  border: none;
  text-align: left;
  font-family: var(--font-display);
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: rgba(139, 124, 255, .1); color: var(--accent); }
.sidebar .logout-btn { margin-top: auto; }
.view-live-link { font-size: 12px; color: var(--text-faint); text-align: center; padding: 10px 8px; }
.view-live-link a { color: var(--accent); }

.main-area { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.topbar h2 { margin: 0; font-size: 22px; }
.topbar .who { color: var(--text-dim); font-size: 13px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.panel h3 { margin-top: 0; font-size: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 999;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,92,138,.4); color: var(--accent-3); }
.toast.success { border-color: rgba(139,124,255,.4); color: var(--accent); }

/* ---------- Item list (projects/skills/education/experience) ---------- */
.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.item-row:last-child { border-bottom: none; }
.item-main h4 { margin: 0 0 4px; font-size: 15px; }
.item-main p { margin: 0; color: var(--text-dim); font-size: 13px; }
.item-tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty-state { color: var(--text-faint); font-size: 14px; padding: 12px 0; }

/* ---------- Profile picture uploader ---------- */
.pic-uploader { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.pic-uploader img {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
  background: var(--bg-soft);
}
.proj-pic-uploader { align-items: flex-start; margin-bottom: 0; }
.proj-pic-uploader img {
  width: 160px; height: 100px; border-radius: var(--radius);
  aspect-ratio: 16/10;
}

/* ---------- Project gallery uploader (multi-image, up to 70) ---------- */
.field-hint { font-weight: 400; font-size: 11px; color: var(--text-faint); margin-left: 6px; }
.gallery-uploader { margin-bottom: 4px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px; margin-bottom: 12px; max-height: 320px; overflow-y: auto; padding-right: 2px;
}
.gallery-thumb {
  position: relative; aspect-ratio: 16/10; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-soft);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb .cover-badge {
  position: absolute; top: 4px; left: 4px; background: var(--accent); color: #0A0E17;
  font-size: 9px; font-weight: 700; letter-spacing: .03em; padding: 2px 6px; border-radius: 4px;
}
.gallery-thumb .thumb-remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 12px;
  line-height: 20px; padding: 0;
}
.gallery-thumb .thumb-remove:hover { background: var(--accent-3); }
.gallery-thumb-pending { border-color: var(--accent); border-style: dashed; }
.gallery-thumb .pending-badge {
  position: absolute; bottom: 4px; left: 4px; background: var(--accent);
  color: #0A0E17; font-size: 9px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 6px; border-radius: 4px;
}
.gallery-empty { color: var(--text-faint); font-size: 13px; padding: 8px 0; margin: 0; }
.gallery-actions { display: flex; align-items: center; gap: 12px; }
.gallery-count { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .admin-shell.active { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px; }
  .sidebar .brand { margin-bottom: 0; }
  .sidebar nav { flex-direction: row; }
  .sidebar .logout-btn { margin-top: 0; }
  .view-live-link { display: none; }
  .main-area { padding: 20px 16px 40px; }
}
