/**
 * 印刷用スタイル
 * かんたん請求書・領収書作成ツール by サプライコネクト
 *
 * 【方針】
 * - 画面表示時：#print-area は非表示（隠しDOM）
 * - 印刷時：#print-area のみ表示、その他一切を非表示
 */

/* ===== 画面表示時：印刷エリアを完全非表示 ===== */
#print-area {
  display: none !important;
  position: absolute;
  left: -9999px;
  top: -9999px;
}

/* ===== 印刷メディア ===== */
@media print {

  /* 印刷時は body 以下のほぼすべてを非表示にして #print-area だけ出す */
  body > *:not(#print-area) {
    display: none !important;
  }

  /* #print-area 自体を表示 */
  #print-area {
    display: block !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
  }

  /* ===== 全体リセット ===== */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  html, body {
    margin: 0;
    padding: 0;
    background: white !important;
  }

  /* ===== A4ページ設定 ===== */
  @page {
    size: A4 portrait;
    margin: 12mm 14mm 12mm 14mm;
  }

  /* ===== 書類本体 ===== */
  .document-paper {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    font-size: 10.5pt !important;
    line-height: 1.5 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    color: #1E293B !important;
  }

  /* ===== 右上：発行日・番号 ===== */
  .doc-meta-top {
    text-align: right !important;
  }

  .doc-meta-due {
    color: #1E3A8A !important;
    font-weight: 700 !important;
  }

  /* ===== タイトル ===== */
  .doc-title {
    color: #1E3A8A !important;
    border-bottom-color: #1E3A8A !important;
    text-align: center !important;
  }

  /* ===== 取引先・発行者2カラム ===== */
  .doc-parties {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .doc-buyer-col {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .doc-seller-col {
    flex-shrink: 0 !important;
    max-width: 260px !important;
  }

  .doc-seller-inner {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }

  .doc-seller-texts {
    flex: 1 !important;
  }

  /* 社印（角印） */
  .doc-seller-stamp {
    width: 68px !important;
    height: 68px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .doc-seller-logo {
    width: 68px !important;
    height: 68px !important;
    object-fit: contain !important;
  }

  /* ご請求金額 */
  .doc-request-amount-val {
    color: #1E3A8A !important;
  }

  /* ===== 明細テーブル ===== */
  .doc-items-table th {
    background: #1E3A8A !important;
    color: white !important;
  }

  .doc-items-table tr:nth-child(even) td {
    background: #F8FAFC !important;
  }

  .doc-items-table .tax-8-badge {
    background: rgba(245,158,11,0.12) !important;
    color: #D97706 !important;
  }

  /* ===== 合計エリア ===== */
  .doc-total-row.grand-total {
    background: #EFF6FF !important;
    color: #1E3A8A !important;
  }

  /* ===== 振込先・備考（最下部） ===== */
  .doc-footer-section {
    margin-top: auto !important;
    padding-top: 12pt !important;
    border-top: 1px solid #CBD5E1 !important;
    page-break-inside: avoid !important;
  }

  .doc-bank-info {
    background: #FAFBFF !important;
    border-color: #CBD5E1 !important;
  }

  /* ===== ページ区切り制御 ===== */
  .doc-items-table {
    page-break-inside: auto;
  }

  .doc-items-table tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .doc-bank-info,
  .doc-notes {
    page-break-inside: avoid;
  }
}
