/* ============================================================
   table.css — Data table, row icons, tooltips, sidebar choices
   Partage Dossier Website
   ============================================================ */

/* ── Table wrapper ────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--space-8);
}

/* ── Data table base ──────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.data-table th {
  background: var(--color-surface);
  color: var(--color-accent);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--space-4) var(--space-6);
  border-bottom: 2px solid var(--color-accent);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: var(--nav-height);
  z-index: var(--z-raised);
}

.data-table td {
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Numeric cells */
.data-table td.cell--numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

/* Accent value cells */
.data-table td.cell--accent {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

/* Null / empty cells */
.data-table .cell--null {
  color: var(--color-border);
  user-select: none;
}

/* ── Actions column ───────────────────────────────────────── */
.td--actions {
  width: 64px;
  min-width: 48px;
  text-align: center;
  white-space: nowrap;
  padding: var(--space-3) var(--space-4);
}

/* ── Row icons (evidence ⊳ and calc Σ) ───────────────────── */
.row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  transition: background var(--transition-fast);
  user-select: none;
  vertical-align: middle;
}

.row-icon + .row-icon {
  margin-left: 2px;
}

/* Evidence icon (⊳) */
.row-icon--evidence {
  color: var(--color-accent);
}

.row-icon--evidence:hover {
  background: rgba(254, 110, 0, 0.15);
}

/* Calc icon (Σ) */
.row-icon--calc {
  color: var(--color-blue);
  font-style: normal;
}

.row-icon--calc:hover {
  background: rgba(29, 127, 171, 0.15);
}

/* ── Collapsible rows (Passif & Frais) ───────────────────── */
.row--expandable > td:first-child {
  cursor: pointer;
}

.row--expandable > td:first-child::before {
  content: '\25B6'; /* ▶ */
  font-size: 9px;
  margin-right: 6px;
  color: var(--color-accent);
  transition: transform var(--transition-fast);
  display: inline-block;
  vertical-align: middle;
}

.row--expanded > td:first-child::before {
  transform: rotate(90deg);
}

.row--child {
  display: none;
}

.row--child.visible {
  display: table-row;
}

.row--child td {
  padding-left: var(--space-7);
  font-size: 13px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--color-text-muted);
}

.row--child:hover td {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Σ Calculation tooltip ────────────────────────────────── */
.calc-tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  background: var(--color-bg);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-overlay);
  font-family: var(--font-body);
  font-size: 12px;
  display: none;
  pointer-events: auto;
}

.calc-tooltip.visible {
  display: block;
}

.calc-tooltip__title {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-5);
}

.calc-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-border);
}

.calc-tooltip__row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.calc-tooltip__label {
  color: var(--color-text-muted);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-tooltip__value {
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.calc-tooltip__value--accent {
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.calc-tooltip__footer {
  margin-top: var(--space-5);
  color: var(--color-text-muted);
  font-size: 11px;
  text-align: right;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.calc-tooltip__footer:hover {
  color: var(--color-blue);
}

/* ── Sidebar scenario / choice sections ───────────────────── */
.sidebar-section {
  margin-bottom: var(--space-12);
}

.sidebar-section__label {
  font-family: var(--font-body);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4) 0;
}

/* Choice buttons (scenario selectors, toggles) */
.choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  margin-bottom: var(--space-2);
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: var(--leading-snug);
}

.choice-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
}

.choice-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.choice-btn--active {
  background: var(--color-accent);
  color: #000000;
  font-weight: var(--font-weight-bold);
  border-color: var(--color-accent);
}

.choice-btn--active:hover {
  background: var(--color-accent-hover);
  color: #000000;
}

/* Legal choice select */
.choice-select {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  margin-bottom: var(--space-4);
}

.choice-select:hover {
  border-color: var(--color-text-muted);
}

.choice-select:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-color: var(--color-accent);
}

/* Legal toggle container */
.legal-toggle {
  margin-bottom: var(--space-6);
}

/* ── Manhay year headings ─────────────────────────────────── */
.manhay-year-heading {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  margin: var(--space-8) 0 var(--space-4) 0;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  letter-spacing: var(--tracking-tight);
}

.manhay-year-heading:first-child {
  margin-top: 0;
}

/* ── Table container (active state — replaces .table-container placeholder) ── */
#table-container {
  width: 100%;
}

/* ── Manhay page ────────────────────────────────────────────── */
#manhay-page-content {
  width: 100%;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 700px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--color-border);
}

.chart-card h3 {
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px 0;
  font-family: var(--font-body);
  font-weight: 400;
}

.year-section {
  margin-bottom: 32px;
}

.year-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: 12px;
}

.year-section__title {
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.year-section__total {
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Year financial summary (revenues / expenses / net) */
.year-summary {
  margin-top: 8px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
}

.year-summary__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.year-summary__label {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.year-summary__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 13px;
}

/* Legal costs section */
.legal-costs-section {
  margin-top: 12px;
  padding: 12px;
  background: rgba(29, 127, 171, 0.08);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-blue);
}

.legal-costs-section__label {
  color: var(--color-blue);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 8px 0;
}
