/* ==========================================================================
   NOTARIA-41 — ESTILOS DE IMPRESIÓN
   FASE 8 del PLAN_EJECUCION
   ========================================================================== */

@media print {
  /* ----------------------------------------------------------------------
     Reset general
     ---------------------------------------------------------------------- */
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    font-family: "Times New Roman", Times, serif;
  }

  /* ----------------------------------------------------------------------
     Ocultar UI no imprimible
     ---------------------------------------------------------------------- */
  .main-header,
  .main-sidebar,
  .main-footer,
  .sidebar-toggle,
  .navbar,
  .content-header .breadcrumb,
  .btn,
  button,
  .dataTables_filter,
  .dataTables_length,
  .dataTables_paginate,
  .dataTables_info,
  .notary-dt-toolbar,
  .notary-dt-footer,
  .notary-dt-buttons,
  .dt-buttons,
  .theme-toggle,
  .theme-dropdown,
  .dropdown-menu,
  .modal,
  .modal-backdrop,
  .notary-modal-overlay,
  .no-print,
  .hide-on-print,
  .noprint,
  .sidebar-mini .content-wrapper,
  .sidebar-mini .main-footer {
    display: none !important;
  }

  /* ----------------------------------------------------------------------
     Remover sidebar en impresión
     ---------------------------------------------------------------------- */
  .content-wrapper,
  .right-side {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .wrapper {
    overflow: visible !important;
  }

  /* ----------------------------------------------------------------------
     Tablas
     ---------------------------------------------------------------------- */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  th,
  td {
    border: 1px solid #000 !important;
    padding: 6px 8px !important;
    text-align: left;
  }

  th {
    font-weight: bold;
    background: #f0f0f0 !important;
    color: #000 !important;
  }

  /* Colapsar DataTables responsive */
  table.dataTable.dtr-inline.collapsed > tbody > tr > td:first-child::before,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th:first-child::before {
    display: none !important;
  }

  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 8px !important;
  }

  /* Mostrar detalles expandidos de responsive */
  table.dataTable > tbody > tr.child ul.dtr-details {
    display: block !important;
    width: 100% !important;
  }

  table.dataTable > tbody > tr.child span.dtr-title {
    font-weight: bold;
  }

  /* ----------------------------------------------------------------------
     Tarjetas y contenedores
     ---------------------------------------------------------------------- */
  .box,
  .panel,
  .notary-card,
  .small-box,
  .info-box {
    border: 1px solid #000 !important;
    break-inside: avoid;
    margin-bottom: 12pt;
    page-break-inside: avoid;
  }

  .box-header,
  .notary-card-header {
    border-bottom: 1px solid #000 !important;
    padding: 8px 12px !important;
  }

  .box-title,
  .notary-card-title {
    font-size: 14pt;
    font-weight: bold;
  }

  /* ----------------------------------------------------------------------
     KPI / indicadores
     ---------------------------------------------------------------------- */
  .notary-kpi {
    break-inside: avoid;
    border: 1px solid #000 !important;
    padding: 12pt;
    margin-bottom: 10pt;
  }

  .notary-kpi-icon {
    display: none;
  }

  .notary-kpi-value {
    font-size: 24pt;
    font-weight: bold;
  }

  /* ----------------------------------------------------------------------
     Badges y etiquetas
     ---------------------------------------------------------------------- */
  .notary-badge {
    border: 1px solid #000 !important;
    padding: 2px 8px !important;
    font-size: 10pt;
  }

  /* ----------------------------------------------------------------------
     Encabezados de página
     ---------------------------------------------------------------------- */
  .content-header {
    margin: 0 0 16pt 0 !important;
    padding: 0 !important;
    border-bottom: 2px solid #000 !important;
    page-break-after: avoid;
  }

  .content-header h1 {
    font-size: 18pt;
    margin: 0 0 4pt 0;
  }

  .notary-page-title {
    font-size: 18pt;
  }

  .notary-page-subtitle {
    font-size: 11pt;
    color: #333 !important;
  }

  /* ----------------------------------------------------------------------
     Formularios
     ---------------------------------------------------------------------- */
  input,
  select,
  textarea {
    border: 1px solid #000 !important;
    padding: 4px 6px !important;
    font-size: 10pt;
  }

  .form-group {
    break-inside: avoid;
    margin-bottom: 8pt;
  }

  /* ----------------------------------------------------------------------
     Gráficas (Chart.js)
     ---------------------------------------------------------------------- */
  canvas {
    max-width: 100% !important;
    height: auto !important;
  }

  /* ----------------------------------------------------------------------
     Enlaces
     ---------------------------------------------------------------------- */
  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #333 !important;
  }

  /* No mostrar URL de enlaces internos o anclas */
  a[href^="#"]::after,
  a[href^="javascript:"]::after,
  a[href^="mailto:"]::after,
  a[data-toggle]::after,
  a.onclick::after {
    content: "";
  }

  /* ----------------------------------------------------------------------
     Márgenes de página
     ---------------------------------------------------------------------- */
  @page {
    margin: 1.5cm 1.8cm;
    size: letter;
  }

  @page :first {
    margin-top: 1cm;
  }

  /* ----------------------------------------------------------------------
     Saltos de página
     ---------------------------------------------------------------------- */
  .page-break-before {
    page-break-before: always;
  }

  .page-break-after {
    page-break-after: always;
  }

  .no-break-inside {
    page-break-inside: avoid;
  }

  /* ----------------------------------------------------------------------
     Marca de agua / pie de página notarial
     ---------------------------------------------------------------------- */
  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8pt;
    color: #999 !important;
    border-top: 1px solid #ccc;
    padding-top: 4pt;
  }

  .print-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 8pt;
  }

  /* ----------------------------------------------------------------------
     Utilidades de impresión
     ---------------------------------------------------------------------- */
  .visible-print {
    display: block !important;
  }

  .visible-print-inline {
    display: inline !important;
  }

  .visible-print-inline-block {
    display: inline-block !important;
  }

  .hidden-print {
    display: none !important;
  }
}