/* ============================================
   PDF Export PRO - Rivaria Capital
   Simulateur Assurance-Vie
   Direction artistique identique au simulateur
   ============================================ */

@media print {
  @page {
    size: A4;
    margin: 15mm 12mm;
  }
}

/* ==================
   VARIABLES - IDENTIQUES AU SIMULATEUR
   ================== */

.report-container {
  /* Couleurs Rivaria */
  --premium-navy: #023A68;
  --premium-blue: #1870EF;
  --premium-gold: #1870EF;
  --premium-silver: #8B9DC3;
  --premium-success: #2D7A4F;
  --premium-warning: #D97706;
  --premium-error: #B91C1C;

  /* Backgrounds - Rivaria */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F7F7F7;
  --bg-elevated: #FCFCFD;

  /* Textes - EXACTES */
  --text-primary: #0A1628;
  --text-secondary: #4B5563;
  --text-tertiary: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Bordures - EXACTES */
  --border-light: #E5E7EB;
  --border-medium: #D1D5DB;
  --border-dark: #9CA3AF;

  /* Ombres Premium - EXACTES */
  --shadow-xs: 0 1px 2px 0 rgba(10, 22, 40, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(10, 22, 40, 0.06), 0 2px 2px -1px rgba(10, 22, 40, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(10, 22, 40, 0.08), 0 2px 4px -2px rgba(10, 22, 40, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(10, 22, 40, 0.10), 0 4px 6px -4px rgba(10, 22, 40, 0.06);

  /* Espacements Premium - EXACTES */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3rem;

  /* Radius Premium - EXACTES */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Typographie - Rivaria */
  --font-sans: 'Instrument Sans', -apple-system, sans-serif;
  --font-serif: 'Instrument Sans', -apple-system, sans-serif;

  /* Poids - EXACTES */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Tailles - EXACTES */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
}

/* ==================
   BASE CONTAINER
   ================== */

.report-container {
  display: none;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.report {
  background: var(--bg-primary);
}

/* ==================
   PAGE DE GARDE - EXACT HERO SIMULATEUR
   ================== */

.report-header {
  background: linear-gradient(135deg,
    var(--premium-navy) 0%,
    var(--premium-blue) 100%
  );
  color: var(--text-inverse);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  min-height: 260mm;
  page-break-after: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
}

.report-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(184, 134, 11, 0.05) 100%
  );
  pointer-events: none;
}

.report-header > div {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 100%;
}

.report-header h1 {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: var(--font-bold);
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-inverse);
}

.report-header .report-meta {
  font-size: var(--text-xl);
  color: rgba(255, 255, 255, 0.9);
  margin: var(--space-lg) 0;
  line-height: 1.6;
}

.report-header .logo {
  width: 200px;
  height: auto;
  margin-top: var(--space-3xl);
  opacity: 0.95;
  filter: brightness(0) invert(1);
}

/* ==================
   SECTIONS - STYLE SIMULATEUR
   ================== */

.report-section {
  background: var(--bg-primary);
  padding: var(--space-2xl) var(--space-xl);
  page-break-inside: avoid;
}

.report-section h2 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--premium-navy);
  margin: 0 0 var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--premium-blue);
  letter-spacing: -0.025em;
}

.report-section h3 {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--premium-blue);
  margin: var(--space-xl) 0 var(--space-md);
}

.report-section p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: var(--space-sm) 0;
}

/* ==================
   GRILLES - STYLE SIMULATEUR
   ================== */

.report-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.report-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  page-break-inside: avoid;
}

.report-card strong {
  font-weight: var(--font-semibold);
  color: var(--premium-navy);
  display: block;
  margin-bottom: var(--space-md);
  font-size: var(--text-base);
}

/* ==================
   SUMMARY CARDS - ASSURANCE-VIE
   ================== */

.report-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.report-summary-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--premium-navy);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  page-break-inside: avoid;
}

.report-summary-card h4 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-md);
}

