/* ==========================================================================
   PLANTILLAS OFICIALES DE IMPRESIÓN Y PDF CUPLAST DE OCCIDENTE SA DE CV
   Diseño corporativo ejecutivo limpio, vertical en 1 sola página, sin cuadrícula pesada de Excel
   ========================================================================== */

@page {
  size: letter portrait;
  margin: 8mm 10mm 8mm 10mm;
}

@media screen {
  .print-only-container {
    display: none;
  }
}

@media print {
  /* 1. Ocultar completamente la interfaz interactiva para no generar página 1 en blanco */
  header,
  nav,
  main,
  aside,
  footer,
  .odoo-topbar,
  .odoo-subbar,
  .app-container,
  .modal-backdrop,
  .toast-container,
  .waffle-dropdown,
  .view-section {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* 2. El contenedor de impresión arranca en la página 1 de forma limpia */
  .print-only-container {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  .print-only-container * {
    visibility: visible !important;
  }

  .cuplast-pdf-page {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }
}

/* --------------------------------------------------------------------------
   DOCUMENTO DE COTIZACIÓN CORPORATIVO CUPLAST (DISEÑO EJECUTIVO SIN LÍNEAS EXCEL)
   -------------------------------------------------------------------------- */
.cuplast-pdf-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: #ffffff;
  padding: 10px 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
  font-size: 10px;
  box-sizing: border-box;
}

/* 1. ENCABEZADO CORPORATIVO: UN SOLO LOGO A LA IZQUIERDA + DATOS + FOLIO */
.corp-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #0284c7;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.corp-header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.corp-logo-img {
  width: 180px;
  max-height: 80px;
  height: auto;
  object-fit: contain;
  display: block;
}

.corp-company-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.corp-company-title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin: 0;
  text-transform: uppercase;
}

