/* ==========================================================================
   APGMRS Redesigned Reporting Module Design System
   Tokens & Shared Component Styles
   ========================================================================== */

:root {
  --report-bg: #F3F5F9;
  --report-card: #FFFFFF;
  --report-ink: #0F1F3D;
  --report-mute: #6B7690;
  --report-line: #E3E8F1;
  --report-soft: #F7F9FC;

  --report-navy: #0F1F3D;
  --report-navy-end: #1D3466;
  --report-gold: #C9A24B;
  --report-blue: #2F6FDB;
  --report-ok: #1F9D6B;
  --report-warn: #D98A1C;
  --report-bad: #CF4455;
}

[data-theme="dark"],
.dark,
html.dark,
html[theme~="dark"],
:root[theme="dark"] {
  --report-bg: #0B1220;
  --report-card: #131C30;
  --report-ink: #E8EDF7;
  --report-mute: #97A3BD;
  --report-line: #243049;
  --report-soft: #0F1829;
}

/* Report Container */
.report-view-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
  background-color: var(--report-bg);
  color: var(--report-ink);
  font-family: Tajawal, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

.report-panel {
  background: var(--report-card);
  border: 1px solid var(--report-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15, 31, 61, 0.05);
}

/* 1. Report Header */
.report-header {
  background: linear-gradient(135deg, var(--report-navy), var(--report-navy-end));
  color: #FFFFFF;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 4px solid var(--report-gold);
}

.report-header-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-header-logo {
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--report-gold);
  font-size: 15px;
  text-transform: uppercase;
}

.report-header-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
}

.report-header-meta {
  font-size: 13px;
  opacity: 0.85;
  color: #E8EDF7;
  margin-top: 2px;
}

.report-header-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

[dir="rtl"] .report-header-aside {
  align-items: flex-start;
}

.report-header-timestamp {
  font-size: 12px;
  opacity: 0.8;
  color: #E8EDF7;
}

/* Badges */
.report-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.report-badge.b-ok {
  background: rgba(31, 157, 107, 0.16);
  color: var(--report-ok);
  border: 1px solid rgba(31, 157, 107, 0.3);
}

.report-badge.b-warn {
  background: rgba(217, 138, 28, 0.16);
  color: var(--report-warn);
  border: 1px solid rgba(217, 138, 28, 0.3);
}

.report-badge.b-bad {
  background: rgba(207, 68, 85, 0.16);
  color: var(--report-bad);
  border: 1px solid rgba(207, 68, 85, 0.3);
}

.report-badge.b-info {
  background: rgba(47, 111, 219, 0.16);
  color: var(--report-blue);
  border: 1px solid rgba(47, 111, 219, 0.3);
}

/* 2. KPI Cards Grid */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-kpi-card {
  background: var(--report-soft);
  border: 1px solid var(--report-line);
  border-radius: 12px;
  padding: 12px 14px;
  border-top: 3px solid var(--report-gold);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.report-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 31, 61, 0.06);
}

.report-kpi-label {
  font-size: 12px;
  color: var(--report-mute);
  font-weight: 500;
}

.report-kpi-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  margin-top: 2px;
  color: var(--report-ink);
  letter-spacing: -0.5px;
}

.report-kpi-note {
  font-style: normal;
  font-size: 12px;
  color: var(--report-mute);
  margin-top: 2px;
}

/* 3. Section / Grid */
.report-body {
  padding: 18px 22px;
}

.report-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-chart-box {
  border: 1px solid var(--report-line);
  border-radius: 12px;
  padding: 14px;
  background: var(--report-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.report-chart-box h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--report-ink);
}

.report-chart-sample-tag {
  font-size: 11px;
  color: var(--report-mute);
  margin-top: 6px;
}

.report-chart-legend {
  font-size: 12px;
  color: var(--report-mute);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.report-legend-bullet {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 4px;
}

/* 4. Note Banner */
.report-note-banner {
  background: rgba(217, 138, 28, 0.08);
  border: 1px solid rgba(217, 138, 28, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 14px;
  color: var(--report-ink);
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* 5. Report Table */
.report-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--report-line);
  border-radius: 12px;
  background: var(--report-card);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
  text-align: inherit;
}

.report-table th {
  background: var(--report-navy);
  color: #FFFFFF;
  padding: 10px 12px;
  font-weight: 700;
  white-space: nowrap;
}

[dir="rtl"] .report-table th {
  text-align: right;
}

[dir="ltr"] .report-table th {
  text-align: left;
}

.report-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--report-line);
  color: var(--report-ink);
}

.report-table tr:nth-child(even) td {
  background: var(--report-soft);
}

.report-table tr.totals-row td,
.report-table th.totals-cell {
  font-weight: 800;
  background: var(--report-soft);
  border-top: 2px solid var(--report-gold);
  border-bottom: none;
}

/* 6. Report Footer */
.report-footer {
  display: flex;
  justify-content: space-between;
  color: var(--report-mute);
  font-size: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--report-line);
  flex-wrap: wrap;
  gap: 6px;
}

/* SVG Chart styling */
svg.report-svg-chart {
  max-width: 100%;
  height: auto;
  direction: ltr;
}

/* Timeline */
.report-timeline {
  border-inline-start: 2px solid var(--report-gold);
  padding-inline-start: 14px;
  margin: 0;
}

.report-timeline-item {
  margin-bottom: 12px;
  font-size: 13px;
}

.report-timeline-item b {
  display: block;
  color: var(--report-ink);
  font-size: 12px;
}
