/* WebForge CMS — admin.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f1117;
  --surface:  #1a1d27;
  --surface2: #141720;
  --border:   #2a2d3a;
  --accent:   #4f8ef7;
  --accent2:  #7c3aed;
  --text:     #e2e8f0;
  --muted:    #6b7280;
  --success:  #22c55e;
  --error:    #ef4444;
  --warning:  #f59e0b;
  --radius:   8px;
  --sidebar:  240px;
  --font:     'Segoe UI', system-ui, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── LAYOUT ──────────────────────────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  grid-column: 1 / -1;
  height: 56px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1rem;
}

.topbar-logo .icon {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-user {
  font-size: .82rem;
  color: var(--muted);
}

.topbar-user strong { color: var(--text); }

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface2);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
}

.sidebar-section {
  padding: 0 .75rem;
  margin-bottom: 1.5rem;
}

.sidebar-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 0 .5rem;
  margin-bottom: .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--muted);
  transition: all .15s;
  margin-bottom: .15rem;
}

.sidebar-link:hover { background: var(--border); color: var(--text); }
.sidebar-link.active { background: rgba(79,142,247,.12); color: var(--accent); }
.sidebar-link .ico { font-size: 1rem; width: 18px; text-align: center; }

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main-content {
  padding: 2rem;
  overflow-y: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 { font-size: 1.4rem; font-weight: 700; }
.page-header p  { color: var(--muted); font-size: .85rem; margin-top: .2rem; }

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

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

.stat-card .stat-label { font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
.stat-card .stat-val   { font-size: 1.75rem; font-weight: 700; }
.stat-card .stat-sub   { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

/* ── TABLE ───────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.table-toolbar h2 { font-size: 1rem; font-weight: 600; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  text-align: left;
  padding: .65rem 1.25rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }

tbody td { padding: .8rem 1.25rem; vertical-align: middle; }

.td-title { font-weight: 500; }
.td-slug  { font-family: monospace; font-size: .8rem; color: var(--muted); }
.td-date  { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-published { background: rgba(34,197,94,.12); color: var(--success); }
.badge-draft     { background: rgba(107,114,128,.15); color: var(--muted); }

/* ── ACTION BUTTONS ──────────────────────────────────────────── */
.actions { display: flex; gap: .5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3a7de8; }

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

.btn-danger { background: transparent; color: var(--error); border: 1px solid rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.1); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }

.btn-sm { padding: .3rem .65rem; font-size: .78rem; }

/* ── FORM ────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 700px;
}

.form-group { margin-bottom: 1.1rem; }

label {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: .6rem .9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,142,247,.12);
}

select { cursor: pointer; }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.field-hint  { font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.field-error { font-size: .75rem; color: var(--error); margin-top: .3rem; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: 6px;
  font-size: .875rem;
  margin-bottom: 1.25rem;
}

.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-info    { background: rgba(79,142,247,.1); border: 1px solid rgba(79,142,247,.25); color: #93c5fd; }

/* ── EMPTY TABLE STATE ───────────────────────────────────────── */
.table-empty {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.table-empty .ico { font-size: 2.5rem; margin-bottom: .75rem; }
.table-empty p    { margin-bottom: 1rem; }

/* ── LOGIN ───────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: .4rem;
}

.login-logo .icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
}

.login-header p { color: var(--muted); font-size: .85rem; }

/* ── CONFIRM MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 380px;
  width: 90%;
}

.modal h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.modal p  { color: var(--muted); font-size: .875rem; margin-bottom: 1.25rem; }
.modal .modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content { padding: 1.25rem; }

  .form-row { grid-template-columns: 1fr; }
}
