/*
──────────────────────────────────────────────────────────────────
Copyright (c) 2026 Ilhom Abdullayev (@aib81).
Proyekt: AT MEDSERT — sertifikatsiya tizimi (ISO 13485).
Email: ilhom8108@gmail.com · Telegram: @aib81 (id: 834760045)

Mualliflik huquqi muallifga tegishli. Without written permission —
no copying, forking, or commercial use is allowed.
──────────────────────────────────────────────────────────────────
*/
/* Web 035: фирменные стили печати (FMXM brand).
 *
 * При печати любой страницы:
 * - скрываем навигацию, footer, кнопки действий, чат-ассистент
 * - добавляем шапку с лого + полное название организации
 * - добавляем подвал с контактами + дата/время печати
 * - чёрный текст на белом, без декоративных теней
 */

@media print {
  /* Базовые правила: белый фон, чёрный текст, без теней */
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  body {
    margin: 0;
    padding: 0;
    font-size: 11pt;
    line-height: 1.4;
  }

  /* Скрываем то что не нужно на бумаге */
  .app-nav,
  .nav,
  .auth-topbar,
  .nav__top-settings,
  .page-header__actions,
  .dashboard-hero,
  .form-actions,
  .btn,
  button,
  .ariza-file-link::before,
  .file-preview-modal,
  .file-preview-backdrop,
  .col-toggle-menu,
  .col-filter-menu,
  #ai-fab,
  #ai-drawer,
  .ai-fab,
  .ai-drawer,
  [data-action],
  .nav-backdrop,
  .filters,
  .page-header__meta,
  .footer,
  footer,
  .pwa-install,
  [hidden] {
    display: none !important;
  }

  /* Контейнер контента — без отступов под sidebar */
  .app-layout,
  .layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  main, .main {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Брендированный header — рисуется через @page + ::before */
  @page {
    margin: 2cm 1.5cm 2cm 1.5cm;
    size: A4;
  }

  /* Шапка организации в начале первой страницы */
  body::before {
    content: "FARMATSEVTIKA MAHSULOTLARI XAVFSIZLIGI MARKAZI · Davlat muassasasi";
    display: block;
    text-align: center;
    border-bottom: 2pt solid #007084 !important;
    color: #007084 !important;
    font-size: 9pt;
    font-weight: 700;
    letter-spacing: 0.5pt;
    padding-bottom: 6pt;
    margin-bottom: 14pt;
  }

  /* Подвал */
  body::after {
    content: "AT MEDSERT · O'zMSt ISO 13485:2025 · +998 71 203 01 01 · www.uzpharm-control.uz";
    display: block;
    text-align: center;
    border-top: 1pt solid #ccc !important;
    color: #555 !important;
    font-size: 8pt;
    font-style: italic;
    padding-top: 6pt;
    margin-top: 24pt;
  }

  /* Таблицы — простые, читаемые */
  table, .data-table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto;
  }
  th, td {
    border: 1pt solid #999 !important;
    padding: 4pt 6pt !important;
    font-size: 9pt !important;
    text-align: left !important;
    vertical-align: top !important;
  }
  th {
    background: #007084 !important;
    color: #fff !important;
    font-weight: 700;
  }
  thead { display: table-header-group; }  /* повторение шапки на каждой странице */
  tr { page-break-inside: avoid; }

  /* Заголовки */
  h1 { font-size: 16pt !important; color: #007084 !important; }
  h2 { font-size: 13pt !important; color: #007084 !important; }
  h3 { font-size: 11pt !important; color: #333 !important; }

  /* Ссылки — раскрываем URL рядом */
  a[href]:not([href^="#"]):not(.no-print-href)::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    color: #555 !important;
  }

  /* Бейджи / тэги в чёрно-белом */
  .badge {
    border: 1pt solid #000 !important;
    padding: 1pt 4pt;
    font-size: 8pt;
  }

  /* Принудительные разрывы страниц */
  .page-break,
  .print-page-break { page-break-before: always; }

  /* Картинки не растягиваем за поля */
  img { max-width: 100% !important; }
}
