/* ==========================================================================
   MundoABC.com - Certificado Formal Oficial de Impresión / PDF
   FORMATO ÚNICO Y EXCLUSIVO: Hoja blanca ejecutiva, texto oscuro nítido.
   Elimina encabezados feos del navegador (fecha, URL, title) y genera
   un documento corporativo impecable de 1 página.
   ========================================================================== */

#mundoabc-official-report {
  display: none !important;
}

@media print {
  /* Ocultar todos los elementos de la web cuando existe el reporte oficial generado */
  body.has-official-report > *:not(#mundoabc-official-report),
  body:has(#mundoabc-official-report) > *:not(#mundoabc-official-report) {
    display: none !important;
  }

  /* Fallback: Si se imprime directamente sin reporte generado, ocultar solo elementos interactivos */
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) header,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) nav,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) footer,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) .no-print,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) #mobile-menu,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) .country-dropdown-menu,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) button {
    display: none !important;
  }

  /* Garantizar que en fallback el texto jamás sea blanco sobre fondo blanco */
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) * {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    text-shadow: none !important;
  }
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) main,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) div,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) section,
  body:not(.has-official-report):not(:has(#mundoabc-official-report)) article {
    background-color: transparent !important;
    box-shadow: none !important;
  }

  /* 
   * margin: 0 en @page elimina los textos automáticos del navegador
   * (la fecha a la izquierda y el título largo de la web arriba)
   */
  @page {
    size: letter portrait;
    margin: 0;
  }

  /* BLINDAJE MONOCROMO ABSOLUTO: CERO FONDOS OSCUROS O COLORES EN IMPRESIÓN / PDF */
  html, html.dark, html body, html.dark body, body, body.dark, body.dark-mode {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    color-scheme: light !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 
   * El padding interno le da el margen perfecto de 12mm 16mm a la hoja,
   * reemplazando limpiamente el margen del navegador.
   */
  #mundoabc-official-report {
    display: block !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12mm 16mm !important;
    background-color: #ffffff !important;
    color: #0f172a !important;
  }

  /* Encabezado Membretado Oficial MundoABC Monocromo */
  #mundoabc-official-report .mabc-doc-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    border-bottom: 2px solid #000000 !important;
    padding-bottom: 10px !important;
    margin-bottom: 14px !important;
    background: transparent !important;
  }

  #mundoabc-official-report .mabc-brand-title {
    font-size: 20pt !important;
    font-weight: 900 !important;
    color: #000000 !important;
    line-height: 1 !important;
    margin: 0 0 3px 0 !important;
  }

  #mundoabc-official-report .mabc-brand-title span {
    color: #000000 !important;
  }

  #mundoabc-official-report .mabc-brand-sub {
    font-size: 8pt !important;
    font-weight: 700 !important;
    color: #333333 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
  }

  #mundoabc-official-report .mabc-meta-box {
    text-align: right !important;
    font-size: 8.5pt !important;
    color: #000000 !important;
    line-height: 1.4 !important;
  }

  #mundoabc-official-report .mabc-meta-folio {
    font-family: 'JetBrains Mono', Courier, monospace !important;
    font-weight: 700 !important;
    color: #000000 !important;
  }

  #mundoabc-official-report .mabc-meta-pill {
    display: inline-block !important;
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    color: #000000 !important;
    font-size: 7.5pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    margin-top: 4px !important;
  }

  /* Tarjeta Destacada del Resultado (100% Monocromo / Tinta Negra) */
  #mundoabc-official-report .mabc-hero-card {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    margin-bottom: 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  #mundoabc-official-report .mabc-hero-label {
    font-size: 9pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    color: #000000 !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 2px !important;
  }

  #mundoabc-official-report .mabc-hero-subtitle {
    font-size: 8pt !important;
    color: #444444 !important;
  }

  #mundoabc-official-report .mabc-hero-amount {
    font-family: 'JetBrains Mono', Courier, monospace !important;
    font-size: 22pt !important;
    font-weight: 900 !important;
    color: #000000 !important;
    text-align: right !important;
    line-height: 1 !important;
  }

  /* Título del documento */
  #mundoabc-official-report .mabc-title-box {
    margin-bottom: 14px !important;
    text-align: left !important;
  }

  #mundoabc-official-report .mabc-title-box h1 {
    font-size: 15pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 3px 0 !important;
    line-height: 1.2 !important;
  }

  #mundoabc-official-report .mabc-title-box p {
    font-size: 9pt !important;
    color: #475569 !important;
    margin: 0 !important;
  }

  #mundoabc-official-report .mabc-highlight-extra {
    font-size: 8.5pt !important;
    color: #64748b !important;
  }

  /* Parámetros de la simulación */
  #mundoabc-official-report .mabc-params-box {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 7px 12px !important;
    font-size: 8pt !important;
    color: #475569 !important;
    margin-bottom: 14px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px 18px !important;
  }

  #mundoabc-official-report .mabc-param-item {
    color: #475569 !important;
  }

  #mundoabc-official-report .mabc-param-item strong {
    color: #0f172a !important;
    font-weight: 700 !important;
  }

  /* Tablas de Desglose en 2 Columnas */
  #mundoabc-official-report .mabc-tables-container {
    width: 100% !important;
    margin-bottom: 14px !important;
  }

  #mundoabc-official-report .mabc-table-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }

  #mundoabc-official-report .mabc-section-title {
    font-size: 9pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
    padding-bottom: 4px !important;
    margin-bottom: 6px !important;
  }

  #mundoabc-official-report .mabc-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8pt !important;
    background-color: #ffffff !important;
  }

  #mundoabc-official-report .mabc-table th {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    font-weight: 800 !important;
    text-align: left !important;
    padding: 5px 8px !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
  }

  #mundoabc-official-report .mabc-table td {
    padding: 5px 8px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    background-color: #ffffff !important;
  }

  #mundoabc-official-report .mabc-table tr:nth-child(even) td {
    background-color: #f8fafc !important;
  }

  #mundoabc-official-report .mabc-table .val-col {
    text-align: right !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }

  #mundoabc-official-report .mabc-table .row-total td {
    font-weight: 900 !important;
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-top: 1.5px solid #cbd5e1 !important;
    border-bottom: 1.5px solid #cbd5e1 !important;
  }

  #mundoabc-official-report .mabc-badge-discount {
    color: #b91c1c !important;
  }

  #mundoabc-official-report .mabc-badge-income {
    color: #047857 !important;
  }

  /* Pie de página legal */
  #mundoabc-official-report .mabc-doc-footer {
    border-top: 1px solid #cbd5e1 !important;
    padding-top: 8px !important;
    margin-top: 12px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 7pt !important;
    color: #64748b !important;
    line-height: 1.35 !important;
  }

  #mundoabc-official-report .mabc-legal-note {
    max-width: 82% !important;
    color: #64748b !important;
  }

  #mundoabc-official-report .mabc-seal-box {
    text-align: right !important;
  }

  #mundoabc-official-report .mabc-seal-stamp {
    display: inline-block !important;
    border: 1.5px solid #059669 !important;
    color: #059669 !important;
    font-size: 7pt !important;
    font-weight: 800 !important;
    padding: 3px 6px !important;
    border-radius: 4px !important;
    letter-spacing: 0.5px !important;
  }
}

/* MONOCHROME EXECUTIVE PERFECTION - ESTÁNDAR PABLO */
@media print {
  * {
    color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }
  
  #mundoabc-official-report {
    background: #ffffff !important;
    color: #000000 !important;
  }

  #mundoabc-official-report * {
    background-color: transparent !important;
    color: #000000 !important;
  }

  #mundoabc-official-report .mabc-hero-card {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
  }

  #mundoabc-official-report .mabc-hero-amount {
    color: #000000 !important;
  }

  #mundoabc-official-report .mabc-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border-bottom: 1.5px solid #000000 !important;
  }

  #mundoabc-official-report .mabc-table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #000000 !important;
  }

  #mundoabc-official-report .mabc-seal-stamp {
    border: 1.5px solid #000000 !important;
    color: #000000 !important;
  }
}

/* La especificidad debe superar tanto el tema inline como las utilidades
   dark de Tailwind: imprimir desde modo oscuro también consume tinta negra. */
@media print {
  html:root:root,
  html:root:root body {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    color-scheme: light !important;
  }

  html:root:root:root #mundoabc-official-report,
  html:root:root:root #mundoabc-official-report * {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
    border-color: #000000 !important;
  }

  #mundoabc-official-report .mabc-table-grid:has(> :only-child) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