.report-summary-card .value {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: var(--font-bold);
  color: var(--premium-navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin: 0;
}

/* ==================
   TABLEAUX - STYLE SIMULATEUR
   ================== */

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--bg-primary);
  margin-bottom: var(--space-lg);
}

.report-table th {
  background: linear-gradient(135deg, var(--premium-navy) 0%, var(--premium-blue) 100%);
  color: var(--text-inverse);
  font-weight: var(--font-semibold);
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-table td {
  padding: var(--space-sm) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.report-table tr:last-child td {
  border-bottom: none;
}

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

.report-table td:first-child {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

.report-table td:last-child {
  text-align: right;
  font-weight: var(--font-semibold);
  color: var(--premium-navy);
  font-variant-numeric: tabular-nums;
}

.report-table tr.is-total {
  background: var(--bg-elevated);
  border-top: 2px solid var(--premium-navy);
  border-bottom: 2px solid var(--premium-navy);
}

.report-table tr.is-total td {
  padding: var(--space-md) var(--space-lg);
  font-weight: var(--font-bold);
  color: var(--premium-navy);
  font-size: var(--text-base);
}

/* Tables de projection détaillées */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--bg-primary);
}

table thead {
  display: table-header-group;
  background: linear-gradient(135deg, var(--premium-navy) 0%, var(--premium-blue) 100%);
  color: var(--text-inverse);
}

table thead th {
  font-weight: var(--font-semibold);
  text-align: left;
  padding: var(--space-md) var(--space-sm);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--premium-navy);
}

table tbody td {
  padding: var(--space-sm) var(--space-sm);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: var(--text-xs);
}

table tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

table tbody tr.row-total {
  background: var(--bg-elevated);
  border-top: 2px solid var(--premium-navy);
  border-bottom: 2px solid var(--premium-navy);
  font-weight: var(--font-bold);
}

/* ==================
   GRAPHIQUES - STYLE SIMULATEUR
   ================== */

.report-chart-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: var(--space-md) 0;
  background: var(--bg-primary);
  padding: var(--space-md);
  border: 1px solid var(--border-light);
}

.report-graphics-section {
  page-break-before: always;
}

.report-graphics-section .report-card {
  margin-bottom: var(--space-xl);
}

/* ==================
   FOOTER / DISCLAIMERS - DISCRET
   ================== */

.report-footer {
  background: transparent;
  border-top: 1px solid var(--border-light);
  padding: var(--space-md) 0;
  margin-top: var(--space-lg);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
}

.report-footer strong {
  color: var(--text-secondary);
  font-weight: var(--font-semibold);
}

/* ==================
   PAGINATION
   ================== */

.page-break {
  page-break-after: always;
}

.page-break-before {
  page-break-before: always;
}

.avoid-break {
  page-break-inside: avoid;
}

.no-page-break {
  page-break-inside: avoid;
}

/* Classes spécifiques assurance-vie */
.tableau-projection-details-wrapper,
.tableau-sortie-totale-wrapper,
.tableau-sortie-totale-container,
.tableau-sortie-totale-title-and-first,
.pedagogic-subsection {
  page-break-inside: avoid;
}

/* ==================
   OPTIMISATIONS PRINT
   ================== */

@media print {
  .report-container {
    display: block !important;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color-adjust: exact;
  }

  .report-card,
  .report-section,
  .report-summary-card {
    page-break-inside: avoid;
  }

  .report-header {
    page-break-after: always;
  }

  .report-table {
    page-break-inside: auto;
  }

  .report-table thead {
    display: table-header-group;
  }

  .report-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  table thead {
    display: table-header-group;
  }

  table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  p, h2, h3 {
    orphans: 3;
    widows: 3;
  }

  h2, h3 {
    page-break-after: avoid;
  }

  .report-chart-img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}

/* ==================
   UTILITAIRES
   ================== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: var(--font-bold);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-navy {
  color: var(--premium-navy);
}

.text-gold {
  color: var(--premium-gold);
}

.mb-sm {
  margin-bottom: var(--space-sm);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.value-missing::after {
  content: '—';
  color: var(--text-tertiary);
}
