/* Insights — mobile/tablet base styles (<1024px).
   Desktop overrides live in css/desktop/insights.desktop.css. */

body.ma-insights-page {
  background: var(--ma-bg, #0b0f1a);
  min-height: 100vh;
}

body.ma-insights-page .ma-main {
  /* v14XX: safe-area aware top padding so the header band doesn't slip under
     the iOS status bar in PWA standalone mode. */
  padding: 16px 14px 96px;
  padding-top: max(16px, calc(env(safe-area-inset-top, 0px) + 16px));
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom, 0px) + 96px));
}

.ma-insights-root {
  max-width: 720px;
  margin: 0 auto;
}

/* Mobile header band */
.ma-insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ma-hero-gradient, linear-gradient(135deg, #1A2456 0%, #2a3a7a 100%));
  color: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  /* v1431: extra space between header band and the panels below */
  margin-bottom: 28px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.18);
}

.ma-insights-header__text { min-width: 0; }

.ma-insights-header__title {
  margin: 0 0 2px 0;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

.ma-insights-header__subtitle {
  margin: 0;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
}

.ma-insights-header__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.ma-insights-header__badge::before {
  content: '●';
  color: #4ade80;
  font-size: 9px;
}

/* Stack the panels vertically on mobile (welcome.css already styles them).
   Override the home-only display:flex behaviour so the dashboard sits in
   the normal flow.
   v1432: reset position:absolute / top / bottom / overflow inherited from
   welcome.css — on Insights the dashboard MUST flow normally below the
   header band, otherwise it overlaps the header on small viewports. */
body.ma-insights-page .ma-welcome-dashboard.ma-insights-dashboard {
  position: static;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
  opacity: 1;
  transition: none;
}

/* Light theme variant for mobile (matches the rest of the app) */
html.ma-force-light body.ma-insights-page {
  background: #f5f7fb;
}
html.ma-force-light body.ma-insights-page .ma-insights-header__subtitle {
  color: rgba(255,255,255,0.92);
}

/* v14XX — Insights page light-mode panel/card overrides.
   The original light-mode rules in welcome.css target `.ma-hero--no-video`
   which only exists on the home hero. The Insights page reuses the same
   panel/card classes outside the hero, so we need explicit overrides. */
html.ma-force-light body.ma-insights-page .ma-metrics-panel,
html.ma-force-light body.ma-insights-page .ma-status-panel,
html.ma-force-light body.ma-insights-page .ma-mystats-panel {
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(15,23,42,0.08);
  box-shadow: 0 4px 16px rgba(15,23,42,0.06);
}
html.ma-force-light body.ma-insights-page .ma-panel__title,
html.ma-force-light body.ma-insights-page .ma-status__title {
  color: #1a2232;
}
html.ma-force-light body.ma-insights-page .ma-metrics__card,
html.ma-force-light body.ma-insights-page .ma-status__card,
html.ma-force-light body.ma-insights-page .ma-mystats__card {
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 4px 16px rgba(15,23,42,0.06);
}
html.ma-force-light body.ma-insights-page .ma-metrics__value,
html.ma-force-light body.ma-insights-page .ma-status__value,
html.ma-force-light body.ma-insights-page .ma-mystats__value {
  color: #1a2232;
  text-shadow: none;
}
html.ma-force-light body.ma-insights-page .ma-status__value--active { color: #059669; }
html.ma-force-light body.ma-insights-page .ma-status__value--inactive { color: #dc2626; }
html.ma-force-light body.ma-insights-page .ma-metrics__label,
html.ma-force-light body.ma-insights-page .ma-status__label,
html.ma-force-light body.ma-insights-page .ma-mystats__label {
  color: rgba(26,34,50,0.7);
}

/* Same overrides under system light preference (no ma-force-dark) */
@media (prefers-color-scheme: light) {
  html:not(.ma-force-dark) body.ma-insights-page {
    background: #f5f7fb;
  }
  html:not(.ma-force-dark) body.ma-insights-page .ma-metrics-panel,
  html:not(.ma-force-dark) body.ma-insights-page .ma-status-panel,
  html:not(.ma-force-dark) body.ma-insights-page .ma-mystats-panel {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: 0 4px 16px rgba(15,23,42,0.06);
  }
  html:not(.ma-force-dark) body.ma-insights-page .ma-panel__title,
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__title {
    color: #1a2232;
  }
  html:not(.ma-force-dark) body.ma-insights-page .ma-metrics__card,
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__card,
  html:not(.ma-force-dark) body.ma-insights-page .ma-mystats__card {
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(15,23,42,0.10);
    box-shadow: 0 4px 16px rgba(15,23,42,0.06);
  }
  html:not(.ma-force-dark) body.ma-insights-page .ma-metrics__value,
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__value,
  html:not(.ma-force-dark) body.ma-insights-page .ma-mystats__value {
    color: #1a2232;
    text-shadow: none;
  }
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__value--active { color: #059669; }
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__value--inactive { color: #dc2626; }
  html:not(.ma-force-dark) body.ma-insights-page .ma-metrics__label,
  html:not(.ma-force-dark) body.ma-insights-page .ma-status__label,
  html:not(.ma-force-dark) body.ma-insights-page .ma-mystats__label {
    color: rgba(26,34,50,0.7);
  }
}
