/* ═══════════════════════════════════════
   dashboard.css — Modern Premium SaaS Theme V3
   ═══════════════════════════════════════ */

/* ── Typography & Variables ── */
:root {
  --dash-bg: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 4px 14px rgba(0,0,0,0.03);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.04);
  --primary: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-lg: 24px;
  --radius-md: 16px;
  --text-dark: #0f172a;
  --text-mut: #64748b;
}

/* Base resets inside page-content for Dash */
.page-content { padding: 32px 24px; background-color: var(--dash-bg); min-height: 100vh; }

/* ── Top Stats Row ── */
.dashboard-top-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.stat-info { display: flex; flex-direction: column; flex: 1; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-mut); margin-bottom: 8px; white-space: nowrap; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-dark); line-height: 1; margin: 0; white-space: nowrap; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.bg-success { background: rgba(16,185,129,0.1); color: var(--success); }
.bg-primary { background: rgba(99,102,241,0.1); color: var(--primary); }
.bg-info { background: rgba(59,130,246,0.1); color: var(--info); }
.bg-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.bg-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.bg-purple { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.bg-orange { background: rgba(249,115,22,0.1); color: #f97316; }

.stat-footer { display: flex; align-items: center; gap: 8px; font-size: 11.5px; z-index: 2; position: relative; margin-top: auto;}
.stat-trend { padding: 4px 8px; border-radius: 20px; font-weight: 700; }
.stat-trend.up { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-trend.down { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-desc { color: var(--text-mut); font-weight: 500; }

.stat-sparkline {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  opacity: 0.35; /* Subdued chart */
  pointer-events: none;
}

/* Progress Bar (Collection Rate) */
.progress-bar-bg { width: 100%; height: 8px; background: #e2e8f0; border-radius: 10px; overflow: hidden; margin-top: 10px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #fbbf24); width: 0%; transition: width 1s ease; }

/* ── Main Charts Area ── */
.dashboard-main-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}

.chart-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.chart-title { font-size: 16px; font-weight: 800; color: var(--text-dark); margin:0 0 4px 0; }
.chart-subtitle { font-size: 12px; color: var(--text-mut); margin:0; }
.chart-filter { border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 12px; font-size: 12px; color: var(--text-dark); background: transparent; outline: none; cursor: pointer; }

/* Doughnut Center Info */
.doughnut-center-text {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.doughnut-center-text .val { display: block; font-size: 20px; font-weight: 800; color: var(--text-dark); line-height:1; margin-bottom: 2px; }
.doughnut-center-text .lbl { display: block; font-size: 10px; color: var(--text-mut); font-weight: 600; white-space: nowrap; }

.doughnut-legend {
  display: flex; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap;
}
.legend-item { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 4px; color: var(--text-dark); white-space: nowrap; }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-item span[id^="leg"] { margin-right: auto; padding-right: 8px; color: var(--text-mut); }

/* ── Lower Grid Area ── */
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

/* Activity Feed Modern */
.activity-list.modern-list { display: flex; flex-direction: column; gap: 14px; }
.activity-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  transition: all 0.2s;
  background: white;
}
.activity-item:hover { border-color: #e2e8f0; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.activity-content { flex: 1; }
.activity-title { font-size: 13.5px; font-weight: 700; color: var(--text-dark); margin-bottom: 4px; }
.activity-time { font-size: 11px; color: var(--text-mut); font-weight: 500; }

.view-all-link { font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; padding: 4px 8px; background: rgba(99,102,241,0.05); border-radius: 6px; }

/* Quick Actions Grid */
.quick-actions-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.qa-item {
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: 14px;
  padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-decoration: none;
  transition: all 0.2s;
}
.qa-item:hover { border-color: #cbd5e1; transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.qa-item span { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.qa-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .dashboard-top-stats { grid-template-columns: repeat(2, 1fr); }
  .dashboard-main-charts { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dashboard-top-stats { grid-template-columns: 1fr; }
  .dashboard-lower-grid { grid-template-columns: 1fr; }
}

/* Animations Core */
.animate-in { opacity: 0; animation: fadeInUp .6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }
.delay-4 { animation-delay: .4s; }
.delay-5 { animation-delay: .5s; }