/* ==========================================================================
   Ogutu FiberOps — Enhanced Overview Section Styles
   KPLC/ICTA Fiber Optic PM Dashboard (Dark Theme PWA)
   Agent 5 of 5 — overview.css
   ========================================================================== */

/* ==========================================================================
   1. KPI STRIP v2 (6-card grid)
   ========================================================================== */

.kpi-strip-v2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  animation: countUp 0.4s ease both;
}

.kpi-card-v2:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  background: var(--bg-card-hover);
}

/* Decorative gradient blob — top-right corner */
.kpi-card-v2::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-primary);
  opacity: 0.06;
  pointer-events: none;
}

/* Staggered entrance animations */
.kpi-card-v2:nth-child(1) { animation-delay: 0s; }
.kpi-card-v2:nth-child(2) { animation-delay: 0.05s; }
.kpi-card-v2:nth-child(3) { animation-delay: 0.1s; }
.kpi-card-v2:nth-child(4) { animation-delay: 0.15s; }
.kpi-card-v2:nth-child(5) { animation-delay: 0.2s; }
.kpi-card-v2:nth-child(6) { animation-delay: 0.25s; }

.kpi-icon-v2 {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.kpi-icon-v2 svg {
  width: 24px;
  height: 24px;
  color: #ffffff;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-label-v2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value-v2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi-unit-v2 {
  font-size: 1rem;
  color: var(--text-secondary);
  -webkit-text-fill-color: var(--text-secondary);
  font-weight: 500;
}

.kpi-meta-v2 {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.kpi-progress-v2 {
  height: 3px;
  margin-top: 16px;
  border-radius: 2px;
  background: rgba(99, 102, 241, 0.15);
  overflow: hidden;
}

.kpi-progress-fill-v2 {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 1.2s ease;
}


/* ==========================================================================
   2. PROJECT HEALTH BAR
   ========================================================================== */

.health-bar-section {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.health-bar-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.health-score {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.health-track {
  height: 8px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.health-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1.5s ease;
}

.health-fill.score-high {
  background: var(--accent-5);
}

.health-fill.score-mid {
  background: var(--accent-4);
}

.health-fill.score-low {
  background: var(--accent-6);
}

.health-sub-indicators {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.health-indicator {
  flex: 1;
  min-width: 120px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.health-indicator-bar {
  height: 4px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.health-indicator-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 1s ease;
}


/* ==========================================================================
   3. QUICK ACTIONS BAR
   ========================================================================== */

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.quick-action-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.quick-action-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-1);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.quick-action-btn.primary {
  background: var(--gradient-primary);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.quick-action-btn.primary:hover {
  background: var(--gradient-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(99, 102, 241, 0.45);
}

.quick-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}


/* ==========================================================================
   4. SCHEME MATRIX
   ========================================================================== */

.scheme-matrix-section {
  margin-bottom: 24px;
}

.scheme-matrix-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.scheme-matrix-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.scheme-matrix-badge {
  font-size: 0.68rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-1);
  font-weight: 600;
}

.scheme-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.scheme-matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.scheme-matrix-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.scheme-matrix-card.status-completed {
  border-left: 3px solid var(--accent-5);
}

.scheme-matrix-card.status-assigned {
  border-left: 3px solid var(--accent-4);
}

.scheme-matrix-card.status-inprogress {
  border-left: 3px solid var(--accent-1);
}

.scheme-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.scheme-card-name-v2 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.scheme-card-region-v2 {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.scheme-status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-completed-v2 {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-5);
}

.badge-assigned-v2 {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-4);
}

.badge-progress-v2 {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-1);
}

.scheme-progress-section {
  margin-bottom: 12px;
}

.scheme-progress-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.scheme-progress-bar-v2 {
  height: 6px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

.scheme-progress-fill-v2 {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 1s ease;
}

.scheme-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.scheme-stat-v2 {
  text-align: center;
}

.scheme-stat-value-v2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scheme-stat-label-v2 {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}


/* ==========================================================================
   5. OPERATIONS PANEL (PM Today)
   ========================================================================== */

.ops-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ops-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ops-panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.ops-panel-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-1);
  flex-shrink: 0;
}


/* ==========================================================================
   6. ACTIVITY FEED
   ========================================================================== */

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(99, 102, 241, 0.06);
  position: relative;
  animation: fadeSlideIn 0.3s ease both;
}

.activity-item:last-child {
  border-bottom: none;
}

/* Staggered feed entrance */
.activity-item:nth-child(1)  { animation-delay: 0.04s; }
.activity-item:nth-child(2)  { animation-delay: 0.08s; }
.activity-item:nth-child(3)  { animation-delay: 0.12s; }
.activity-item:nth-child(4)  { animation-delay: 0.16s; }
.activity-item:nth-child(5)  { animation-delay: 0.20s; }
.activity-item:nth-child(6)  { animation-delay: 0.24s; }
.activity-item:nth-child(7)  { animation-delay: 0.28s; }
.activity-item:nth-child(8)  { animation-delay: 0.32s; }

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.activity-dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 100%;
  background: rgba(99, 102, 241, 0.15);
  transform: translateX(-50%);
}

.activity-item:last-child .activity-dot::after {
  display: none;
}

.activity-dot.type-complete  { background: var(--accent-5); }
.activity-dot.type-incident  { background: var(--accent-6); }
.activity-dot.type-logistics { background: var(--accent-4); }
.activity-dot.type-start     { background: var(--accent-2); }

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-date {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  flex-shrink: 0;
}


