/* ============================================================
   Portfolio Dashboard — admin.css
   Same dark+cream identity, but utility-focused.
   ============================================================ */

*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

:root {
  --bg: #0e0e10;
  --panel: #161618;
  --panel-2: #1d1d20;
  --line: rgba(243, 234, 212, 0.08);
  --line-2: rgba(243, 234, 212, 0.16);
  --cream: #f3ead4;
  --muted: rgba(243, 234, 212, 0.55);
  --pink: #ff5f8a;
  --green: #6cd3a3;
  --red: #ff6b6b;
  --ink: #16161a;
  --radius: 14px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }
.muted.small { font-size: 12px; }

/* ============ TOP BAR ============ */
.adm-top {
  position: sticky; top: 0; z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  background: rgba(14,14,16,.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.adm-top__brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700; font-size: 15px;
}
.adm-logo { color: var(--pink); font-size: 18px; }
.adm-top__status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--muted);
}
.adm-top__status .dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(255,107,107,.18);
}
.adm-top__status.connected .dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(108,211,163,.18);
}
.adm-top__actions { display: flex; gap: 8px; }

/* ============ BUTTONS ============ */
.adm-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s ease, transform .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.adm-btn--primary { background: var(--cream); color: var(--ink); }
.adm-btn--primary:hover { background: #fff; transform: translateY(-1px); }
.adm-btn--ghost { background: var(--panel); color: var(--cream); border: 1px solid var(--line); }
.adm-btn--ghost:hover { background: var(--panel-2); border-color: var(--line-2); }
.adm-btn--danger { background: transparent; color: var(--red); border: 1px solid rgba(255,107,107,.35); }
.adm-btn--danger:hover { background: rgba(255,107,107,.1); }
.adm-btn--block { width: 100%; justify-content: center; }
.adm-btn--lg { padding: 14px 22px; font-size: 14px; }
.adm-btn--sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.adm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ FIRST RUN ============ */
.adm-first-run {
  min-height: calc(100vh - 60px);
  display: grid; place-items: center;
  padding: 48px 24px;
}
.adm-first-run__card {
  max-width: 540px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 40px 36px;
  text-align: center;
}
.adm-first-run h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px; margin: 0 0 14px;
}
.adm-first-run p { color: var(--muted); line-height: 1.6; margin: 0 0 16px; }
.adm-first-run code {
  background: var(--panel-2);
  padding: 2px 8px; border-radius: 6px;
  font-size: 13px; color: var(--cream);
}
.adm-first-run .adm-btn--primary { margin-top: 8px; }

/* ============ APP LAYOUT ============ */
.adm-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}
@media (max-width: 800px) {
  .adm-app { grid-template-columns: 1fr; }
  .adm-sidebar { position: sticky; top: 60px; z-index: 5; }
}

.adm-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.adm-sidebar__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.adm-nav {
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.adm-nav:hover { background: var(--panel-2); color: var(--cream); }
.adm-nav.active { background: var(--cream); color: var(--ink); font-weight: 700; }

.adm-main { padding: 28px 32px 60px; max-width: 920px; }
@media (max-width: 800px) { .adm-main { padding: 24px 20px 60px; } }

.adm-pane { display: none; }
.adm-pane.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.adm-pane__head { margin-bottom: 22px; }
.adm-pane__head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px; margin: 0 0 6px;
}
.adm-pane__head p { margin: 0; }

/* ============ FORM PRIMITIVES ============ */
.adm-field {
  display: block;
  margin-bottom: 18px;
}
.adm-field__label {
  display: block;
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.adm-field__hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.adm-input, .adm-textarea, .adm-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--cream);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s ease;
}
.adm-input:focus, .adm-textarea:focus, .adm-select:focus {
  outline: none;
  border-color: var(--pink);
}
.adm-textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.adm-input--mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }

.adm-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .adm-row { grid-template-columns: 1fr; } }

.adm-checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
}
.adm-checkbox input { accent-color: var(--pink); width: 16px; height: 16px; }

/* ============ CARD / LIST ============ */
.adm-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.adm-card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.adm-card__title {
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.adm-card__actions { display: flex; gap: 6px; }

.adm-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
}
.adm-list-item__handle {
  cursor: grab; color: var(--muted);
  user-select: none; padding: 0 4px;
  font-size: 18px; line-height: 1;
}
.adm-list-item__handle:active { cursor: grabbing; }
.adm-list-item__body { min-width: 0; }
.adm-list-item__title { font-weight: 600; }
.adm-list-item__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-list-item__actions { display: flex; gap: 4px; }

/* ============ IMAGE PICKER ============ */
.adm-img {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.adm-img__preview {
  width: 96px; height: 96px;
  border-radius: 8px;
  background: #0a0a0c;
  display: grid; place-items: center;
  overflow: hidden;
}
.adm-img__preview img { width: 100%; height: 100%; object-fit: cover; }
.adm-img__preview.empty { color: var(--muted); font-size: 11px; }
.adm-img__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.adm-img__path { font-size: 12px; color: var(--muted); word-break: break-all; }
.adm-img__actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ PROJECT GRID ============ */
.adm-projects-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 10px;
}
.adm-project-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color .15s ease;
}
.adm-project-card:hover { border-color: var(--line-2); }
.adm-project-card__thumb {
  width: 80px; height: 80px;
  border-radius: 10px;
  background: #0a0a0c;
  overflow: hidden;
  display: grid; place-items: center;
  color: var(--muted); font-size: 11px;
}
.adm-project-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.adm-project-card__body { min-width: 0; }
.adm-project-card__title {
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 8px;
}
.adm-project-card__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adm-project-card__actions { display: flex; gap: 6px; }

.adm-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--cream);
}
.adm-tag.tag-green  { background: #6cd3a3; }
.adm-tag.tag-blue   { background: #7fb1ff; }
.adm-tag.tag-pink   { background: #ff96b6; }
.adm-tag.tag-yellow { background: #ffd84d; }

/* ============ OVERLAY (project editor) ============ */
.adm-overlay {
  position: fixed; inset: 0;
  background: rgba(8,8,10,.86);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.adm-overlay[hidden] { display: none; }
.adm-overlay__inner {
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 48px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.adm-overlay__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.adm-overlay__head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; margin: 0;
}
.adm-overlay__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px;
}
.adm-overlay__foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  z-index: 2;
}
.adm-overlay__foot .adm-btn--primary {
  min-width: 120px;
  justify-content: center;
}

/* ============ GALLERY GROUP EDITOR ============ */
.adm-group {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.adm-group__head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px; align-items: center;
  margin-bottom: 12px;
}
.adm-group__items {
  display: grid; gap: 8px;
}

/* ============ TOAST ============ */
.adm-toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--cream);
  color: var(--ink);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.6);
  z-index: 80;
  animation: toastIn .2s ease;
}
.adm-toast[hidden] { display: none; }
.adm-toast.error { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
