/* Wild4Life — Custom Admin Dashboard */
/* Icons: Lucide (https://lucide.dev) loaded via CDN as <i data-lucide="..."> */

/* ── Brand palette (matches Wild4Life public site) ────────────────────────── */
:root {
  /* Sidebar — Wild4Life brand dark teal */
  --sidebar-bg:    #1a4d4e;
  --sidebar-mid:   #1e5a5b;
  --sidebar-hover: #25636a;

  /* Primary accent — brand gold */
  --accent:        #e8b13e;
  --accent-dark:   #c8942a;
  --accent-glow:   rgba(232,177,62,.2);

  /* Success / paid indicator */
  --green:         #22c55e;
  --green-bg:      rgba(34,197,94,.12);

  /* Brand gold as stat card highlight */
  --gold:          #e8b13e;
  --gold-bg:       rgba(232,177,62,.12);

  /* Brand red */
  --red:           #b3413d;
  --red-bg:        rgba(179,65,61,.1);

  --blue:          #3b82f6;
  --blue-bg:       rgba(59,130,246,.1);
  --purple:        #a855f7;
  --purple-bg:     rgba(168,85,247,.1);

  --bg:            #f4f7fc;
  --card:          #ffffff;
  --border:        #dde6e6;
  --text:          #0d2b2c;
  --muted:         #5f7475;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --transition:    .18s ease;
  --sidebar-w:     265px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  overflow: hidden;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;        /* lets the flex item shrink below content height so overflow kicks in */
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: .5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }

/* ── Lucide icon baseline ─────────────────────────────────────────────────── */

i[data-lucide] svg,
i[data-lucide] { display: inline-block; vertical-align: middle; }

.nav-icon i[data-lucide] svg { width: 16px; height: 16px; stroke-width: 2; }

.stat-icon i[data-lucide] svg { width: 18px; height: 18px; stroke-width: 1.75; }

.brand-icon i[data-lucide] svg { width: 28px; height: 28px; stroke-width: 1.5; color: var(--accent); }

.page-icon i[data-lucide] svg { width: 20px; height: 20px; stroke-width: 2; }

.empty-icon i[data-lucide] svg { width: 40px; height: 40px; stroke-width: 1.25; color: var(--border); }

.login-logo-icon i[data-lucide] svg { width: 40px; height: 40px; stroke-width: 1.5; color: var(--accent); }

.topbar-icon i[data-lucide] svg { width: 14px; height: 14px; stroke-width: 2; }

.btn-logout i[data-lucide] svg { width: 14px; height: 14px; }

.err-icon i[data-lucide] svg { width: 14px; height: 14px; }

.sidebar-brand {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand .brand-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  display: block;
  line-height: 1;
}

.sidebar-brand .brand-tag {
  font-size: .7rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: .3rem;
  display: block;
}

.sidebar-brand-icon {
  margin-bottom: .6rem;
  display: block;
  line-height: 1;
}

.sidebar-section {
  padding: 1.25rem .75rem .5rem;
}

.sidebar-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 0 .75rem;
  margin-bottom: .5rem;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav a.active {
  color: var(--accent);
  background: rgba(34,197,94,.1);
}

.sidebar-nav .nav-icon {
  font-size: 1.05rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 1rem .75rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  margin-bottom: .5rem;
}

.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .uname {
  font-size: .8rem;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  line-height: 1.2;
}

.sidebar-user .urole {
  font-size: .68rem;
  color: rgba(255,255,255,.4);
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .6rem .85rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.5);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.btn-logout:hover {
  background: rgba(239,68,68,.12);
  color: #fca5a5;
}

/* ── Main layout ──────────────────────────────────────────────────────────── */

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.topbar-meta {
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.75); }
}

.page-content {
  padding: 2rem;
  flex: 1;
}

/* ── Stat cards ───────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card.green::before  { background: var(--accent); }
.stat-card.gold::before   { background: var(--gold); }
.stat-card.blue::before   { background: var(--blue); }
.stat-card.purple::before { background: var(--purple); }
.stat-card.red::before    { background: var(--red); }

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.stat-card.green  .stat-icon { background: var(--accent-glow); }
.stat-card.gold   .stat-icon { background: var(--gold-bg); }
.stat-card.blue   .stat-icon { background: var(--blue-bg); }
.stat-card.purple .stat-icon { background: var(--purple-bg); }
.stat-card.red    .stat-icon { background: var(--red-bg); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -.03em;
}

.stat-value.small { font-size: 1.5rem; }

.stat-sub {
  font-size: .75rem;
  color: var(--muted);
}

.stat-sub .up   { color: var(--accent); font-weight: 600; }
.stat-sub .down { color: var(--red);    font-weight: 600; }

/* ── Charts row ──────────────────────────────────────────────────────────── */

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.chart-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.chart-subtitle {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .15rem;
}

