/* ============================================================
   Church Management SaaS — Main Stylesheet
   Color palette inspired by GabrielSoft
   ============================================================ */

:root {
  --primary:       #1a3a6b;
  --primary-dark:  #122a52;
  --primary-light: #2a5298;
  --accent:        #e8a020;
  --accent-hover:  #d4911a;
  --success:       #28a745;
  --danger:        #dc3545;
  --warning:       #ffc107;
  --info:          #17a2b8;
  --white:         #ffffff;
  --light:         #f4f6fb;
  --border:        #e0e6ef;
  --text:          #2d3748;
  --text-muted:    #718096;
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        8px;
  --shadow:        0 2px 12px rgba(26,58,107,0.08);
  --shadow-md:     0 4px 24px rgba(26,58,107,0.13);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--light);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent    { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-success   { background: var(--success); color: var(--white); }
.btn-danger    { background: var(--danger); color: var(--white); }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn-lg        { padding: 12px 28px; font-size: 16px; }
.btn:disabled  { opacity: 0.6; cursor: not-allowed; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,107,0.1); }
.form-control.error { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
select.form-control { cursor: pointer; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
.card-body { padding: 20px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(26,58,107,0.1);  color: var(--primary); }
.stat-icon.green  { background: rgba(40,167,69,0.1);  color: var(--success); }
.stat-icon.orange { background: rgba(232,160,32,0.1); color: var(--accent); }
.stat-icon.red    { background: rgba(220,53,69,0.1);  color: var(--danger); }
.stat-icon.teal   { background: rgba(23,162,184,0.1); color: var(--info); }
.stat-info h3 { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-info p  { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--light);
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(26,58,107,0.02); }

/* ── 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: rgba(40,167,69,0.12);  color: #1a7a32; }
.badge-danger  { background: rgba(220,53,69,0.12);  color: #a71d2a; }
.badge-warning { background: rgba(255,193,7,0.15);  color: #856404; }
.badge-info    { background: rgba(23,162,184,0.12); color: #0c6674; }
.badge-primary { background: rgba(26,58,107,0.1);   color: var(--primary); }
.badge-muted   { background: var(--border);          color: var(--text-muted); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(40,167,69,0.1);  color: #155724; border-left: 4px solid var(--success); }
.alert-danger  { background: rgba(220,53,69,0.1);  color: #721c24; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(255,193,7,0.1);  color: #856404; border-left: 4px solid var(--warning); }
.alert-info    { background: rgba(23,162,184,0.1); color: #0c5460; border-left: 4px solid var(--info); }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo img { width: 36px; height: 36px; border-radius: 8px; }
.sidebar-logo-text { color: var(--white); }
.sidebar-logo-text h2 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar-logo-text span { font-size: 11px; opacity: 0.7; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.4); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 14px;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,0.12); color: var(--white); border-left-color: var(--accent); font-weight: 600; }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 16px; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.85);
}
.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 11px; opacity: 0.6; }
.sidebar-user .logout-btn { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; font-size: 16px; padding: 4px; }
.sidebar-user .logout-btn:hover { color: var(--white); }

/* ── Header ──────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 99;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 18px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }

/* ── Main Content ────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  padding: 24px;
  min-height: calc(100vh - var(--header-h));
}

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p  { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ── Search & Filters ────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--primary); }
.search-box .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { color: var(--text-muted); font-size: 13px; }
.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ── Loading ─────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-dark {
  border-color: rgba(26,58,107,0.2);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-weight: 500;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Toast Notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 80px; right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .header { left: 0; }
  .main { margin-left: 0; padding: 16px; }
  .menu-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Utilities ───────────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
