/* ==========================================================================
   InvestFlow - Desktop Web App Styling (css/desktop.css)
   FinanceAI Signature Experience:
   - 4 Pastel KPI Cards with Subtle Glow and Floating Accent Icons
   - Dual Column Growth & Rounded Pillars Bar Charts
   - Clean FinanceAI Insights & FIRE Journey Strip
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOP KPI STATS GRID (FinanceAI 4 Pastel Cards)
   -------------------------------------------------------------------------- */
.financeai-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
}

.kpi-pastel-card {
  border-radius: var(--radius-surface, 20px);
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s var(--ease-spring), border-color 0.22s ease;
  backdrop-filter: blur(8px);
}

.kpi-pastel-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.08);
}

/* Card 1: Total Balance (Pastel Blue) */
.kpi-pastel-card.card-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.07) 0%, rgba(59, 130, 246, 0.02) 100%);
  border: 1px solid rgba(59, 130, 246, 0.22);
}
.kpi-pastel-card.card-blue:hover {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 14px 30px -4px rgba(59, 130, 246, 0.15);
}

/* Card 2: Total Cost / Capital (Pastel Green) */
.kpi-pastel-card.card-green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.07) 0%, rgba(16, 185, 129, 0.02) 100%);
  border: 1px solid rgba(16, 185, 129, 0.22);
}
.kpi-pastel-card.card-green:hover {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 14px 30px -4px rgba(16, 185, 129, 0.15);
}

/* Card 3: Total PnL / Cumulative Returns (Pastel Purple) */
.kpi-pastel-card.card-purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.07) 0%, rgba(139, 92, 246, 0.02) 100%);
  border: 1px solid rgba(139, 92, 246, 0.22);
}
.kpi-pastel-card.card-purple:hover {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 14px 30px -4px rgba(139, 92, 246, 0.15);
}

/* Card 4: Annual Dividend Yield (Pastel Amber) */
.kpi-pastel-card.card-amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.07) 0%, rgba(245, 158, 11, 0.02) 100%);
  border: 1px solid rgba(245, 158, 11, 0.22);
}
.kpi-pastel-card.card-amber:hover {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 14px 30px -4px rgba(245, 158, 11, 0.15);
}

/* Dark Theme Adjustments for Pastel Cards */
[data-theme="dark"] .kpi-pastel-card.card-blue {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.2) 0%, rgba(17, 24, 39, 0.7) 100%);
}
[data-theme="dark"] .kpi-pastel-card.card-green {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.2) 0%, rgba(17, 24, 39, 0.7) 100%);
}
[data-theme="dark"] .kpi-pastel-card.card-purple {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.2) 0%, rgba(17, 24, 39, 0.7) 100%);
}
[data-theme="dark"] .kpi-pastel-card.card-amber {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.2) 0%, rgba(17, 24, 39, 0.7) 100%);
}

/* Left details column */
.kpi-pastel-body {
  min-width: 0;
  flex: 1;
}

.kpi-pastel-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.kpi-pastel-value {
  font-size: clamp(1.4rem, 1.8vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary, #0f172a);
  line-height: 1.15;
  margin-bottom: 6px;
  font-feature-settings: "tnum";
}

.kpi-pastel-trend {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kpi-pastel-trend.trend-up {
  color: #10b981;
}
.kpi-pastel-trend.trend-down {
  color: #f43f5e;
}
.kpi-pastel-trend.trend-neutral {
  color: var(--text-secondary, #64748b);
}

/* Right floating rounded icon box */
.kpi-pastel-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform 0.22s ease;
}

.kpi-pastel-card:hover .kpi-pastel-icon {
  transform: scale(1.08) rotate(3deg);
}

.card-blue .kpi-pastel-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.card-green .kpi-pastel-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.card-purple .kpi-pastel-icon {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.card-amber .kpi-pastel-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* --------------------------------------------------------------------------
   2. FINANCEAI INSIGHTS & FIRE GOAL HYBRID CARD
   -------------------------------------------------------------------------- */
.financeai-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.financeai-insight-box {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, rgba(226, 232, 240, 0.8));
  border-radius: var(--radius-surface, 20px);
  padding: 22px 24px;
  box-shadow: var(--shadow-card, 0 4px 20px rgba(0, 0, 0, 0.04));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.insight-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.insight-title-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.insight-title-icon.purple {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.insight-title-icon.blue {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.insight-header h3 {
  font-size: 0.96rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary, #0f172a);
}

.insight-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.insight-link:hover {
  text-decoration: underline;
}

/* Insight Inner Cards */
.insight-item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insight-item-card {
  background: var(--bg-card-subtle, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-color, rgba(226, 232, 240, 0.7));
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.18s ease;
}

.insight-item-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
}

.insight-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.insight-item-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.badge-tag-level {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.badge-tag-level.high {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-tag-level.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.insight-item-desc {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.4;
  margin: 0;
}

/* FIRE Journey Progress Strip inside FinanceAI */
.fire-progress-strip {
  margin-top: 14px;
  background: var(--bg-card-subtle, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--border-color, rgba(226, 232, 240, 0.7));
  border-radius: 14px;
  padding: 12px 16px;
}

.fire-progress-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.fire-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

[data-theme="dark"] .fire-track {
  background: rgba(255, 255, 255, 0.08);
}

.fire-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   3. RESPONSIVE QUERIES FOR DESKTOP TIERS
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .financeai-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .financeai-insights-grid {
    grid-template-columns: 1fr;
  }
}
