/* ============================================
   NIRA Foundation - Admin Panel CSS
   ============================================ */

:root {
  --bg: #0a1628;
  --bg-2: #0f2140;
  --bg-3: #16305c;
  --fg: #f1f5f9;
  --fg-muted: #94a3b8;
  --accent: #06b6d4;
  --accent-2: #22d3ee;
  --border: rgba(6, 182, 212, 0.18);
  --card: rgba(15, 33, 64, 0.85);
  --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
p { color: var(--fg-muted); line-height: 1.6; }
h1, h2, h3, h4, h5 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--fg); }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.admin-badge {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 0.75rem; color: white;
  flex-shrink: 0;
}
.sidebar-brand strong { font-family: 'Space Grotesk', sans-serif; font-size: 0.9rem; display: block; line-height: 1.2; }
.sidebar-brand small { color: var(--fg-muted); font-size: 0.7rem; }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: 10px;
  color: var(--fg-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 0.15rem;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.nav-item.active { background: rgba(6,182,212,0.12); color: var(--accent-2); }
.nav-badge {
  margin-left: auto;
  background: rgba(239,68,68,0.2);
  color: #f87171;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

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

.admin-topbar {
  background: rgba(10, 22, 40, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.05rem; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.admin-avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem; font-weight: 700; color: var(--accent-2);
  cursor: pointer;
}

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

/* ---- Dashboard Cards ---- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 2rem; }
@media (max-width: 1100px) { .metric-grid { grid-template-columns: 1fr 1fr; } }

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,0.1), transparent);
}
.metric-label { font-size: 0.8rem; color: var(--fg-muted); margin-bottom: 0.5rem; }
.metric-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 0.5rem;
}
.metric-trend { font-size: 0.75rem; color: var(--fg-muted); }
.metric-icon {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.15);
  display: flex; align-items: center; justify-content: center;
}
.metric-icon svg { width: 20px; height: 20px; color: var(--accent); }

/* ---- Admin Panels ---- */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.panel-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1rem; }
.panel-body { padding: 1.5rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, #06b6d4, #0891b2); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(6,182,212,0.3); color: white; }
.btn-secondary { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--fg-muted); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--fg); }
.btn-danger { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }
.btn-danger:hover { background: #ef4444; color: white; }
.btn-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.2); color: #34d399; }
.btn-success:hover { background: #10b981; color: white; }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--fg); margin-bottom: 0.4rem; }
.form-control {
  width: 100%;
  background: rgba(10,22,40,0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.875rem;
  color: var(--fg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(6,182,212,0.12); }
.form-control::placeholder { color: var(--fg-muted); }
select.form-control option { background: #0f2140; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.75rem; color: var(--fg-muted); margin-top: 0.25rem; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  background: rgba(6,182,212,0.06);
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.875rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.875rem 1rem; border-bottom: 1px solid rgba(6,182,212,0.04); color: var(--fg-muted); }
.data-table td:first-child { color: var(--fg); font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(6,182,212,0.03); }

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
}
.badge-green { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-amber { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-red { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-cyan { background: rgba(6,182,212,0.15); color: var(--accent-2); }
.badge-gray { background: rgba(148,163,184,0.1); color: var(--fg-muted); }

/* ---- Alert ---- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.625rem;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25); color: #34d399; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; }

/* ---- Rich Text Editor area ---- */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.75rem;
  background: rgba(10,22,40,0.8);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}
.editor-btn {
  padding: 0.4rem 0.625rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}
.editor-btn:hover { background: rgba(6,182,212,0.1); color: var(--accent-2); }
#postContent {
  border-radius: 0 0 8px 8px;
  min-height: 320px;
}

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(6,182,212,0.1), transparent),
    var(--bg);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(6,182,212,0.3); border-radius: 3px; }

/* ---- Utility ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--fg-muted); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.gap-sm { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
