/* ============================================================
   SSCMS MEMBER PORTAL — SHARED PORTAL STYLES
   Used by: dashboard, contributions, loans, welfare,
            training, governance, profile, admin pages
   ============================================================ */

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

:root {
  --navy:       #000080;
  --navy-dark:  #000060;
  --navy-light: #3d3da0;
  --navy-faint: #f0f0ff;
  --gold:       #c9a84c;
  --gold-light: #f0d980;
  --gold-dim:   rgba(201,168,76,0.15);
  --white:      #ffffff;
  --off:        #f5f6fa;
  --gray-100:   #f0f0f5;
  --gray-200:   #e0e0ee;
  --gray-400:   #9999bb;
  --gray-600:   #555577;
  --text:       #1a1a2e;
  --green:      #1a7a4a;
  --green-bg:   #edfaf3;
  --red:        #c0392b;
  --red-bg:     #fff5f5;
  --amber:      #b7770d;
  --amber-bg:   #fffbea;
  --sidebar-w:  260px;
  --topbar-h:   64px;
  --radius:     12px;
  --radius-sm:  6px;
  --shadow:     0 2px 16px rgba(0,0,128,0.10);
  --shadow-lg:  0 6px 32px rgba(0,0,128,0.16);
  --transition: 0.22s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body.portal-body {
  font-family: 'Nunito', sans-serif;
  background: var(--off);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--navy);
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
}
.sidebar-brand-text { line-height: 1.25; }
.sidebar-brand-text strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
}
.sidebar-brand-text span {
  font-size: 0.68rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.sidebar-avatar {
  width: 38px; height: 38px; min-width: 38px;
  background: var(--gold-dim);
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--gold-light);
  font-weight: 700;
}
.sidebar-user-info strong {
  display: block;
  font-size: 0.85rem;
  color: var(--white);
  font-weight: 700;
}
.sidebar-user-info span {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 12px 20px 4px;
}

.sidebar-nav { flex: 1; padding: 0 10px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  transition: all var(--transition);
  margin-bottom: 2px;
}
.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}
.sidebar-nav a.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 700;
}
.sidebar-nav a.active i { color: var(--navy); }

.sidebar-nav a .badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 50px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  transition: color var(--transition);
}
.sidebar-footer a:hover { color: var(--white); }

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

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.topbar-subtitle { font-size: 0.78rem; color: var(--gray-400); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-btn {
  position: relative;
  width: 38px; height: 38px;
  background: var(--gray-100);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--gray-600);
  font-size: 1rem; transition: all var(--transition);
}
.topbar-btn:hover { background: var(--navy-faint); color: var(--navy); }
.topbar-btn .notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red); border-radius: 50%;
  border: 2px solid var(--white);
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.topbar-user-avatar {
  width: 36px; height: 36px;
  background: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-light); font-weight: 700; font-size: 0.9rem;
}
.topbar-user-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.topbar-user-role { font-size: 0.72rem; color: var(--gray-400); }

#sidebar-toggle {
  display: none;
  background: none; border: none;
  font-size: 1.3rem; cursor: pointer; color: var(--navy);
}

/* ── PAGE CONTENT ────────────────────────────────────────── */
.portal-content {
  padding: 28px;
  flex: 1;
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition);
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .sc-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
}
.stat-card .sc-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.stat-card .sc-sub {
  font-size: 0.78rem;
  color: var(--gray-400);
}
.stat-card .sc-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  align-self: flex-start;
  margin-bottom: 4px;
}
.sc-navy  .sc-icon { background: var(--navy-faint); color: var(--navy); }
.sc-gold  .sc-icon { background: var(--gold-dim);   color: var(--amber); }
.sc-green .sc-icon { background: var(--green-bg);   color: var(--green); }
.sc-red   .sc-icon { background: var(--red-bg);     color: var(--red); }

/* ── PANEL CARD ──────────────────────────────────────────── */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h3 {
  font-family: 'Ubuntu', sans-serif;
  font-weight: 700;
  font-size: 0.97rem;
  color: var(--navy);
  display: flex; align-items: center; gap: 10px;
}
.panel-head h3 i { color: var(--gold); }
.panel-body { padding: 22px; }
.panel-body.no-pad { padding: 0; }

/* ── TABLE ───────────────────────────────────────────────── */
.ptable { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ptable th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}
.ptable td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text);
  vertical-align: middle;
}
.ptable tr:last-child td { border-bottom: none; }
.ptable tr:hover td { background: var(--navy-faint); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-navy   { background: var(--navy-faint); color: var(--navy); }
.badge-gold   { background: var(--gold-dim);  color: #8a6a10; }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-wrap { margin-bottom: 6px; }
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--gray-600); margin-bottom: 5px;
}
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 50px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 50px;
  background: var(--navy);
  transition: width 0.6s ease;
}
.progress-fill.gold { background: var(--gold); }
.progress-fill.green { background: #1a7a4a; }

/* ── FORM ELEMENTS (portal forms) ───────────────────────── */
.pfield { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.pfield label {
  font-size: 0.77rem; font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pfield input, .pfield select, .pfield textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition);
}
.pfield input:focus, .pfield select:focus, .pfield textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,0,128,0.07);
}
.pform-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .pform-row { grid-template-columns: 1fr; } }

/* ── BUTTONS ─────────────────────────────────────────────── */
.pbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem; font-weight: 700;
  border: none; cursor: pointer;
  transition: all var(--transition);
}
.pbtn-primary { background: var(--navy); color: var(--white); }
.pbtn-primary:hover { background: var(--navy-dark); transform: translateY(-1px); }
.pbtn-gold { background: var(--gold); color: var(--navy); }
.pbtn-gold:hover { background: var(--gold-light); transform: translateY(-1px); }
.pbtn-outline { background: transparent; color: var(--navy); border: 2px solid var(--navy); }
.pbtn-outline:hover { background: var(--navy); color: var(--white); }
.pbtn-danger { background: var(--red-bg); color: var(--red); border: 2px solid #ffcdd2; }
.pbtn-danger:hover { background: var(--red); color: var(--white); }
.pbtn-sm { padding: 6px 14px; font-size: 0.8rem; }
.pbtn-full { width: 100%; justify-content: center; padding: 13px; }

/* ── ALERT MESSAGES ──────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 18px;
}
.alert i { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.alert-info    { background: var(--navy-faint); color: var(--navy); border: 1px solid var(--gray-200); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #c5e1a5; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border: 1px solid #ffe082; }
.alert-danger  { background: var(--red-bg); color: var(--red); border: 1px solid #ffcdd2; }

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.two-col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.three-col-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 900px) {
  .two-col-grid, .three-col-grid { grid-template-columns: 1fr; }
}

/* ── TIMELINE ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute;
  left: 7px; top: 0; bottom: 0;
  width: 2px; background: var(--gray-200);
}
.tl-item { position: relative; margin-bottom: 22px; }
.tl-dot {
  position: absolute;
  left: -28px; top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--navy);
}
.tl-dot.gold { background: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.tl-dot.green { background: var(--green); box-shadow: 0 0 0 2px var(--green); }
.tl-title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.tl-meta { font-size: 0.78rem; color: var(--gray-400); }

/* ── AVATAR STACK ────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  border: 2px solid var(--white);
  flex-shrink: 0;
}

/* ── MOBILE SIDEBAR TOGGLE ───────────────────────────────── */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .portal-main { margin-left: 0; }
  #sidebar-toggle { display: block; }
  .portal-content { padding: 18px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
}
