/* ============================================================
   Self Help Africa Malawi — Procurement Tracker
   Custom Stylesheet v2.0
   ============================================================ */
/* NOTE: Inter font loaded via <link> in HTML head */

/* ---- CSS Variables ---- */
:root {
  --sha-green:         #2E7D32;
  --sha-green-dark:    #1B5E20;
  --sha-green-mid:     #388E3C;
  --sha-green-light:   #4CAF50;
  --sha-green-pale:    #E8F5E9;
  --sha-green-xpale:   #F1F8E9;
  --sha-orange:        #E65100;
  --sha-orange-light:  #FF8F00;
  --sha-yellow:        #F9A825;
  --sha-teal:          #00695C;

  /* Sidebar */
  --sha-sidebar-bg:    #0f1923;
  --sha-sidebar-w:     250px;
  --sha-sidebar-accent:#2E7D32;

  /* Layout */
  --sha-navbar-h:      60px;
  --sha-footer-h:      44px;

  /* Text */
  --sha-text:          #1a2535;
  --sha-text-muted:    #6c757d;
  --sha-text-light:    #9ca3af;

  /* Borders & Surfaces */
  --sha-border:        #e5e7eb;
  --sha-bg:            #f0f2f5;
  --sha-surface:       #ffffff;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-md:  0 4px 16px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg:  0 8px 30px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);
  --sha-card-shadow: var(--shadow-sm);

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;
}

/* ---- Base Reset ---- */
*, *::before, *::after { box-sizing: border-box; }

body.sha-body {
  background: var(--sha-bg);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  color: var(--sha-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.sha-navbar {
  background: var(--sha-sidebar-bg);
  height: var(--sha-navbar-h);
  box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 2px 12px rgba(0,0,0,.25);
  z-index: 1040;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.sha-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--sha-green), var(--sha-green-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(46,125,50,.4);
}

.sha-brand-name {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -.01em;
}

.sha-brand-sub {
  font-size: .65rem;
  color: rgba(255,255,255,.5);
  line-height: 1;
  letter-spacing: .02em;
}

.sha-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sha-green), var(--sha-green-light));
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}

/* Navbar buttons */
.sha-navbar .btn-outline-light {
  border-color: rgba(255,255,255,.15);
  color: rgba(255,255,255,.7);
  transition: all .2s;
}
.sha-navbar .btn-outline-light:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.3);
  color: #fff;
}

.sha-navbar .dropdown-menu {
  border: 1px solid var(--sha-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: .4rem;
  min-width: 200px;
}

.sha-navbar .dropdown-item {
  border-radius: var(--radius-sm);
  font-size: .84rem;
  padding: .45rem .75rem;
  color: var(--sha-text);
  transition: background .15s;
}
.sha-navbar .dropdown-item:hover { background: var(--sha-green-pale); color: var(--sha-green-dark); }
.sha-navbar .dropdown-item.text-danger:hover { background: #FFEBEE; }

.sha-navbar .dropdown-header {
  font-size: .82rem;
  color: var(--sha-text);
  font-weight: 600;
  padding: .4rem .75rem .2rem;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sha-sidebar {
  position: fixed;
  top: var(--sha-navbar-h);
  left: 0;
  width: var(--sha-sidebar-w);
  height: calc(100vh - var(--sha-navbar-h));
  background: var(--sha-sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid rgba(255,255,255,.04);
}

.sha-sidebar::-webkit-scrollbar { width: 4px; }
.sha-sidebar::-webkit-scrollbar-track { background: transparent; }
.sha-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }
.sha-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.15); }

.sha-sidebar-inner { padding: 1rem 0 2rem; }
.sha-sidenav { display: flex; flex-direction: column; }

/* Section labels */
.sha-nav-section {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 1.25rem 1.25rem .35rem;
  margin-top: .25rem;
}

/* Nav links */
.sha-nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem 1.25rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: .83rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .18s ease;
  position: relative;
  margin: 1px .5rem;
  border-radius: var(--radius-sm);
  border-left: none;
}

