/* ─────────────────────────────────────────────────────────────
   Registro Anestésico Digital — Estilos de impresión / PDF
   Equivalente del bloque @media print de app/globals.css
   ───────────────────────────────────────────────────────────── */

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm;
  }

  /* ── Precisión de color ── */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-shadow: none !important;
  }

  /* ── Tipografía base ── */
  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 8.5px !important;
    line-height: 1.35 !important;
  }

  /* ── Ocultar controles interactivos ── */
  button,
  [role="button"],
  .dropdown-menu,
  .dialog-overlay,
  .print-hide,
  [data-print="hide"] {
    display: none !important;
  }

  /* ── Inputs / textareas como texto plano ── */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  textarea,
  select {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: unset !important;
    outline: none !important;
    font-size: inherit !important;
    color: #111 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 100% !important;
    resize: none !important;
  }

  input[type="file"] { display: none !important; }

  input[type="checkbox"],
  input[type="radio"] {
    width: 8px !important;
    height: 8px !important;
  }

  label {
    color: #475569 !important;
    display: block !important;
    font-size: 7.5px !important;
  }

  /* ── Encabezado compacto ── */
  .app-header {
    border-bottom: 1.5px solid #334155 !important;
    padding: 5px 10px !important;
  }

  .app-header * { color: #111 !important; }
  .app-header-inner { padding: 0 !important; gap: 8px !important; }
  .brand-logo { height: 42px !important; }

  /* ── Solo el panel activo de cada grupo de pestañas ── */
  .tabs-list { display: none !important; }
  .tab-panel[data-state="inactive"] { display: none !important; }
  .tab-panel[data-state="active"] { display: block !important; opacity: 1 !important; }

  /* ── Sin límites de alto ── */
  .scroll-box,
  .scroll-box-lg,
  .dialog { max-height: none !important; overflow: visible !important; }

  .app-main { padding: 4px !important; }

  /* ── Compresión de espacios ── */
  .stack > * + * { margin-top: 5px !important; }
  .stack-sm > * + * { margin-top: 3px !important; }
  .stack-xs > * + * { margin-top: 2px !important; }
  .record-grid { gap: 5px !important; }
  .gap-6 { gap: 5px !important; }
  .gap-4 { gap: 4px !important; }
  .gap-3 { gap: 3px !important; }
  .gap-2 { gap: 2px !important; }

  .card { border-radius: 3px !important; }
  .card-header { padding: 4px 5px 3px !important; }
  .card-content { padding: 0 5px 5px !important; }
  .panel, .panel-primary, .panel-plain { padding: 4px !important; border-radius: 3px !important; }

  /* ── Escala tipográfica ── */
  .text-muted, .text-\[10px\] { color: #475569 !important; }
  .text-\[10px\] { font-size: 6.5px !important; }
  .text-xs { font-size: 7.5px !important; line-height: 1.2 !important; }
  .text-sm { font-size: 8.5px !important; line-height: 1.3 !important; }
  .text-base, .card-title { font-size: 9.5px !important; line-height: 1.3 !important; }
  .text-lg { font-size: 10px !important; }

  /* ── Tablas compactas ── */
  table { font-size: 7.5px !important; border-collapse: collapse !important; }
  th, td { padding: 1px 3px !important; }
  thead th { font-weight: 600 !important; }

  /* ── Iconos ── */
  svg.icon { width: 10px !important; height: 10px !important; }

  .badge, .chip, .tag { padding: 0 4px !important; font-size: 7px !important; }

  /* ─────────────────────────────────────────────
     REORGANIZACIÓN DE LA HOJA IMPRESA
     ───────────────────────────────────────────── */

  #print-vitals-section {
    width: 100% !important;
    margin-bottom: 5px !important;
    break-inside: avoid;
  }

  /* Gráfico interactivo oculto; se imprime la vista dedicada */
  #print-vitals-section .vitals-tabs { display: none !important; }

  #vitals-print-view { display: block !important; }

  /* El gráfico de impresión se dibuja a 700 px: no debe ampliarse */
  #vitals-print-view .chart-wrapper svg {
    width: 700px !important;
    max-width: 100% !important;
    height: auto !important;
  }

  #vitals-print-view .chart-legend { font-size: 6.5px !important; padding-top: 3px !important; }
  #vitals-print-view .chart-axis-text { font-size: 7px !important; }

  .pill { padding: 1px 4px !important; font-size: 7.5px !important; }

  /* Grilla de detalle oculta en la hoja impresa */
  #print-grid { display: none !important; }

  /* Firma exclusiva de impresión */
  .print-only-signature {
    display: block !important;
    margin-top: 12px !important;
    border-top: 1px solid #cbd5e1 !important;
    padding-top: 8px !important;
  }

  .print-only-signature .tabs-list,
  .print-only-signature .upload-drop { display: none !important; }
  .print-only-signature .signature-box { border: 1px solid #cbd5e1 !important; }
  .print-only-signature canvas { height: 70px !important; }

  /* ── Bloques incorporados del registro de referencia ── */

  /* Los seis tiempos entran en una sola franja */
  .time-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 4px !important;
  }

  /* La tabla de recuperación se dimensiona para el A4: en
     pantalla tiene ancho mínimo para poder desplazarse, en papel
     no debe desbordar ni quedar recortada por el contenedor. */
  .table-wrap { overflow: visible !important; }

  .recovery-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 6.5px !important;
  }

  .recovery-table th,
  .recovery-table td { padding: 1px 1px !important; }
  .recovery-table .input { min-width: 0 !important; font-size: 6.5px !important; }
  .recovery-table .th-unit { font-size: 5.5px !important; }

  /* Escalas: compactas y sin fondo */
  .score-block {
    background: transparent !important;
    padding: 4px 6px !important;
    margin-bottom: 4px !important;
    break-inside: avoid;
  }

  .score-row { grid-template-columns: 70px 1fr !important; gap: 4px !important; margin-bottom: 2px !important; }
  .score-total { border: none !important; padding: 0 !important; background: transparent !important; }

  /* Título del registro: ahora va en la hoja, no en el encabezado */
  .record-title { margin-bottom: 6px !important; }
  .record-title h1 { font-size: 12px !important; }
  .record-title p { font-size: 9px !important; }
}
