/* chrisbmn Admin Panel CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400&display=swap');

:root {
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --surface-alt:  #f1f5f9;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --accent:       #0ea5e9;
  --accent-hover: #0284c7;
  --accent-dim:   rgba(14,165,233,.12);
  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --sidebar-w:    240px;
  --topbar-h:     60px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06);
  --shadow:       0 4px 12px rgba(0,0,0,.08);
  --radius:       8px;
  --radius-sm:    6px;
  --font:         'Inter', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }

h1,h2,h3,h4 { margin: 0 0 .5em; font-weight: 700; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 50;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}

.sidebar__logo img {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar__logo-label {
  font-size: .8rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar__nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar__section {
  padding: .5rem 1rem .25rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748b;
  margin-top: .5rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .55rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
}

.sidebar__link i { width: 16px; text-align: center; flex-shrink: 0; }

.sidebar__link:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.sidebar__link.active { background: rgba(14,165,233,.15); color: #38bdf8; }
.sidebar__link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #38bdf8;
  border-radius: 0 2px 2px 0;
}

.sidebar__badge {
  margin-left: auto;
  font-size: .7rem;
  background: rgba(14,165,233,.2);
  color: #38bdf8;
  padding: .1em .45em;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar__footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: #64748b;
}

.sidebar__footer a { color: #94a3b8; }
.sidebar__footer a:hover { color: #e2e8f0; }

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 40;
  gap: 1rem;
}

.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: .625rem;
  margin-left: auto;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  color: var(--text-muted);
}

/* ── Main ── */
.admin-main {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
  flex: 1;
}

.admin-content {
  padding: 1.75rem 1.5rem 3rem;
  max-width: 1200px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: .25rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 1.5rem;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-card__label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: .375rem;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-card__sub {
  font-size: .75rem;
  color: var(--text-faint);
  margin-top: .25rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn--secondary { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.btn--secondary:hover { background: var(--border); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn--ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn--sm { padding: .35rem .75rem; font-size: .8rem; }
.btn--lg { padding: .7rem 1.5rem; font-size: 1rem; }

/* ── Forms ── */
.form-row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .35rem; color: var(--text); }
.form-label .req { color: var(--danger); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: .5rem .75rem;
  font-size: .875rem; font-family: var(--font);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s; outline: none; appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: .75rem; color: var(--text-faint); margin-top: .25rem; }

/* ── Alerts ── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .875rem; margin-bottom: 1rem; display: flex; align-items: flex-start; gap: .5rem; border: 1px solid transparent; }
.alert--success { background: rgba(34,197,94,.08); border-color: rgba(34,197,94,.25); color: #15803d; }
.alert--error   { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); color: #dc2626; }
.alert--info    { background: var(--accent-dim); border-color: rgba(14,165,233,.25); color: #0369a1; }
.alert--warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #b45309; }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { padding: .6rem 1rem; text-align: left; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; font-size: .72rem; font-weight: 600; border-radius: 999px; white-space: nowrap; }
.badge--published { background: rgba(34,197,94,.1); color: #16a34a; }
.badge--draft     { background: rgba(245,158,11,.1); color: #b45309; }
.badge--muted     { background: var(--surface-alt); color: var(--text-muted); }

/* ── Post editor ── */
.editor-layout { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; align-items: start; }
.editor-sidebar .card { margin-bottom: 1rem; }
.editor-sidebar .card:last-child { margin-bottom: 0; }
.editor-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin-bottom: .75rem; }

/* Rich-text editor wrapper */
#postContent { min-height: 400px; }

/* ── Media grid ── */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.media-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.media-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.media-item__thumb { width: 100%; height: 160px; object-fit: cover; background: var(--bg); }
.media-item__thumb--file { display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: var(--text-faint); }
.media-item__info { padding: .6rem .65rem; }
.media-item__name { font-size: .8rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .5rem; }

/* ── Tag/category chip input ── */
.chip-input { display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 38px; cursor: text; background: var(--surface); }
.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .5rem; background: var(--accent-dim); color: var(--accent); border-radius: 999px; font-size: .78rem; font-weight: 500; }
.chip__remove { cursor: pointer; font-size: .8rem; opacity: .7; }
.chip__remove:hover { opacity: 1; }

/* ── Checkbox list ── */
.check-list { list-style: none; padding: 0; margin: 0; max-height: 200px; overflow-y: auto; }
.check-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; font-size: .875rem; }
.check-list input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); flex-shrink: 0; }

/* ── Pagination ── */
.pagination { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 .4rem;
  border-radius: var(--radius-sm); font-size: .8rem; font-weight: 500;
}
.pagination a { color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.pagination a:hover { background: var(--surface-alt); color: var(--text); }
.pagination .current { background: var(--accent); color: #fff; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
}