.sha-nav-link:hover {
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.06);
}

.sha-nav-link.active {
  color: #fff;
  background: rgba(46,125,50,.25);
  box-shadow: inset 3px 0 0 var(--sha-green-light);
}

.sha-nav-link.active i { color: var(--sha-green-light); }

.sha-nav-link i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}

.sha-nav-link:hover i { opacity: 1; }

/* Sidebar version tag at bottom */
.sha-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: .5rem;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.sha-main {
  margin-left: var(--sha-sidebar-w);
  margin-top: var(--sha-navbar-h);
  min-height: calc(100vh - var(--sha-navbar-h) - var(--sha-footer-h));
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

.sha-content {
  padding-bottom: 2.5rem;
}

/* ---- Footer ---- */
.sha-footer {
  margin-left: var(--sha-sidebar-w);
  height: var(--sha-footer-h);
  background: var(--sha-surface);
  border-top: 1px solid var(--sha-border);
  display: flex;
  align-items: center;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}

/* ---- Mobile Sidebar ---- */
@media (max-width: 991.98px) {
  .sha-sidebar { transform: translateX(-100%); }
  .sha-sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sha-main, .sha-footer { margin-left: 0; }
}

/* ============================================================
   CARDS
   ============================================================ */
.sha-card {
  background: var(--sha-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--sha-border);
  overflow: hidden;
  transition: box-shadow .2s;
}

.sha-card:hover {
  box-shadow: var(--shadow-md);
}

.sha-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sha-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  background: #fafbfc;
}

.sha-card-body {
  padding: 1.25rem;
}

/* ============================================================
   KPI TILES
   ============================================================ */
.kpi-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.kpi-tile {
  background: var(--sha-surface);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.3rem 1.1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--sha-border);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  cursor: default;
}

.kpi-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Top accent stripe */
.kpi-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--kpi-color, var(--sha-green));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* Decorative background circle */
.kpi-tile::after {
  content: '';
  position: absolute;
  right: -12px;
  top: -12px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--kpi-color, var(--sha-green));
  opacity: .05;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--kpi-bg, var(--sha-green-pale));
  color: var(--kpi-color, var(--sha-green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .75rem;
  position: relative;
  z-index: 1;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--sha-text);
  line-height: 1;
  margin-bottom: .3rem;
  letter-spacing: -.02em;
  position: relative;
  z-index: 1;
}

.kpi-label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--sha-text);
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.kpi-sub {
  font-size: .7rem;
  color: var(--sha-text-muted);
  margin-top: .15rem;
  display: block;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  padding: 1.25rem 0 0;
}

.page-header-left h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--sha-text);
  margin: 0 0 .25rem;
  letter-spacing: -.02em;
}

.page-header-left .breadcrumb {
  font-size: .78rem;
  margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--sha-text-light);
}

.breadcrumb-item.active {
  color: var(--sha-text-muted);
}

.breadcrumb-item a {
  color: var(--sha-green);
  text-decoration: none;
}
.breadcrumb-item a:hover { text-decoration: underline; }

/* ============================================================
   TABLES
   ============================================================ */
.sha-table {
  font-size: .83rem;
  color: var(--sha-text);
}

.sha-table thead tr {
  background: transparent;
}

.sha-table th {
  font-size: .71rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sha-text-muted);
  background: #f7f8fa;
  padding: .65rem 1rem;
  border-bottom: 2px solid var(--sha-border);
  white-space: nowrap;
}

.sha-table td {
  vertical-align: middle;
  padding: .7rem 1rem;
  border-bottom: 1px solid #f0f2f5;
  color: var(--sha-text);
}

.sha-table tbody tr:last-child td { border-bottom: none; }

.sha-table tbody tr:hover td {
  background: #fafbff;
}

/* Table within card flush */
.sha-card .table-responsive {
  border-radius: 0;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .32em .65em;
  border-radius: 4px;
  letter-spacing: .02em;
}

