/* Springs of Life Zimbabwe — Admin dashboard, aligned with the website brand. */

:root {
  --blue: #1746ff;
  --green: #18b566;
  --red: #e63946;
  --ink: #0b1220;
  --ink-soft: #131c30;
  --grad: linear-gradient(135deg, #1746ff 0%, #18b566 60%, #18b566 100%);
  --grad-brand: linear-gradient(120deg, #1746ff, #18b566);
  --bg: #f5f7fb;
  --card: #ffffff;
  --border: #e7ebf2;
  --muted: #64748b;
  --text: #0f172a;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 2px 10px -4px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: "Outfit", "Inter", sans-serif; margin: 0; letter-spacing: -0.02em; }

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

.sidebar {
  width: 256px;
  flex-shrink: 0;
  background: var(--ink);
  background-image: radial-gradient(circle at 20% 0%, rgba(23, 70, 255, 0.25), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(24, 181, 102, 0.2), transparent 45%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
}
.brand img { height: 40px; width: 40px; border-radius: 50%; }
.brand .brand-name { font-family: "Outfit", sans-serif; font-weight: 800; color: #fff; font-size: 15px; line-height: 1.1; }
.brand .brand-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em; color: #7c8aa5; }

.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #aab6cc;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: var(--grad-brand); color: #fff; box-shadow: 0 8px 20px -8px rgba(23, 70, 255, 0.6); }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 1px 8px;
}
.nav a.active .badge { background: rgba(255, 255, 255, 0.25); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-foot a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #aab6cc; font-size: 13px; }
.sidebar-foot a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-foot a svg { width: 16px; height: 16px; }

.main { flex: 1; margin-left: 256px; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(245, 247, 251, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar .subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.avatar {
  height: 38px; width: 38px; border-radius: 50%;
  background: var(--grad-brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-family: "Outfit", sans-serif;
}
.user-meta { text-align: right; line-height: 1.2; }
.user-meta .name { font-weight: 600; }
.user-meta .role { font-size: 11px; color: var(--muted); }

.content { padding: 28px; max-width: 1200px; }

/* ---------- Cards & stat tiles ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.stat .ico { height: 44px; width: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; }
.stat .ico svg { width: 22px; height: 22px; }
.stat .num { font-family: "Outfit", sans-serif; font-weight: 800; font-size: 30px; line-height: 1; }
.stat .lbl { color: var(--muted); margin-top: 6px; font-size: 13px; }
.stat .pill { position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 9999px; }

.bg-blue { background: linear-gradient(135deg, #1746ff, #5b6cff); }
.bg-green { background: linear-gradient(135deg, #18b566, #10d080); }
.bg-red { background: linear-gradient(135deg, #e63946, #ff6b6b); }
.bg-ink { background: linear-gradient(135deg, #334155, #0b1220); }

/* ---------- Section header / toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar form.search { display: flex; gap: 8px; }
.toolbar h2 { font-size: 18px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 14px; border-radius: 9999px; font-size: 13px; font-weight: 600;
  background: #fff; border: 1px solid var(--border); color: var(--muted);
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--grad-brand); color: #fff; border-color: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 11px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  cursor: pointer; transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn:hover { box-shadow: var(--shadow-soft); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad-brand); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(23, 70, 255, 0.7); }
.btn-success { background: var(--green); color: #fff; border-color: transparent; }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c6ca; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }

/* ---------- Table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-soft); }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; padding: 14px 18px; background: #fbfcfe; border-bottom: 1px solid var(--border);
}
table.data td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbff; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data .title-cell { font-weight: 600; color: var(--text); }
table.data .muted { color: var(--muted); }
.thumb { height: 38px; width: 38px; border-radius: 9px; object-fit: cover; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 9999px;
  font-size: 11px; font-weight: 700;
}
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-approved, .badge-published, .badge-completed { background: #dcfce7; color: #15803d; }
.badge-rejected, .badge-failed { background: #fee2e2; color: #b91c1c; }
.badge-draft, .badge-refunded { background: #e2e8f0; color: #475569; }
.badge-neutral { background: #eef2f7; color: #475569; }
.badge-blue { background: #dbe5ff; color: #1746ff; }

.dot-yes { color: var(--green); font-weight: 700; }
.dot-no { color: #cbd5e1; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .ico { height: 60px; width: 60px; border-radius: 18px; background: var(--grad-brand); display: grid; place-items: center; margin: 0 auto 16px; color: #fff; }
.empty h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }

/* ---------- Forms ---------- */
.form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 26px; max-width: 760px; }
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 13px; }
.form-row .help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="number"],
.form-row input[type="url"], .form-row input[type="password"], .form-row select, .form-row textarea {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.form-row textarea { resize: vertical; min-height: 130px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 70, 255, 0.1); }
.form-row.check { display: flex; align-items: center; gap: 10px; }
.form-row.check label { margin: 0; }
.form-row.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--red); font-size: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.nonfield-errors { background: #fee2e2; color: #b91c1c; padding: 12px 14px; border-radius: 12px; margin-bottom: 18px; font-size: 13px; }

/* ---------- Messages (flash) ---------- */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 12px 16px; border-radius: 12px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.flash.success { background: #dcfce7; color: #15803d; }
.flash.error { background: #fee2e2; color: #b91c1c; }
.flash.info { background: #dbeafe; color: #1d4ed8; }
.flash.warning { background: #fef3c7; color: #b45309; }

/* ---------- Detail view ---------- */
.detail-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 26px; max-width: 820px; }
.detail-row { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { width: 160px; flex-shrink: 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.detail-row .v { flex: 1; white-space: pre-wrap; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 15% 15%, rgba(23,70,255,0.12), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(24,181,102,0.12), transparent 40%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 36px; }
.login-card .logo { height: 56px; width: 56px; border-radius: 50%; margin: 0 auto 18px; display: block; }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 6px 0 26px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 22px; }
.pagination a, .pagination span { padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-weight: 600; color: var(--muted); }
.pagination .current { background: var(--grad-brand); color: #fff; border-color: transparent; }

/* ---------- Reader / preview ---------- */
.reader { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 0 0 28px; max-width: 820px; overflow: hidden; }
.reader-hero { width: 100%; height: 280px; object-fit: cover; display: block; }
.reader-meta { display: flex; gap: 8px; padding: 24px 32px 0; }
.reader-title { font-family: "Outfit", sans-serif; font-weight: 800; font-size: 32px; line-height: 1.1; padding: 14px 32px 0; }
.reader-byline { color: var(--muted); font-size: 14px; padding: 12px 32px 0; }
.reader-body { padding: 22px 32px 0; font-size: 16px; line-height: 1.75; color: #1f2937; }
.reader-body p { margin: 0 0 16px; }
.prose h2 { font-size: 24px; margin: 26px 0 10px; }
.prose h3 { font-size: 19px; margin: 22px 0 8px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose blockquote { margin: 0 0 16px; padding: 6px 18px; border-left: 4px solid var(--blue); color: var(--muted); font-style: italic; }
.prose a { color: var(--blue); font-weight: 600; }
.reader-private { margin: 28px 32px 0; padding: 18px; background: #f8fafc; border: 1px dashed var(--border); border-radius: 14px; }
.reader-private-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }

/* ---------- Rich text editor (Quill) ---------- */
.ql-toolbar.ql-snow { border: 1.5px solid var(--border); border-radius: 12px 12px 0 0; background: #fbfcfe; }
.ql-container.ql-snow { border: 1.5px solid var(--border); border-top: none; border-radius: 0 0 12px 12px; font-family: "Inter", sans-serif; font-size: 15px; }
.ql-editor { min-height: 240px; line-height: 1.7; }
.ql-editor.ql-blank::before { font-style: normal; color: #94a3b8; }

/* ---------- Mobile ---------- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  #nav-toggle:checked ~ .sidebar { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; height: 40px; width: 40px; border-radius: 11px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