.chart-toggle {
  display: flex;
  gap: .25rem;
  background: var(--bg);
  border-radius: 8px;
  padding: .2rem;
}

.chart-toggle button {
  border: none;
  background: none;
  padding: .3rem .65rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
}

.chart-toggle button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap-sm  { position: relative; height: 200px; }
.chart-wrap-bar { position: relative; height: 180px; }
.charts-row-spaced { margin-bottom: 1.75rem; }
.full-chart { grid-column: 1 / -1; }

.chart-wrap canvas { width: 100% !important; }

/* ── Bottom row: tables ───────────────────────────────────────────────────── */

.tables-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.25rem;
}

.table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.table-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}

.view-all {
  font-size: .75rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.view-all:hover { text-decoration: underline; }

/* ── Data table ───────────────────────────────────────────────────────────── */

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

.data-table th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  background: #fafcfb;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f3f7f4;
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #f7fbf8; }

.ref-code {
  font-family: "Courier New", monospace;
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}

.donor-name {
  font-weight: 600;
  color: var(--text);
}

.donor-phone {
  font-size: .72rem;
  color: var(--muted);
}

.amount-cell {
  font-weight: 700;
  font-size: .88rem;
}

/* ── Status badges ───────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.badge.paid       { background: #dcfce7; color: #15803d; }
.badge.paid .badge-dot       { background: #15803d; }
.badge.pending    { background: #fef9c3; color: #a16207; }
.badge.pending .badge-dot    { background: #a16207; }
.badge.failed     { background: #fee2e2; color: #b91c1c; }
.badge.failed .badge-dot     { background: #b91c1c; }
.badge.cancelled  { background: #f1f5f9; color: #475569; }
.badge.cancelled .badge-dot  { background: #475569; }

/* ── Top donors list ─────────────────────────────────────────────────────── */

.donor-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid #f3f7f4;
}

.donor-row:last-child { border-bottom: none; }

.donor-rank {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
}

.donor-rank.top { background: var(--gold-bg); color: var(--gold); }

.donor-info { flex: 1; min-width: 0; }

