/* public/css/app.css — BALID Donation Tracker */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --green:       #1a6b3c;
  --green-light: #2d9158;
  --green-pale:  #e8f5ee;
  --gold:        #c9a84c;
  --gold-light:  #f0d080;
  --dark:        #0f2018;
  --gray-900:    #1e2d26;
  --gray-700:    #374b3e;
  --gray-500:    #6b8070;
  --gray-200:    #d4e0d9;
  --gray-100:    #f0f5f2;
  --white:       #ffffff;
  --red:         #c0392b;
  --red-pale:    #fdecea;
  --shadow-sm:   0 1px 3px rgba(15,32,24,.08);
  --shadow:      0 4px 16px rgba(15,32,24,.12);
  --shadow-lg:   0 12px 40px rgba(15,32,24,.18);
  --radius:      10px;
  --radius-lg:   16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gray-100);
  color: var(--dark);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: 260px; height: 100vh;
  background: var(--dark);
  display: flex; flex-direction: column;
  z-index: 100;
  border-right: 1px solid rgba(201,168,76,.15);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand .brand-logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--green-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  color: white; font-size: 18px; font-weight: 700;
  margin-bottom: 10px;
}

.sidebar-brand h1 {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 18px;
  letter-spacing: .5px;
}

.sidebar-brand p {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
  padding: 10px 24px 4px;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 500;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 24px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all .2s;
  border-left: 3px solid transparent;
  position: relative;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,.05);
  border-left-color: rgba(201,168,76,.4);
}

.nav-item.active {
  color: var(--gold-light);
  background: rgba(201,168,76,.1);
  border-left-color: var(--gold);
  font-weight: 500;
}

.nav-item .nav-icon {
  font-size: 17px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.admin-pill {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.admin-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--green-light), var(--green));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 600;
  flex-shrink: 0;
}

.admin-info small { display: block; color: var(--gray-500); font-size: 11px; }
.admin-info strong { color: var(--white); font-size: 13px; }

.logout-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 9px;
  background: rgba(192,57,43,.15);
  color: #ff8a80;
  border: 1px solid rgba(192,57,43,.25);
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  transition: all .2s;
}

.logout-btn:hover {
  background: rgba(192,57,43,.3);
  color: #ffcdd2;
}

/* ── Main content ─────────────────────────────────────────── */
.main-wrap {
  margin-left: 260px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--dark);
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.badge-role {
  background: var(--green-pale);
  color: var(--green);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .5px;
}

.content-area { flex: 1; padding: 28px 32px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  color: var(--dark);
}

.card-body { padding: 24px; }

/* ── Stat cards ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--green);
}

.stat-card.gold::before { background: var(--gold); }
.stat-card.red::before  { background: var(--red); }
.stat-card.teal::before { background: #1a8a7a; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-icon.green { background: var(--green-pale); }
.stat-icon.gold  { background: #fef9e7; }
.stat-icon.red   { background: var(--red-pale); }
.stat-icon.teal  { background: #e8f5f4; }

.stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--dark); margin: 4px 0; font-family: 'Playfair Display', serif; }
.stat-sub   { font-size: 12px; color: var(--gray-500); }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: var(--gray-100);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 1px solid var(--gray-200);
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-100); }

.td-name { font-weight: 600; color: var(--dark); }
.td-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-paid    { background: var(--green-pale); color: var(--green); }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-active  { background: var(--green-pale); color: var(--green); }
.badge-inactive{ background: var(--red-pale); color: var(--red); }

/* ── Grid / Year view ─────────────────────────────────────── */
.year-grid { width: 100%; border-collapse: collapse; font-size: 12px; }
.year-grid th, .year-grid td { padding: 8px 6px; text-align: center; border: 1px solid var(--gray-200); }
.year-grid thead th { background: var(--dark); color: var(--gold-light); font-weight: 500; font-size: 11px; }
.year-grid tbody td:first-child { text-align: left; font-weight: 500; color: var(--dark); padding-left: 12px; min-width: 150px; }

.cell-paid   { background: #d4edda; color: #155724; font-weight: 600; cursor: pointer; }
.cell-unpaid { background: #fff3cd; color: #856404; cursor: pointer; }
.cell-paid:hover   { background: #b8dac4; }
.cell-unpaid:hover { background: #ffe399; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--dark);
  background: var(--white);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--green-light);
  box-shadow: 0 0 0 3px rgba(45,145,88,.12);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
}

.btn-primary   { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-light); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: #c4d4cb; }
.btn-gold      { background: var(--gold); color: var(--dark); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }
.btn-danger    { background: var(--red-pale); color: var(--red); }
.btn-danger:hover { background: #f9cec9; }
.btn-sm        { padding: 5px 12px; font-size: 12px; }
.btn-icon      { padding: 6px 10px; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
  border-left: 4px solid;
}

.alert-success { background: var(--green-pale); color: var(--green); border-color: var(--green); }
.alert-error   { background: var(--red-pale); color: var(--red); border-color: var(--red); }
.alert-info    { background: #e3f2fd; color: #1565c0; border-color: #1565c0; }

/* ── Filters row ──────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  background: var(--white);
  padding: 16px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin-bottom: 20px;
}

.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  color: var(--dark);
  background: var(--white);
  outline: none;
}

.filter-bar select:focus { border-color: var(--green-light); }

/* ── Progress bar ─────────────────────────────────────────── */
.progress {
  width: 100%; height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-light));
  border-radius: 3px;
  transition: width .5s ease;
}

/* ── Login page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--dark);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(26,107,60,.4) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(201,168,76,.15) 0%, transparent 50%);
}

.login-pattern {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,.015) 0, rgba(255,255,255,.015) 1px,
    transparent 1px, transparent 50%
  );
  background-size: 30px 30px;
}

.login-card {
  position: relative; z-index: 2;
  width: 420px;
  margin: auto;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 48px 44px;
  backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}

.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--gold), var(--green-light));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  color: white; font-size: 24px; font-weight: 700;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(201,168,76,.3);
}

.login-card h2 {
  font-family: 'Playfair Display', serif;
  color: var(--white);
  font-size: 26px;
  text-align: center;
  margin-bottom: 4px;
}

.login-card .subtitle {
  text-align: center;
  color: rgba(255,255,255,.45);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-card .form-label { color: rgba(255,255,255,.7); }

.login-card .form-control {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  color: var(--white);
  padding: 12px 14px;
}

.login-card .form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}

.login-card .form-control::placeholder { color: rgba(255,255,255,.25); }

.btn-login {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--gold), #b8912a);
  color: var(--dark);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
  cursor: pointer;
  margin-top: 8px;
  transition: all .2s;
  letter-spacing: .5px;
}

.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(201,168,76,.35); }

.login-footer {
  text-align: center;
  margin-top: 24px;
  color: rgba(255,255,255,.3);
  font-size: 12px;
}

/* ── Chart canvas wrapper ─────────────────────────────────── */
.chart-wrap { position: relative; height: 250px; }

/* ── Misc ─────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--dark);
}

.page-sub { color: var(--gray-500); font-size: 13px; margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-green { color: var(--green); }
.text-gold  { color: var(--gold); }
.text-red   { color: var(--red); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.empty-state { text-align: center; padding: 48px; color: var(--gray-500); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .main-wrap { margin-left: 200px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