/* ==========================================================================
   7. FINANCIAL STRIP (Director view)
   ========================================================================== */

.financial-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.fin-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.fin-kpi-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.fin-kpi-card::before {
  content: '';
  position: absolute;
  bottom: -16px;
  right: -16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gradient-primary);
  opacity: 0.05;
  pointer-events: none;
}

.fin-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.fin-kpi-amount {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.fin-kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.fin-kpi-bar {
  height: 3px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 14px;
}

.fin-kpi-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}


/* ==========================================================================
   8. EQUIPMENT TRACKER
   ========================================================================== */

.equip-tracker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.equip-tracker-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.equip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.equip-row:last-child {
  margin-bottom: 0;
}

.equip-name {
  width: 90px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.equip-track {
  flex: 1;
  height: 8px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.equip-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
}

.equip-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}


/* ==========================================================================
   9. CHARTS GRID v2
   ========================================================================== */

.chart-grid-v2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
}

.chart-card-v2:hover {
  border-color: var(--border-hover);
}

.chart-card-header-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-card-title-v2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-card-sub-v2 {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-wrapper-v2 {
  position: relative;
  width: 100%;
  height: 260px;
}


/* ==========================================================================
   10. REGIONAL BREAKDOWN
   ========================================================================== */

.regional-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: var(--transition);
}

.region-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.region-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.region-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.region-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-1);
  font-weight: 600;
}

.region-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.region-stat-item {
  text-align: center;
  padding: 8px;
  background: rgba(99, 102, 241, 0.05);
  border-radius: var(--radius-sm);
}

.region-stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.region-stat-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.region-progress-track {
  height: 4px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.region-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 1s ease;
}


/* ==========================================================================
   11. KEYFRAME ANIMATIONS
   ========================================================================== */

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

@keyframes barFillIn {
  from {
    width: 0 !important;
  }
  to {
    /* width is set inline — keyframe just resets the 'from' state */
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(99, 102, 241, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

/* Utility: apply pulse glow to cards that need attention */
.kpi-card-v2.attention {
  animation: pulseGlow 2s ease-in-out infinite;
}


/* ==========================================================================
   12. RESPONSIVE OVERRIDES
   ========================================================================== */

/* Large desktop (default above is 3-col for kpi-strip-v2) */
@media (min-width: 1400px) {
  .kpi-strip-v2 {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* 1200px — 3-col KPI, single-col charts */
@media (max-width: 1200px) {
  .kpi-strip-v2 {
    grid-template-columns: repeat(3, 1fr);
  }

  .chart-grid-v2 {
    grid-template-columns: 1fr;
  }
}

/* 900px — 2-col KPI, 2-col scheme matrix, single-col ops */
@media (max-width: 900px) {
  .kpi-strip-v2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .scheme-matrix-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ops-panel-grid {
    grid-template-columns: 1fr;
  }

  .health-sub-indicators {
    gap: 10px;
  }

  .health-indicator {
    min-width: 100px;
  }
}

/* 640px — 2-col KPI, smaller values, 2-col financial/regional */
@media (max-width: 640px) {
  .kpi-strip-v2 {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-card-v2 {
    padding: 18px 16px;
  }

  .kpi-value-v2 {
    font-size: 1.6rem;
  }

  .kpi-icon-v2 {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
  }

  .financial-strip {
    grid-template-columns: 1fr 1fr;
  }

  .regional-breakdown {
    grid-template-columns: 1fr 1fr;
  }

  .scheme-matrix-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrapper-v2 {
    height: 200px;
  }

  .quick-actions {
    gap: 6px;
  }

  .quick-action-btn {
    padding: 7px 14px;
    font-size: 0.78rem;
  }
}

/* 400px — single column KPI */
@media (max-width: 400px) {
  .kpi-strip-v2 {
    grid-template-columns: 1fr;
  }

  .financial-strip {
    grid-template-columns: 1fr;
  }

  .regional-breakdown {
    grid-template-columns: 1fr;
  }

  .region-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .scheme-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .health-bar-section {
    padding: 16px;
  }
}


/* ==========================================================================
   13. PRINT MEDIA OVERRIDES
   ========================================================================== */

@media print {
  .kpi-card-v2,
  .scheme-matrix-card,
  .fin-kpi-card,
  .region-card {
    break-inside: avoid;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .kpi-value-v2,
  .fin-kpi-amount {
    -webkit-text-fill-color: #1a1f36 !important;
    color: #1a1f36 !important;
  }

  .health-score {
    -webkit-text-fill-color: #1a1f36 !important;
    color: #1a1f36 !important;
  }

  .kpi-progress-fill-v2,
  .health-fill,
  .scheme-progress-fill-v2,
  .health-indicator-fill,
  .fin-kpi-bar-fill,
  .equip-fill,
  .region-progress-fill {
    background: #6366f1 !important;
  }

  .chart-grid-v2 {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-strip-v2 {
    grid-template-columns: repeat(3, 1fr);
  }

  .financial-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-actions {
    display: none;
  }

  .kpi-card-v2,
  .ops-panel-card,
  .health-bar-section,
  .equip-tracker,
  .chart-card-v2 {
    border-color: #ddd !important;
  }

  .kpi-card-v2::before,
  .fin-kpi-card::before {
    display: none;
  }
}