/* Status badge variants */
.badge.bg-light { background: #f0f2f5 !important; color: #495057 !important; border: 1px solid #dee2e6; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-weight: 500;
  font-size: .84rem;
  border-radius: var(--radius-sm);
  transition: all .18s ease;
}

.btn-primary {
  background: var(--sha-green);
  border-color: var(--sha-green);
  box-shadow: 0 2px 6px rgba(46,125,50,.3);
}
.btn-primary:hover {
  background: var(--sha-green-dark);
  border-color: var(--sha-green-dark);
  box-shadow: 0 4px 12px rgba(46,125,50,.35);
}

.btn-outline-secondary {
  border-color: var(--sha-border);
  color: var(--sha-text-muted);
}
.btn-outline-secondary:hover {
  background: #f0f2f5;
  border-color: #c9cfd6;
  color: var(--sha-text);
}

.btn-sm {
  font-size: .78rem;
  padding: .3rem .7rem;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  border-color: var(--sha-border);
  border-radius: var(--radius-sm);
  font-size: .84rem;
  color: var(--sha-text);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--sha-green);
  box-shadow: 0 0 0 3px rgba(46,125,50,.12);
}

.form-label {
  font-size: .82rem;
  color: var(--sha-text);
  margin-bottom: .35rem;
}

.form-text {
  font-size: .75rem;
  color: var(--sha-text-muted);
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--sha-surface);
  border-radius: var(--radius-md);
  padding: .8rem 1.1rem;
  border: 1px solid var(--sha-border);
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  box-shadow: var(--shadow-xs);
}

/* ============================================================
   STATUS TIMELINE
   ============================================================ */
