/* ─── RESET & BASE ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #e65100;
  --primary-light: #ff833a;
  --primary-dark: #ac1900;
  --primary-bg: #fff3e0;
  --secondary: #1b5e20;
  --secondary-light: #4c8c4a;
  --accent: #f57c00;
  --bg: #faf6f1;
  --bg-card: #ffffff;
  --text: #2d2418;
  --text-light: #6d5d4b;
  --text-muted: #9e8e7e;
  --border: #e8ddd0;
  --border-light: #f0e8dc;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #f9a825;
  --info: #0277bd;
  --shadow-sm: 0 1px 3px rgba(45,36,24,0.06);
  --shadow: 0 2px 12px rgba(45,36,24,0.08);
  --shadow-lg: 0 8px 30px rgba(45,36,24,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

html { font-size: 15px; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #2d1a0e 0%, #1a0f06 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header { padding: 24px 20px 20px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; letter-spacing: -0.5px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(230,81,0,0.3);
}
.logo-text h1 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.logo-text span { font-size: 12px; opacity: 0.6; font-weight: 400; }

.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 4px 12px rgba(230,81,0,0.25);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer { padding: 12px 20px 16px; }
.footer-badge {
  background: rgba(255,255,255,0.06);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 11px; text-align: center;
  color: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.06);
}
.astroc-sidebar-badge {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}
.astroc-sidebar-badge strong { color: rgba(255,255,255,0.6); letter-spacing: 0.5px; }
.astroc-logo-sm {
  width: 22px; height: 22px;
  border-radius: 5px;
  object-fit: cover;
}

/* ─── MAIN ────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 20px; font-weight: 700; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.greeting { font-size: 13px; color: var(--text-muted); }
.topbar-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-light);
}
.menu-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 4px;
}

.page-container { padding: 28px; flex: 1; }

/* ─── MAIN FOOTER (ASTROC) ────────────────────────────────── */
.main-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-card);
}
.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.heart-icon {
  animation: heartbeat 1.5s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}
.astroc-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg);
}
.astroc-footer-link:hover {
  background: var(--primary-bg);
  color: var(--primary);
}
.astroc-footer-link strong {
  font-size: 13px;
  letter-spacing: 1px;
}
.astroc-logo-footer {
  width: 22px; height: 22px;
  border-radius: 5px;
  object-fit: cover;
}

/* ─── STAT CARDS ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--success), #66bb6a); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--info), #42a5f5); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #7b1fa2, #ba68c8); }
.stat-card:nth-child(5)::before { background: linear-gradient(90deg, var(--warning), #fdd835); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ─── CARDS & PANELS ──────────────────────────────────────── */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h3 { font-size: 15px; font-weight: 700; }
.panel-body { padding: 16px 22px; }

/* ─── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
tbody tr:hover { background: var(--primary-bg); }
tbody tr:last-child td { border-bottom: none; }

/* ─── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 2px 8px rgba(230,81,0,0.2);
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(230,81,0,0.3); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: transparent; border: 1px solid var(--border);
  cursor: pointer; color: var(--text-light); transition: all 0.2s;
}
.btn-icon:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.btn-icon.danger:hover { background: #ffebee; color: var(--danger); border-color: var(--danger); }

/* ─── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230,81,0,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff8e1; color: #f57f17; }
.badge-info { background: #e1f5fe; color: var(--info); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }

/* ─── BIRTHDAY BANNER ─────────────────────────────────────── */
.birthday-banner {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 1px solid #ffcc80;
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.birthday-banner .emoji { font-size: 32px; }
.birthday-banner .text h4 { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.birthday-banner .text p { font-size: 13px; color: var(--text-light); margin-top: 2px; }

/* ─── LIST ITEMS ──────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.list-item-info { flex: 1; min-width: 0; }
.list-item-info .name { font-size: 14px; font-weight: 600; }
.list-item-info .sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.list-item-value { font-size: 14px; font-weight: 700; text-align: right; }

/* ─── SEARCH BAR ──────────────────────────────────────────── */
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 280px;
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none; outline: none; background: transparent;
  font-size: 14px; font-family: inherit; color: var(--text);
  flex: 1;
}

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-light); }
.empty-state p { font-size: 13px; margin-top: 4px; }

/* ─── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 90%; max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--bg);
  border-radius: 8px; cursor: pointer;
  font-size: 20px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: #ffebee; color: var(--danger); }
.modal-body { padding: 24px; }

/* ─── TOAST ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--success);
  font-size: 13px; font-weight: 500;
  animation: toastIn 0.3s ease;
  max-width: 360px;
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── SPINNER ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AMOUNT COLORS ───────────────────────────────────────── */
.amount { font-weight: 700; }
.amount.positive { color: var(--success); }
.amount.negative { color: var(--danger); }

/* ─── DONOR DETAIL CARD ──────────────────────────────────── */
.donor-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}
.donor-avatar-lg {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.donor-meta { flex: 1; }
.donor-meta h2 { font-size: 20px; font-weight: 700; }
.donor-meta p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.donor-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.donor-stat {
  background: var(--bg);
  padding: 14px;
  border-radius: var(--radius-sm);
  text-align: center;
}
.donor-stat .value { font-size: 20px; font-weight: 800; color: var(--primary); }
.donor-stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-top: 2px; }

/* ─── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .page-container { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar-title { font-size: 16px; }
  .topbar-logo { width: 28px; height: 28px; border-radius: 6px; }
  .greeting { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 22px; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
  .content-grid { grid-template-columns: 1fr; }
  .main-footer .footer-content { font-size: 12px; }
  .modal { width: 95%; max-width: 95%; border-radius: 12px; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
}