.corp-company-sub {
  font-size: 9.5px;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

.corp-company-contact {
  font-size: 9px;
  color: #334155;
  margin: 3px 0 0 0;
}

.corp-company-contact strong {
  color: #0284c7;
}

/* CAJA DE FOLIO Y FECHA SUPERIOR DERECHA */
.corp-folio-box {
  text-align: right;
  min-width: 150px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
}

.corp-folio-badge {
  font-size: 8.5px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.corp-folio-number {
  font-size: 16px;
  font-weight: 800;
  color: #0284c7;
  margin: 1px 0;
}

.corp-folio-date, .corp-folio-validity {
  font-size: 9px;
  color: #475569;
}

/* 2. TARJETA DE CLIENTE Y CONDICIONES COMERCIALES (SIN LÍNEAS PESADAS) */
.corp-client-card {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 12px;
}

.corp-meta-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.corp-meta-label {
  font-size: 8px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.corp-meta-val {
  font-size: 10.5px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
}

/* 3. TABLA DE PRODUCTOS (MODERNA, LIMPIA, SIN BORDES PESADOS EXCEL) */
.corp-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
  margin-bottom: 12px;
  table-layout: fixed;
}

.corp-items-table thead tr {
  background: #0f172a;
  color: #ffffff;
}

.corp-items-table th {
  padding: 6px 6px;
  font-weight: 700;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: none;
}

.corp-items-table th.center { text-align: center; }
.corp-items-table th.right { text-align: right; }
.corp-items-table th.left { text-align: left; padding-left: 10px; }

.corp-items-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

.corp-items-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.corp-items-table td {
  padding: 5.5px 6px;
  font-size: 9px;
  color: #1e293b;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.corp-items-table td.desc-cell {
  text-align: left;
  font-weight: 600;
  color: #0f172a;
  padding-left: 10px;
}

.corp-items-table td.center { text-align: center; }
.corp-items-table td.right { 
  text-align: right; 
  font-variant-numeric: tabular-nums;
  padding-right: 6px;
}

.corp-items-table td.highlight-mxn {
  color: #15803d;
  font-weight: 700;
}

.corp-items-table td.highlight-usd {
  color: #0369a1;
  font-weight: 600;
}

/* 4. SECCIÓN INFERIOR: RESUMEN TÉCNICO, NOTA LEGAL Y TOTALES */
.corp-bottom-section {
  display: grid;
  grid-template-columns: 190px 1fr 240px;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 10px;
}

/* TARJETA TÉCNICA */
.corp-tech-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.corp-tech-title {
  font-size: 8px;
  font-weight: 700;
  color: #0284c7;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.corp-tech-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8.5px;
  padding: 2px 0;
  border-bottom: 1px solid #f1f5f9;
}

.corp-tech-row:last-child {
  border-bottom: none;
}

.corp-tech-lbl {
  color: #64748b;
  font-weight: 500;
}

.corp-tech-val {
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

/* NOTA CAMBIARIA LEGAL DOF */
.corp-legal-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f8fafc;
  border-left: 3px solid #0284c7;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
}

.corp-legal-title {
  font-size: 8px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.corp-legal-text {
  font-size: 8px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
  text-align: justify;
}

/* TARJETA DE TOTALES EJECUTIVA */
.corp-totals-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.corp-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  padding: 2px 0;
}

.corp-total-lbl {
  color: #475569;
  font-weight: 500;
}

.corp-total-val {
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.corp-total-usd-highlight {
  font-size: 11px;
  font-weight: 800;
  color: #0369a1;
  border-top: 1px solid #e2e8f0;
  padding-top: 4px;
  margin-top: 2px;
}

.corp-total-mxn-highlight {
  font-size: 11.5px;
  font-weight: 800;
  color: #15803d;
  background: #ecfdf5;
  padding: 4px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

/* 5. PIE DE PÁGINA CORPORATIVO */
.corp-pdf-footer {
  border-top: 1px solid #e2e8f0;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: #64748b;
  margin-top: 6px;
}

.corp-footer-left strong {
  color: #0f172a;
}

.corp-footer-right {
  font-style: italic;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   CERTIFICADO OFICIAL DE GARANTÍA CUPLAST CON QR (PRESERVADO)
   -------------------------------------------------------------------------- */
.certificate-container {
  max-width: 850px;
  margin: 0 auto;
  background: #ffffff;
  border: 8px double #152942;
  padding: 36px 40px;
  position: relative;
  font-family: 'Times New Roman', Times, serif;
}

.cert-header {
  text-align: center;
  border-bottom: 2px solid #152942;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.cert-logos-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cert-logos-row img {
  height: 55px;
  width: auto;
}

.cert-title-main {
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 2px;
  color: #152942;
  text-transform: uppercase;
}

.cert-subtitle {
  font-size: 14px;
  font-style: italic;
  color: #475569;
}

.cert-body-text {
  font-size: 14px;
  line-height: 1.8;
  color: #1f2937;
  text-align: justify;
  margin-bottom: 20px;
}

.cert-specs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.cert-specs-table th, .cert-specs-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
}

.cert-specs-table th {
  background: #f1f5f9;
  text-align: left;
  color: #152942;
  font-weight: bold;
}

.cert-footer-grid {
  display: grid;
  grid-template-columns: 140px 1fr 180px;
  gap: 20px;
  align-items: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.cert-qr-box {
  text-align: center;
}

.cert-qr-box img, .cert-qr-box canvas {
  width: 110px;
  height: 110px;
  border: 1px solid #cbd5e1;
  padding: 4px;
}

.cert-qr-instruction {
  font-size: 9px;
  font-family: Arial, sans-serif;
  color: #64748b;
  margin-top: 4px;
}

.cert-seal-box {
  text-align: center;
}

.cert-signature-line {
  width: 180px;
  border-top: 1px solid #000000;
  margin: 30px auto 4px auto;
}

.cert-sign-title {
  font-family: Arial, sans-serif;
  font-size: 10px;
  font-weight: bold;
}

/* -------------------------------------------------------------------------
   FORMATO DE FACTURA FISCAL CFDI 4.0 PROFORMA Y ESTADO DE CUENTA
   ------------------------------------------------------------------------- */
.cuplast-invoice-page {
  page-break-inside: avoid !important;
  page-break-after: avoid !important;
  page-break-before: avoid !important;
  width: 100% !important;
  max-width: 100% !important;
  background: #ffffff !important;
  color: #1e293b !important;
  font-family: Arial, sans-serif !important;
}

.cuplast-invoice-page table {
  border-collapse: collapse !important;
  width: 100% !important;
}

.cuplast-invoice-page th,
.cuplast-invoice-page td {
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 4px 6px !important;
}

