/* ── 印刷用スタイル（media="print" で読み込むため、通常表示のレンダリングをブロックしない） ── */
@media print {
  /* ヘッダー・フッター・ナビゲーションを非表示 */
  header,
  footer,
  nav,
  .fixed,
  .sticky,
  button[id^="print-"]::before,
  .no-print {
    display: none !important;
  }

  /* 印刷ボタン自体も非表示 */
  [data-print-hide] {
    display: none !important;
  }

  /* サイドバー・補助ナビを確実に非表示 */
  aside,
  nav {
    display: none !important;
  }

  /* 管理画面flexレイアウトを印刷時はブロックに */
  .print-block {
    display: block !important;
  }
  .print-w-full {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ── アノマリー検知タブ印刷対策 ── */
  .print-flex-col {
    flex-direction: column !important;
  }
  .print-items-start {
    align-items: flex-start !important;
  }
  .print-grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
  }
  .print-grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .print-gap-2 {
    gap: 0.5rem !important;
  }

  /* アニメーション無効化 */
  .animate-pulse,
  .animate-spin,
  .animate-bounce,
  .animate-ping {
    animation: none !important;
  }

  /* テーブル横スクロール解除 */
  .overflow-x-auto {
    overflow-x: visible !important;
    width: 100% !important;
  }

  /* テーブルのmin-width制約を解除 */
  table {
    min-width: 100% !important;
    width: 100% !important;
    table-layout: auto !important;
  }

  /* スクロール連動用の高さ要素を非表示 */
  div[style*="height: 12px"],
  div[style*="height: 16px"] {
    display: none !important;
  }

  /* フローティングボタン・ウィジェットを非表示 */
  .FloatingContactButton,
  [class*="floating"],
  #a11y-panel,
  [data-a11y-panel],
  .AIChatWidget,
  .SessionToast {
    display: none !important;
  }

  /* 余白調整 */
  @page {
    margin: 1.5cm;
    size: A4;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* コンテナの幅を最大化 */
  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }

  /* 背景を白に、文字を黒に */
  * {
    background-color: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* 画像はそのまま */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* テーブル・コードブロックの改ページ制御 */
  table,
  pre,
  blockquote {
    page-break-inside: avoid;
  }

  /* 見出しの後に改ページしない */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  /* リンクのURL表示 */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666 !important;
  }

  /* 内部リンクやナビゲーションリンクのURLは表示しない */
  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }

  /* グラデーション背景を上書き */
  [class*="bg-gradient"] {
    background: white !important;
  }

  /* ボーダーを灰色に */
  [class*="border"] {
    border-color: #ccc !important;
  }

  /* ハイコントラストモードのリセット */
  html.a11y-high-contrast,
  html.a11y-high-contrast body,
  html.a11y-high-contrast * {
    background-color: white !important;
    color: black !important;
  }

  html.a11y-high-contrast a {
    color: #0056b3 !important;
  }
}