.donor-info .name {
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donor-info .meta {
  font-size: .7rem;
  color: var(--muted);
}

.donor-total {
  font-weight: 800;
  font-size: .9rem;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Monthly bar chart area ───────────────────────────────────────────────── */

.monthly-card { grid-column: 1 / -1; }

/* ── Full-page table view ────────────────────────────────────────────────── */

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

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.search-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.search-bar input {
  padding: .55rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  background: var(--card);
  color: var(--text);
  width: 260px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar select {
  padding: .55rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.search-bar button {
  padding: .55rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.search-bar button:hover { background: #16a34a; }

.full-table-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: auto;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  display: block;
  opacity: .4;
}

/* ── Login page ───────────────────────────────────────────────────────────── */

.login-body {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-bg-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-bg-art span {
  position: absolute;
  border-radius: 50%;
  opacity: .07;
  background: var(--accent);
}

.login-bubble-1 { width: 400px; height: 400px; top: -100px;  left: -100px; }
.login-bubble-2 { width: 300px; height: 300px; bottom: -80px; right: -80px; }
.login-bubble-3 { width: 180px; height: 180px; top: 40%;     left: 60%;    }

.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  position: relative;
  z-index: 1;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

/* Real logo image — matches homepage header */
.login-logo-img {
  height: 64px;
  width: auto;
  margin-bottom: .75rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--sidebar-bg);
  letter-spacing: -.5px;
  margin-bottom: .2rem;
}

.login-brand p {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .2rem;
}

/* "Back to main site" link */
.login-back-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .78rem;
}
.login-back-link a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}
.login-back-link a:hover { color: var(--sidebar-bg); }

.login-field {
  margin-bottom: 1.1rem;
}

.login-field label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.login-field input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.login-error {
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .82rem;
  color: var(--red);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.btn-login {
  width: 100%;
  padding: .85rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: .5rem;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  letter-spacing: .02em;
}

.btn-login:hover {
  background: #16a34a;
  box-shadow: 0 4px 16px rgba(34,197,94,.3);
}

.btn-login:active { transform: translateY(1px); }

/* ── Page header helpers ─────────────────────────────────────────────────── */

.page-heading {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.page-count {
  font-size: .8rem;
  font-weight: 400;
  color: var(--muted);
}

.clear-link {
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
}

.clear-link:hover { color: var(--red); }

/* ── Table cell helpers ───────────────────────────────────────────────────── */

.mono-cell     { font-family: "Courier New", monospace; font-size: .8rem; }
.muted-cell    { color: var(--muted); font-size: .8rem; }
.accent-cell   { color: var(--accent); }
.currency-cell { color: var(--muted); font-size: .78rem; font-weight: 600; }
.date-cell     { color: var(--muted); font-size: .75rem; white-space: nowrap; }

/* ── Donut legend ────────────────────────────────────────────────────────── */

.donut-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .75rem;
  font-size: .72rem;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-dot.paid      { background: #22c55e; }
.legend-dot.pending   { background: #f59e0b; }
.legend-dot.failed    { background: #ef4444; }
.legend-dot.cancelled { background: #94a3b8; }

/* ── Sidebar logo ─────────────────────────────────────────────────────────── */

.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1.4rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

/* Gold accent bar below brand (matches homepage's teal+gold palette) */
.sidebar-brand::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 4px; height: 100%;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  opacity: 0;  /* decorative — hidden for now; enable if desired */
}

/* ── Active nav: gold accent for brand consistency ─────────────────────────── */

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(232,177,62,.12);
  color: var(--accent);
}

/* ── Stat card accent adjustments ────────────────────────────────────────────  */

.stat-card.green::before  { background: var(--green); }
.stat-card.gold::before   { background: var(--gold); }

/* ── Login btn — brand teal ──────────────────────────────────────────────── */

.btn-login { background: var(--sidebar-bg); color: #fff; }
.btn-login:hover {
  background: var(--sidebar-hover);
  box-shadow: 0 4px 16px rgba(26,77,78,.4);
}

/* ── Blog post status pills ───────────────────────────────────────────────── */

.status-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .68rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.status-pill.published { background: #dcfce7; color: #15803d; }
.status-pill.draft     { background: #fef9c3; color: #a16207; }

/* ── Blog editor — layout helpers ───────────────────────────────────────── */

.editor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}

.editor-writer-note { font-size: .78rem; color: var(--muted); }

.editor-error-banner { margin-bottom: 1rem; }

.editor-title-wrap { margin-bottom: 1.1rem; }

.editor-content-error { margin-top: .4rem; }

.editor-meta-section { margin-bottom: 1rem; }

/* "Remove current image" label inside the meta panel */
.clear-thumb-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; margin-top: .4rem;
  text-transform: none; letter-spacing: 0;
  cursor: pointer; font-weight: 400; color: var(--text);
}

/* File input (thumbnail upload) */
.file-input-block { margin-top: .5rem; font-size: .8rem; width: 100%; }

/* Excerpt helper text */
.excerpt-label-note { font-weight: 400; opacity: .6; }
.excerpt-hint { font-size: .7rem; color: var(--muted); margin-top: .25rem; }

/* Post info sidebar block */
.post-info { font-size: .78rem; color: var(--muted); line-height: 1.8; }
.post-info-view { margin-top: .5rem; }
.post-info-link {
  color: var(--sidebar-bg); font-size: .78rem; font-weight: 600; text-decoration: none;
}
.post-info-link:hover { text-decoration: underline; }

/* ── Blog editor ─────────────────────────────────────────────────────────── */

.editor-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.editor-toolbar {
  border-bottom: 1px solid var(--border);
  background: #fafcfb;
}

.editor-body { min-height: 380px; font-size: .95rem; line-height: 1.7; }

.editor-meta {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.editor-meta label {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: .4rem;
}

.editor-meta input[type="text"],
.editor-meta textarea,
.editor-meta select {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem; color: var(--text);
  background: var(--bg);
  transition: border-color var(--transition);
}

.editor-meta input:focus,
.editor-meta textarea:focus,
.editor-meta select:focus {
  outline: none;
  border-color: var(--sidebar-bg);
  box-shadow: 0 0 0 3px rgba(26,77,78,.1);
  background: #fff;
}

.editor-meta textarea { resize: vertical; min-height: 80px; }

.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.25rem;
  align-items: start;
}

.thumbnail-preview {
  width: 100%; aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
  margin-bottom: .5rem;
  display: none;
}

.thumbnail-preview.visible { display: block; }

.radio-group { display: flex; gap: 1rem; margin-top: .25rem; }
.radio-group label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 500;
  color: var(--text); text-transform: none; letter-spacing: 0;
  cursor: pointer;
}
.radio-group input[type="radio"] { accent-color: var(--sidebar-bg); }

.editor-actions {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding-top: 1rem;
}

.btn-save {
  padding: .65rem 1.5rem;
  background: var(--sidebar-bg); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 700; cursor: pointer;
  transition: background var(--transition);
}
.btn-save:hover { background: var(--sidebar-hover); }

.btn-ghost {
  padding: .65rem 1.25rem;
  background: none; color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--text); color: var(--text); }

.btn-danger {
  padding: .5rem 1rem;
  background: var(--red-bg); color: var(--red);
  border: 1px solid rgba(179,65,61,.25);
  border-radius: var(--radius-sm);
  font-size: .8rem; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: .35rem;
  transition: background var(--transition);
}
.btn-danger:hover { background: var(--red); color: #fff; }

/* ── Blog post cards (dashboard list) ───────────────────────────────────── */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.blog-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex; flex-direction: column;
}

.blog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.blog-card-thumb {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; display: block;
}

.blog-card-thumb-placeholder {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1a4d4e 0%, #25636a 100%);
  display: flex; align-items: center; justify-content: center;
}

.blog-card-thumb-placeholder svg {
  width: 40px; height: 40px; color: rgba(255,255,255,.3);
}

.blog-card-body { padding: 1.1rem 1.25rem; flex: 1; display: flex; flex-direction: column; }

.blog-card-title {
  font-size: .95rem; font-weight: 700;
  color: var(--text); margin-bottom: .4rem; line-height: 1.4;
}

.blog-card-excerpt {
  font-size: .8rem; color: var(--muted);
  line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.blog-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: .85rem; padding-top: .75rem;
  border-top: 1px solid #f3f7f4;
  font-size: .72rem; color: var(--muted);
}

.blog-card-actions {
  display: flex; gap: .5rem; align-items: center;
}

.btn-edit-sm {
  padding: .3rem .75rem; background: var(--sidebar-bg); color: #fff;
  border: none; border-radius: 6px; font-size: .72rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition);
}
.btn-edit-sm:hover { background: var(--sidebar-hover); }

/* ── User management table ───────────────────────────────────────────────── */

.role-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.role-badge.admin   { background: rgba(26,77,78,.12); color: var(--sidebar-bg); }
.role-badge.manager { background: var(--gold-bg);     color: #8a5f00; }
.role-badge.writer  { background: var(--blue-bg);     color: #1d4ed8; }

.btn-add {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.25rem;
  background: var(--sidebar-bg); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 700; cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
}
.btn-add:hover { background: var(--sidebar-hover); }

/* ── PWA install modal ───────────────────────────────────────────────────── */

.pwa-modal-hidden { display: none !important; }

.pwa-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}

.pwa-modal-card {
  background: var(--card);
  border-radius: 20px;
  padding: 2rem;
  max-width: 380px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}

.pwa-logo {
  height: 64px;
  width: auto;
  margin-bottom: 1rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.pwa-modal-card h3 { font-size: 1.15rem; font-weight: 800; color: var(--text); margin-bottom: .5rem; }
.pwa-modal-card p  { font-size: .85rem; color: var(--muted); line-height: 1.5; margin-bottom: 1.5rem; }

.pwa-modal-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

.pwa-btn-install {
  padding: .7rem 1.5rem; background: var(--sidebar-bg); color: #fff;
  border: none; border-radius: 10px; font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: background var(--transition);
}
.pwa-btn-install:hover { background: var(--sidebar-hover); }

.pwa-btn-dismiss {
  padding: .7rem 1.25rem; background: none; color: var(--muted);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.pwa-btn-dismiss:hover { border-color: var(--text); color: var(--text); }

.pwa-instructions {
  display: none;
  flex-direction: column;
  gap: .5rem;
  text-align: left;
}

.pwa-tip-hidden { display: none; }

.pwa-btn-spaced { margin-top: .5rem; }

.pwa-instruction-item {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.5;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: .6rem .85rem;
}

/* ── Narrow single-column form (password change, etc.) ───────────────────── */

.narrow-form { max-width: 460px; }

.form-field    { margin-bottom: 1rem; }
.form-field-lg { margin-bottom: 1.5rem; }

.label-note { font-weight: 400; opacity: .6; }

.alert-success {
  background: #dcfce7; color: #15803d;
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex; align-items: center; gap: .5rem;
  font-size: .85rem; font-weight: 600;
}

/* ── Error / validation in forms ─────────────────────────────────────────── */

.field-error {
  font-size: .78rem; color: var(--red);
  margin-top: .3rem; display: flex; align-items: center; gap: .3rem;
}

/* ── Settings / generic form inputs ─────────────────────────────────────── */

.settings-input {
  display: block; width: 100%; margin-top: .35rem;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text);
  font-size: .9rem; font-family: inherit;
  transition: border-color var(--transition);
}
.settings-input:focus { outline: none; border-color: var(--sidebar-bg); }

.settings-fields { display: grid; gap: 1.1rem; }
.settings-fields label { font-size: .85rem; font-weight: 600; color: var(--text); }

.card-header-row { margin-bottom: 1rem; }
.card-section-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .charts-row        { grid-template-columns: 1fr; }
  .tables-row        { grid-template-columns: 1fr; }
  .editor-layout     { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 1.25rem; }
  .blog-grid { grid-template-columns: 1fr; }
}
