/* ============================================================
   Print Styles — Professional document templates
   Used by RecepcionPrint, CotizacionPrint, OrdenInternaPrint
   ============================================================ */

/* ---- Document container ---- */
.print-document {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 40px;
  font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
  background: #fff;
}

/*
 * Esta vista previa (no la hoja impresa, que el @media print de abajo
 * resetea a 100% de ancho) usa columnas de tabla con anchos fijos en px
 * que en celular no caben ni comprimidas. `html` tiene `overflow-x: hidden`
 * global (globals.css), asi que sin este scroll local el contenido que no
 * entra queda invisible y cortado en vez de mostrar una barra de scroll.
 */
@media screen and (max-width: 860px) {
  .print-page-wrapper {
    overflow-x: auto;
  }

  .print-document {
    padding: 20px 16px;
  }
}

/* ---- Header ---- */
.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid #e2e8f0;
}

.print-header-left {
  flex: 1;
}

.print-header-branded {
  align-items: center;
}

.print-store-logo {
  display: block;
  max-height: 74px;
  max-width: 520px;
  object-fit: contain;
  object-position: left center;
}

.print-company-name-compact {
  margin-top: 6px;
  font-size: 13px;
}

.print-store-address,
.print-store-phone {
  margin: 4px 0 0;
  max-width: 560px;
  white-space: pre-wrap;
  color: #334155;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
}

.print-store-phone {
  font-weight: 800;
}

.print-header-right {
  text-align: right;
  flex-shrink: 0;
}

.print-company-name {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
}

.print-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  margin: 4px 0 0 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.print-badge {
  display: inline-block;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.print-date {
  font-size: 12px;
  color: #64748b;
  margin: 6px 0 0 0;
}

/* ---- Divider ---- */
.print-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0 20px;
}

/* ---- Sections ---- */
.print-section {
  margin-bottom: 18px;
}

.print-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #64748b;
  margin: 0 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}

/* ---- Grids ---- */
.print-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}

.print-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
}

/* ---- Info tables (key-value) ---- */
.print-info-table {
  width: 100%;
  border-collapse: collapse;
}

.print-info-table td {
  padding: 3px 0;
  vertical-align: top;
}

.print-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  width: 100px;
}

.print-value {
  font-size: 13px;
  color: #1e293b;
}

.print-value-bold {
  font-weight: 700;
}

.print-big-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 4px 0 0 0;
}

.print-text-block {
  font-size: 13px;
  color: #334155;
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 4px 0 0 0;
}

.print-empty {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
  margin: 4px 0 0 0;
}

/* ---- Fuel bar ---- */
.print-fuel-bar {
  height: 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 6px 0 4px 0;
}

.print-fuel-fill {
  height: 100%;
  background: #334155;
  border-radius: 6px;
}

.print-fuel-label {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin: 2px 0 0 0;
}

/* ---- Tags ---- */
.print-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.print-tag {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
}

/* ---- Data tables ---- */
.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 12px;
}

.print-table th {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.print-table td {
  border: 1px solid #e2e8f0;
  padding: 5px 10px;
  vertical-align: top;
}

.print-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.print-col-narrow {
  width: 36px;
  text-align: center;
}

.print-col-code {
  width: 100px;
}

.print-col-type {
  width: 80px;
  text-align: center;
}

.print-col-number {
  width: 70px;
  text-align: right;
}

.print-col-money {
  width: 100px;
  text-align: right;
}

.print-col-check {
  width: 60px;
  text-align: center;
  font-size: 16px;
}

.print-mono {
  font-family: 'Courier New', monospace;
  font-size: 11px;
}

/* ---- Totals ---- */
.print-totals {
  margin-top: 12px;
  margin-left: auto;
  width: 260px;
}

.print-total-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  color: #475569;
}

.print-total-grand {
  border-top: 2px solid #0f172a;
  margin-top: 4px;
  padding-top: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.print-summary-row {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 11px;
  color: #94a3b8;
}

/* ---- Status ---- */
.print-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.print-status-badge {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.print-status-approved {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

/* ---- Signatures ---- */
.print-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 24px 0;
}

.print-signature-block {
  text-align: center;
}

.print-signature-line {
  border-bottom: 1px solid #94a3b8;
  height: 48px;
  margin-bottom: 6px;
}

.print-signature-img {
  max-width: 180px;
  max-height: 60px;
  margin: 0 auto 6px auto;
  display: block;
}

.print-signature-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin: 0;
}

.print-signature-sub {
  font-size: 11px;
  color: #94a3b8;
  margin: 2px 0 0 0;
}

/* ---- Footer ---- */
.print-footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.print-footer p {
  font-size: 10px;
  color: #94a3b8;
  margin: 2px 0;
}

.print-legal {
  font-size: 9px !important;
  color: #cbd5e1 !important;
  margin-top: 6px !important;
}

/* ---- Print-only page (wrapper for print routes) ---- */
.print-page-wrapper {
  min-height: 100vh;
  background: #fff;
}

.print-page-toolbar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

/* ============================================================
   @media print overrides
   ============================================================ */
@media print {
  /* Reset page */
  @page {
    size: letter;
    margin: 16mm 14mm;
  }

  html, body {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide everything except print document */
  .print-page-toolbar,
  .no-print,
  nav,
  aside,
  header:not(.print-header),
  [data-sidebar],
  [class*="sidebar"],
  [class*="dashboard-shell"],
  [class*="DashboardShell"] {
    display: none !important;
  }

  .print-page-wrapper {
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-document {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  /* Prevent breaks inside sections */
  .print-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }

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

  .print-table tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Signatures always on same page */
  .print-signatures {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Footer at bottom */
  .print-footer {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Fuel bar prints correctly */
  .print-fuel-bar {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-fuel-fill {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Table header repeats on new pages */
  .print-table thead {
    display: table-header-group;
  }
}
