/* =========================================
   THARAKA WOMEN'S WELFARE PROGRAM
   Brand CSS — white-background logo colors
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --magenta:      #c9219e;   /* exact logo magenta */
  --magenta-dark: #9a1878;
  --magenta-light:#e040b8;
  --gold:         #e8c820;   /* logo yellow-gold sun */
  --gold-dark:    #b89a10;
  --gold-light:   #f5e060;
  --white:        #ffffff;
  --surface:      #ffffff;
  --surface-2:    #fdf4fb;   /* faintest pink tint */
  --surface-3:    #f9eaf6;
  --border:       #f0d8ec;
  --text:         #2d1a28;   /* deep plum, not black */
  --text-muted:   #8a607e;
  --text-light:   #c4a0b8;
  --success:      #1fa86e;
  --warning:      #e8c820;
  --danger:       #c9219e;
  --info:         #7b3fba;
  --topbar-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(201,33,158,0.10);
  --shadow-md:    0 8px 40px rgba(201,33,158,0.18);
  --transition:   0.22s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
a { color: var(--magenta); text-decoration: none; }
a:hover { color: var(--magenta-dark); }

/* ── LOGIN PAGE ────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Magenta gradient — no black */
  background: linear-gradient(135deg, #f9d6f4 0%, #ffffff 50%, #fef9d6 100%);
  position: relative;
  overflow: hidden;
}

.login-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 55% at 15% 40%, rgba(201,33,158,0.18) 0%, transparent 65%),
    radial-gradient(ellipse 40% 45% at 85% 25%, rgba(232,200,32,0.20) 0%, transparent 65%);
  pointer-events: none;
}

/* Decorative blobs */
.login-wrap::after {
  content: '';
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(201,33,158,0.08);
  bottom: -80px; right: -80px;
  pointer-events: none;
}

.login-card {
  position: relative;
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(201,33,158,0.15), 0 4px 16px rgba(201,33,158,0.08);
  border: 1px solid rgba(201,33,158,0.12);
  animation: slideUp 0.55s cubic-bezier(.4,0,.2,1) both;
}

@keyframes slideUp {
  from { opacity:0; transform:translateY(28px); }
  to   { opacity:1; transform:translateY(0); }
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo-wrap img {
  width: 200px;
}
.login-tagline {
  font-size: 0.76rem;
  color: var(--text-muted);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 6px;
}
.login-title {
  font-size: 1.45rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 26px;
}
.login-title span { color: var(--magenta); }

/* ── FORM ELEMENTS ─────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(201,33,158,0.12);
}
.form-control::placeholder { color: var(--text-light); }

/* ── BUTTONS ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--magenta);
  color: #fff;
  width: 100%;
  padding: 13px;
  font-size: 1rem;
}
.btn-primary:hover {
  background: var(--magenta-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,33,158,0.32);
  color: #fff;
}
.btn-sm { padding: 7px 14px; font-size: 0.83rem; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--magenta);
  color: var(--magenta);
}
.btn-outline:hover { background: var(--magenta); color: #fff; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #178055; }
.btn-gold { background: var(--gold); color: var(--text); }
.btn-gold:hover { background: var(--gold-dark); color: #fff; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.alert-danger  { background: #fdeef8; color: #8a1870; border-left: 3px solid var(--magenta); }
.alert-success { background: #e8f7ef; color: #155e3a; border-left: 3px solid var(--success); }

/* ── APP SHELL ─────────────────────────── */
.app-wrap { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOP NAV BAR — magenta, not black ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--magenta);           /* ← MAGENTA topbar */
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 3px 20px rgba(201,33,158,0.30);
  gap: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar-brand img {
  height: 42px;
  /* white-bg logo — show on magenta bar with brightness filter */
  filter: brightness(0) invert(1);
}
.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 0.92rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.topbar-brand-sub {
  font-size: 0.66rem;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Horizontal Nav */
.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 28px;
  flex: 1;
}
.topnav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.topnav-link:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.topnav-link.active {
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-weight: 600;
}
.topnav-link svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Dropdown */
.topnav-dropdown { position: relative; }
.topnav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 185px;
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--transition);
  z-index: 200;
  box-shadow: var(--shadow-md);
}
.topnav-dropdown:hover .topnav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.topnav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--text-muted);
  font-size: 0.87rem;
  text-decoration: none;
  transition: all var(--transition);
}
.topnav-dropdown-menu a:hover {
  background: var(--surface-3);
  color: var(--magenta);
}
.dropdown-arrow { margin-left: 4px; transition: transform var(--transition); }
.topnav-dropdown:hover .dropdown-arrow { transform: rotate(180deg); }

/* Right side topbar */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 6px;
  border-radius: 40px;
  background: rgba(255,255,255,0.20);
  color: #fff;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.30);
}
.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  color: var(--magenta);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.topbar-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.topbar-logout:hover {
  background: rgba(255,255,255,0.28);
  color: #fff;
}

/* ── MAIN CONTENT ──────────────────────── */
.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.page-header { margin-bottom: 26px; }
.page-header h1 { font-size: 1.7rem; color: var(--text); }
.page-header p  { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--magenta); }
.breadcrumb-sep { color: var(--text-light); }

/* ── STAT CARDS ────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-accent, var(--magenta));
  border-radius: 4px 4px 0 0;
}
.stat-card.gold    { --card-accent: var(--gold); }
.stat-card.success { --card-accent: var(--success); }
.stat-card.info    { --card-accent: var(--info); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: rgba(201,33,158,0.08);
  color: var(--magenta);
}
.stat-card.gold .stat-icon    { background: rgba(232,200,32,0.14); color: var(--gold-dark); }
.stat-card.success .stat-icon { background: rgba(31,168,110,0.10); color: var(--success); }
.stat-card.info .stat-icon    { background: rgba(123,63,186,0.10); color: var(--info); }

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.77rem;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 20px;
}
.stat-change.up   { background: rgba(31,168,110,0.10); color: var(--success); }
.stat-change.down { background: rgba(201,33,158,0.08); color: var(--magenta); }

/* ── CARDS ─────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-header h3 { font-size: 1rem; color: var(--text); }
.card-body { padding: 22px; }

/* ── TABLE ─────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead tr { background: var(--surface-3); }
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--magenta);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 12px 16px; color: var(--text); }
tbody tr:last-child { border-bottom: none; }

/* ── BADGES ────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-success { background: rgba(31,168,110,0.12); color: #157a48; }
.badge-warning { background: rgba(232,200,32,0.20); color: #8a7000; }
.badge-danger  { background: rgba(201,33,158,0.10); color: var(--magenta-dark); }
.badge-info    { background: rgba(123,63,186,0.10); color: var(--info); }

/* ── FORM (general) ────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-select {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.93rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a607e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-select:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px rgba(201,33,158,0.12);
}
textarea.form-control { resize: vertical; min-height: 86px; }

/* ── PAGINATION ────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: smaller;
  gap: 5px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { border-color: var(--magenta); color: var(--magenta); }
.page-btn.active { background: var(--magenta); border-color: var(--magenta); color: #fff; }

/* ── FOOTER — white, not black ─────────── */
.app-footer {
  padding: 14px 32px;
  background: var(--surface-3);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-footer span { color: var(--magenta); font-weight: 500; }

/* ── DASHBOARD GRID ────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ── RESPONSIVE ────────────────────────── */
@media (max-width: 900px) {
  .topnav { display: none; }
  .main-content { padding: 18px 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
}