.pr-timeline { position: relative; padding-left: 28px; }
.pr-timeline::before {
  content: '';
  position: absolute; left: 10px; top: 0; bottom: 0;
  width: 2px; background: var(--sha-border);
}
.timeline-item { position: relative; margin-bottom: 1rem; }
.timeline-dot {
  position: absolute; left: -22px; top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--sha-border);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--sha-border);
}
.timeline-dot.active  { background: var(--sha-green); box-shadow: 0 0 0 3px rgba(46,125,50,.2); }
.timeline-dot.done    { background: #6c757d; box-shadow: 0 0 0 2px #dee2e6; }
.timeline-dot.stalled { background: #dc3545; box-shadow: 0 0 0 3px rgba(220,53,69,.2); }

/* ============================================================
   WORKFLOW STEPS
   ============================================================ */
.workflow-steps {
  display: flex; align-items: center;
  overflow-x: auto; padding: .5rem 0; gap: 0;
}
.workflow-step {
  display: flex; align-items: center; flex-shrink: 0;
  font-size: .67rem; color: #adb5bd; gap: 0;
}
.workflow-step-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #dee2e6; flex-shrink: 0;
  transition: all .2s;
}
.workflow-step-dot.done   { background: var(--sha-green); }
.workflow-step-dot.active { background: #0d6efd; box-shadow: 0 0 0 3px rgba(13,110,253,.2); }
.workflow-step-dot.stall  { background: #dc3545; }
.workflow-step-line { width: 28px; height: 2px; background: #dee2e6; flex-shrink: 0; }
.workflow-step-line.done { background: var(--sha-green); }
.workflow-step-label { display: none; }

/* ============================================================
   ALERT ITEMS
   ============================================================ */
.sha-alert-item {
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--sha-green);
  background: var(--sha-green-pale);
  margin-bottom: .5rem;
  font-size: .82rem;
  transition: background .15s;
}
.sha-alert-item:hover { background: #dcedc8; }
.sha-alert-item.warning { border-color: var(--sha-yellow); background: #FFF9C4; }
.sha-alert-item.warning:hover { background: #fff176; }
.sha-alert-item.danger  { border-color: #dc3545; background: #FFEBEE; }
.sha-alert-item.danger:hover  { background: #ffcdd2; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress {
  border-radius: 99px;
  background: #e9ecef;
}
.progress-bar {
  border-radius: 99px;
  transition: width .4s ease;
}

/* ============================================================
   NAV TABS
   ============================================================ */
.nav-tabs {
  border-bottom: 2px solid var(--sha-border);
  gap: .25rem;
}
.nav-tabs .nav-link {
  color: var(--sha-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: .84rem;
  font-weight: 500;
  padding: .6rem .9rem;
  margin-bottom: -2px;
  transition: all .15s;
}
.nav-tabs .nav-link:hover {
  color: var(--sha-text);
  background: rgba(0,0,0,.03);
  border-bottom-color: #c9cfd6;
}
.nav-tabs .nav-link.active {
  color: var(--sha-green);
  border-bottom-color: var(--sha-green);
  font-weight: 600;
  background: transparent;
}

/* ============================================================
   ALERTS (Bootstrap alerts)
   ============================================================ */
.alert {
  border-radius: var(--radius-md);
  font-size: .84rem;
  border-left-width: 4px;
}
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-danger   { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warning  { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.alert-info     { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(76,175,80,.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(27,94,32,.2) 0%, transparent 50%),
    linear-gradient(135deg, #0d1f10 0%, #1a3520 40%, #1B5E20 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--sha-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 80px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.2);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}

.login-header {
  background: linear-gradient(135deg, #1a3520, var(--sha-green));
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.login-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1.2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2);
}

.login-body {
  padding: 2rem 2.25rem 2.5rem;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination .page-link {
  font-size: .8rem;
  padding: .35rem .65rem;
  color: var(--sha-text);
  border-color: var(--sha-border);
  border-radius: var(--radius-sm) !important;
  margin: 0 1px;
}
.pagination .page-link:hover {
  background: var(--sha-green-pale);
  color: var(--sha-green);
  border-color: var(--sha-green);
}
.pagination .page-item.active .page-link {
  background: var(--sha-green);
  border-color: var(--sha-green);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--sha-border);
  padding: 1rem 1.25rem;
  background: #fafbfc;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-title { font-size: .95rem; font-weight: 700; color: var(--sha-text); }
.modal-footer { border-top: 1px solid var(--sha-border); padding: .75rem 1.25rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 575.98px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 1.2rem; }
  .sha-content { padding-left: .75rem !important; padding-right: .75rem !important; }
}

@media (max-width: 767.98px) {
  .page-header { margin-bottom: 1.25rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-sha-green  { color: var(--sha-green) !important; }
.bg-sha-green    { background: var(--sha-green) !important; }
.bg-sha-pale     { background: var(--sha-green-pale) !important; }
.border-sha      { border-color: var(--sha-green) !important; }
.fw-500          { font-weight: 500; }
.fw-600          { font-weight: 600; }
.fw-700          { font-weight: 700; }
.fw-800          { font-weight: 800; }
.fs-xs           { font-size: .75rem; }
.fs-sm           { font-size: .82rem; }
.gap-05          { gap: .5rem; }
.cursor-pointer  { cursor: pointer; }
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Divider with label */
.divider-label {
  display: flex; align-items: center; gap: .75rem;
  color: var(--sha-text-muted); font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; margin: 1.25rem 0 .75rem;
}
.divider-label::before, .divider-label::after {
  content: ''; flex: 1; height: 1px; background: var(--sha-border);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--sha-text-muted);
}
.empty-state i {
  font-size: 3rem;
  opacity: .25;
  display: block;
  margin-bottom: 1rem;
}
.empty-state p { font-size: .9rem; margin: 0; }

/* Stat mini card used inline */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--sha-green-pale);
  color: var(--sha-green-dark);
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sha-sidebar, .sha-navbar, .sha-footer { display: none !important; }
  .sha-main { margin-left: 0 !important; margin-top: 0 !important; }
  .sha-card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
}
