/* ============================================================
   DASHBOARD — KPI SYSTEM (PHASE 11A-2)
   File: /assets/css/dashboard/kpi.css

   PURPOSE
   ============================================================
   Consolidated KPI styling extracted from gf-dashboard-pages.css
   with strict conflict resolution. This is the authoritative source
   for all KPI card styling, insights, and metadata components.

   DEDUPLICATION NOTES
   ============================================================
   - DELETED: Lines 92-196 (first .gf-dashboard-kpis, 4 columns)
   - DELETED: Lines 426-480 (duplicate .gf-dashboard-kpis, 4 columns)
   - KEPT: Lines 701-721 (final .gf-dashboard-kpis, 5 columns) ← WINNER
   - KEPT: Lines 543-620 (.gf-kpi-insight and state variants)
   - KEPT: Lines 728-833+ (icon, value, delta, supporters metadata)
   - CONSOLIDATED .gf-kpi card from multiple definitions

   LAYOUT BREAKPOINTS
   ============================================================
   - Desktop (≥1024px): 5 columns
   - Tablet (768-1023px): 3 columns
   - Mobile (≤640px): 2 columns
============================================================ */


/* ============================================================
   KPI ROW — 5 COLUMN GRID (AUTHORITATIVE)
   Source: Lines 701-721 (final definition, lowest specificity win)
============================================================ */

.gf-dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin: 24px 0 28px;
  padding: 20px 24px;
  border: 1px solid rgba(124, 77, 255, 0.12);
  border-radius: 12px;
}

/* Tablet: 3 columns so 5 cards wrap as 3+2 */
@media (max-width: 1024px) {
  .gf-dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0 24px;
    padding: 18px 20px;
    border: 1px solid rgba(124, 77, 255, 0.12);
    border-radius: 12px;
  }
}

/* Mobile: 2 columns; Supporters card spans full width */
@media (max-width: 640px) {
  .gf-dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 22px;
    padding: 16px;
    border: 1px solid rgba(124, 77, 255, 0.12);
    border-radius: 12px;
  }

  .gf-kpi--wide {
    grid-column: 1 / -1;
  }
}


/* ============================================================
   KPI CARD — CONSOLIDATED DEFINITION
   Merged from lines 99-112, 120-130, 435-448
   Using the best styling from each variant
============================================================ */

.gf-kpi {
  display: flex;
  flex-direction: column;
  justify-content: center;

  min-height: 92px;
  padding: 16px 18px;

  background: #ffffff;
  border: 1px solid rgba(30, 20, 60, 0.06);
  border-radius: 14px;

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Hover lift effect */
.gf-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

/* Highlight first KPI card (withdrawable balance) */
.gf-kpi:first-child {
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Mobile: Smaller card */
@media (max-width: 640px) {
  .gf-kpi {
    min-height: 82px;
    padding: 14px 16px;
    border-radius: 12px;
  }
}


/* ============================================================
   KPI LABEL
   Card title/description
============================================================ */

.gf-kpi-label {
  display: block;
  font-size: 12px;
  line-height: 1.2;
  color: rgba(47, 47, 58, 0.72);
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .gf-kpi-label {
    font-size: 11.5px;
    margin-bottom: 6px;
  }
}


/* ============================================================
   KPI VALUE
   Primary metric number
============================================================ */

.gf-kpi-value {
  display: block;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 700;
  color: #8A5CFF;
  letter-spacing: -0.01em;
}

@media (max-width: 640px) {
  .gf-kpi-value {
    font-size: 18px;
  }
}


/* ============================================================
   KPI VALUE — LARGE VARIANT
   Used for Lifetime metrics
   Source: Lines 747-749
============================================================ */

.gf-kpi-value--large {
  font-size: clamp(18px, 2.2vw, 26px);
}


/* ============================================================
   KPI SUB TEXT
   Secondary metric or unit
============================================================ */

.gf-kpi-sub {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(138, 92, 255, 0.7);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .gf-kpi-sub {
    display: block;
    margin-left: 0;
    margin-top: 4px;
    font-size: 11px;
  }
}


/* ============================================================
   KPI ICON
   Emoji or symbol above the metric
   Source: Lines 728-740
============================================================ */

.gf-kpi-icon {
  display: block;
  font-size: 18px;
  line-height: 1;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .gf-kpi-icon {
    font-size: 16px;
    margin-bottom: 6px;
  }
}


/* ============================================================
   KPI DELTA ROW
   Shows change vs. previous period (up/down/neutral)
   Source: Lines 756-806
============================================================ */

.gf-kpi-delta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.gf-kpi-delta--up {
  color: #16a34a;
}

.gf-kpi-delta--down {
  color: #dc2626;
}

.gf-kpi-delta--neutral {
  color: #6b6f85;
}

.gf-kpi-delta-arrow {
  font-size: 13px;
  line-height: 1;
}

.gf-kpi-delta-abs {
  font-weight: 600;
  opacity: 0.88;
}

.gf-kpi-vs {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(47, 47, 58, 0.52);
}

@media (max-width: 640px) {
  .gf-kpi-delta {
    font-size: 11px;
    margin-top: 4px;
  }

  .gf-kpi-vs {
    font-size: 10.5px;
  }
}


/* ============================================================
   KPI INSIGHT
   Responsive insight box with color states (up/down/neutral)
   Source: Lines 543-641
============================================================ */

.gf-kpi-insight {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  background: #f7f7fb;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #444;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.04);
}


/* =========================================================
   KPI INSIGHT — STATE COLORS
=========================================================== */

/* UP (positive growth) */
.gf-kpi-insight--up {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

/* DOWN (negative trend) */
.gf-kpi-insight--down {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* NEUTRAL (flat or informational) */
.gf-kpi-insight--neutral {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #374151;
}


/* =========================================================
   KPI INSIGHT — ICON
=========================================================== */

.gf-kpi-insight-icon {
  font-size: 16px;
  flex: 0 0 auto;
}


/* =========================================================
   KPI INSIGHT — TEXT
=========================================================== */

.gf-kpi-insight-text {
  flex: 1 1 auto;
}


/* =========================================================
   KPI INSIGHT — RESPONSIVE PADDING
=========================================================== */

/* Desktop (≥1024px) */
@media (min-width: 1024px) {
  .gf-kpi-insight {
    padding: 14px 16px;
    font-size: 14.5px;
    border-radius: 14px;
  }
}

/* Tablet (768–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .gf-kpi-insight {
    padding: 13px 15px;
    font-size: 14px;
  }
}


/* ============================================================
   KPI SUPPORTERS META
   Metadata row for supporter count and rate
   Source: Lines 813-831
============================================================ */

.gf-kpi-supporters-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(47, 47, 58, 0.68);
}

.gf-kpi-supporters-rate {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(138, 92, 255, 0.1);
  color: #7c3aed;
  font-size: 11px;
  font-weight: 700;
}
