/* ==============================
   Table Container & Global Styles
   ============================== */
.table-container {
  margin: 1.2em auto;                /* increased from 0.6em for better top breathing */
  padding: 1em 0;                    /* added vertical padding inside container */
  font-size: 0.38em;                 /* slightly smaller than 0.41em – less dense */
  font-family: Helvetica Neue, Arial, sans-serif;
  line-height: 1.25;                 /* tiny increase for readability */
  max-width: 96%;
  max-height: 88vh;                  /* slight increase from 86vh */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;           /* centers vertically when content is short/collapsed */
}

.table-container h2 {
  margin: 0 0 1em;                   /* more space below title than before (was 0.6em) */
  font-size: 1.35em;                 /* reduced from 1.5em – less top-heavy */
  text-align: center;
  color: #eee;
  letter-spacing: 0.02em;
}

.table-container table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.table-container th,
.table-container td {
  padding: 0.35em 0.45em;            /* tightened a bit from 0.4em 0.5em */
  vertical-align: middle !important;
  text-align: left;
  border: none;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

/* ==============================
   Header Styling
   ============================== */
.table-container thead tr:first-child th {
  background: #2c4a6e;
  color: #f0f4f8;
  font-weight: 600;
  font-size: 1.05em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

.table-container thead tr:nth-child(2) th {
  background: #3a5d88;
  color: #f0f4f8;
  font-weight: 500;
  font-size: 0.9em;
  text-align: left !important;
}

/* Horizontal divider under header */
.table-container thead th::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #bbb;
  z-index: 1;
}

/* Visual boundary between Activities and Expenditure */
.table-container thead tr:nth-child(2) th:nth-child(3),
.table-container tbody td:nth-child(3) {
  border-right: 2px solid rgba(255,255,255,0.15);
}

/* ==============================
   Body Row Styling
   ============================== */
.table-container td::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: #ddd;
  z-index: 1;
}

.table-container tbody tr:last-child td::after {
  display: none;
}

.table-container tr:nth-child(even) {
  background: rgba(255,255,255,0.025);   /* softened from 0.04 – cleaner look */
}

/* ==============================
   Status / Tag Colors
   ============================== */
.pass  { color: #a5d6a7; }
.warn  { color: #ffe082; }
.fail  { color: #ef9a9a; }

/* Inline tags / labels */
.insight-tag {
  display: inline;
  font-size: 0.9em;
  color: #aaa;
  margin-left: 0.5em;
  line-height: 1.1;
}

.insight-tag.pass { color: #a5d6a7; }
.insight-tag.warn  { color: #ffe082; }
.insight-tag.fail  { color: #ef9a9a; }

/* ==============================
   Nested / Mini Tables
   ============================== */
.mini-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 0.4em 0;                   /* added small vertical margin */
  border: none !important;
}

.mini-table td {
  padding: 0.15em 0.35em;            /* slight increase from 0.1em 0.3em when expanded */
  font-size: 0.95em;
  line-height: 1.3;
  border: none !important;
  vertical-align: middle;
}

.mini-table tr:first-child td {
  font-weight: 600;
  padding: 0.5em 0.6em;              /* taller first row for better click target */
}

.mini-table tr:not(:first-child) td {
  font-style: italic;
  font-weight: normal;
  color: #ccc;
}

/* Collapsible behavior */
.mini-table[data-collapsible="true"] tr:not(:first-child) {
  display: none;
}

.mini-table[data-collapsible="true"].expanded tr {
  display: table-row;
}

.mini-table[data-collapsible="true"] tr:first-child {
  cursor: pointer;
  user-select: none;
}

/* Expand/collapse arrow - only on first cell */
.mini-table[data-collapsible="true"] tr:first-child td:first-child::before {
  content: "▶";
  display: inline-block;
  width: 1em;
  transition: transform 0.2s ease;
  margin-right: 0.3em;
}

.mini-table[data-collapsible="true"].expanded tr:first-child td:first-child::before {
  transform: rotate(90deg);
}

/* Prevent arrow & pointer on other first-row cells */
.mini-table[data-collapsible="true"] tr:first-child td:not(:first-child) {
  cursor: default !important;
  user-select: text;
}

.mini-table[data-collapsible="true"] tr:first-child td:not(:first-child)::before {
  content: none !important;
}

/* Status/assessment cells in first row of mini-tables */
.mini-table tr:first-child td:not(:first-child) {
  font-size: 0.95em;
  font-weight: 500;
  text-align: left;
  white-space: normal;
}

/* No borders/lines in collapsed state for first row */
.mini-table[data-collapsible="true"]:not(.expanded) tr:first-child td {
  border: none !important;
}

.mini-table[data-collapsible="true"]:not(.expanded) tr:first-child td::after {
  display: none !important;
}

/* Restore when expanded */
.mini-table[data-collapsible="true"].expanded tr:first-child td {
  border-bottom: 1px solid #ddd !important;
}

.mini-table.expanded td,
.mini-table[data-collapsible="false"] td {
  border-bottom: 1px solid #ddd !important;
}

.mini-table.expanded tr:last-child td,
.mini-table[data-collapsible="false"] tr:last-child td {
  border-bottom: none !important;
}

/* Hide summary assessment cell when mini-table is expanded */
.mini-table[data-collapsible="true"].expanded tr:first-child td:nth-child(2) {
  display: none !important;
}

/* ==============================
   Row Fragment Animations
   ============================== */
.table-container tr.fragment {
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.5s ease;
}

.table-container tr.fragment.visible,
.table-container tr.fragment.current-fragment {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* ==============================
   Reveal.js Slide Visibility
   ============================== */
.reveal .slides > section {
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.reveal .slides > section:first-child,
.reveal .slides > section.present {
  visibility: visible;
  opacity: 1;
}

.reveal .slides > section:not(.present) {
  visibility: hidden;
  opacity: 0;
}

/* No background shading on any rows inside mini-tables */
.mini-table tr {
  background: transparent !important;
}

/* Optional: if you still see faint bleed, force it */
.mini-table tr:nth-child(even),
.mini-table tr:nth-child(odd) {
  background: transparent !important;
}

/* Prevent colored bleed on horizontal divider lines */
.table-container td::after {
  background: #ddd !important;
}
