/* =============================================
   ほたるケアマネSaaS — 印刷スタイル
   ============================================= */

/* 印刷ボタン（画面表示時のみ） */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s;
}

.print-btn:hover {
  background: var(--gray-50);
}

/* 画面のみ表示 / 印刷のみ表示 */
.print-only {
  display: none !important;
}

/* =============================================
   週間サービス計画表（第3表）— 画面表示スタイル
   ============================================= */

.weekly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.weekly-table th,
.weekly-table td {
  border: 1px solid var(--gray-300);
  padding: 6px 8px;
  vertical-align: top;
}

.weekly-table th {
  background: var(--gray-50);
  font-weight: 600;
  text-align: center;
  font-size: 13px;
}

.time-block-label {
  font-weight: 600;
  font-size: 11px;
  color: var(--gray-700);
  text-align: center;
  background: var(--gray-50);
  white-space: nowrap;
}

.schedule-cell {
  min-height: 48px;
  min-width: 100px;
}

.schedule-entry {
  background: var(--gold-bg);
  border: 1px solid var(--gold-light);
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 3px;
  font-size: 11px;
}

.schedule-entry:last-child {
  margin-bottom: 0;
}

.schedule-entry-time {
  font-weight: 600;
  color: var(--navy);
  font-size: 10px;
}

.schedule-entry-service {
  color: var(--gray-800);
}

.schedule-entry-provider {
  color: var(--gray-500);
  font-size: 10px;
}

/* 曜日カラー */
.day-sat {
  color: #3b82f6;
}

.day-sun {
  color: #ef4444;
}

th.day-sat {
  background: #eff6ff;
}

th.day-sun {
  background: #fef2f2;
}

td.day-sat {
  background: #f8faff;
}

td.day-sun {
  background: #fffafa;
}

/* =============================================
   厚労省様式: 第3表 週間サービス計画表（mhlwテーブル）
   ============================================= */

.mhlw-weekly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mhlw-weekly-table th,
.mhlw-weekly-table td {
  border: 1px solid var(--gray-300);
  padding: 4px 6px;
  vertical-align: top;
}

.mhlw-weekly-table th {
  background: var(--gray-50);
  font-weight: 600;
  text-align: center;
  font-size: 12px;
}

.time-sub-label {
  font-size: 10px;
  color: var(--gray-500);
  text-align: center;
  white-space: nowrap;
  background: var(--gray-50);
}

/* 厚労省様式: 補足テーブル（主な日常生活上の活動 / 週単位以外） */
.mhlw-supplement-table {
  width: 100%;
  border-collapse: collapse;
}

.mhlw-supplement-table th,
.mhlw-supplement-table td {
  border: 1px solid var(--gray-300);
  padding: 8px 12px;
  font-size: 13px;
  vertical-align: top;
}

.mhlw-supplement-table th {
  background: var(--gray-50);
  font-weight: 600;
  text-align: left;
}

/* =============================================
   月間サービスカレンダー（第6表）
   ============================================= */

.monthly-calendar-table .day-col {
  padding: 3px 2px;
  font-size: 11px;
}

/* =============================================
   厚労省帳票ヘッダー（print-only）
   ============================================= */

.mhlw-header {
  margin-bottom: 12px;
}

.mhlw-header-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}

.mhlw-header-table th,
.mhlw-header-table td {
  border: 1px solid #333;
  padding: 3px 6px;
  vertical-align: middle;
}

.mhlw-header-table th {
  background: #f5f5f5;
  font-weight: 600;
  white-space: nowrap;
  width: 120px;
  text-align: center;
  font-size: 8pt;
}

.mhlw-form-title {
  text-align: center;
  font-size: 12pt;
  font-weight: bold;
  padding: 6px !important;
  border: 2px solid #333 !important;
  letter-spacing: 2px;
}

/* =============================================
   印刷レイアウト
   ============================================= */

@media print {
  /* 共通: ヘッダー・サイドバー・ボタン・フッターを非表示 */
  .app-header,
  .app-sidebar,
  .sidebar,
  .header,
  .btn,
  .card-actions,
  .flash-notice,
  .flash-alert,
  .no-print,
  .print-btn,
  .page-breadcrumb,
  nav,
  footer {
    display: none !important;
  }

  /* 印刷のみ表示要素を有効化 */
  .print-only {
    display: block !important;
  }

  /* 厚労省帳票ヘッダー — 外枠太線・内線細線 */
  .mhlw-header-table {
    border: 2px solid #000;
  }

  .mhlw-header-table th,
  .mhlw-header-table td {
    border: 1px solid #333 !important;
  }

  .mhlw-header-table th {
    background: #f0f0f0 !important;
  }

  .mhlw-form-title {
    border: 2px solid #000 !important;
  }

  /* メインコンテンツを全幅に */
  .app-body,
  .app-main,
  .main-content,
  .content-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding-left: 0 !important;
  }

  body {
    font-size: 10pt;
    color: #000;
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* カードの影・ボーダーを消す */
  .card {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .card-header {
    padding: 4px 0 !important;
  }

  .card-body {
    padding: 0 !important;
  }

  /* テーブル罫線 */
  table {
    border-collapse: collapse;
    width: 100%;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 3px 5px !important;
    font-size: 9pt;
  }

  th {
    background: #f0f0f0 !important;
  }

  /* ページ区切り */
  .print-page-break {
    page-break-before: always;
  }

  /* 印刷ヘッダー */
  .print-header {
    margin-bottom: 12px;
  }

  /* フォントサイズ */
  h1 { font-size: 14pt; }
  h2 { font-size: 12pt; }
  h3 { font-size: 11pt; }

  /* 背景色を消す（インク節約）ただし曜日色は保持 */
  .card,
  .card-body,
  .card-header {
    background: white !important;
  }

  /* 週間計画表は横向き印刷 */
  .weekly-schedule-print {
    page: landscape-page;
  }

  /* 第6表のスティッキー位置解除（印刷時は不要） */
  .monthly-calendar-table td[style*="sticky"],
  .monthly-calendar-table th[style*="sticky"] {
    position: static !important;
  }

  /* 週間テーブルの印刷スタイル */
  .weekly-table th,
  .weekly-table td {
    border: 1px solid #333 !important;
    padding: 3px 4px !important;
    font-size: 8pt;
  }

  .schedule-entry {
    background: none !important;
    border: 1px solid #999 !important;
    border-radius: 0 !important;
    padding: 1px 3px !important;
    margin-bottom: 2px !important;
  }

  .time-block-label {
    background: #f0f0f0 !important;
    font-size: 8pt;
  }

  /* 曜日色を印刷でも維持 */
  th.day-sat,
  td.day-sat {
    background: #eef3ff !important;
  }

  th.day-sun,
  td.day-sun {
    background: #fff0f0 !important;
  }

  /* --- 第3表: 厚労省週間テーブル印刷 --- */
  .mhlw-weekly-table {
    border: 2px solid #000;
  }

  .mhlw-weekly-table th,
  .mhlw-weekly-table td {
    border: 1px solid #333 !important;
    padding: 2px 4px !important;
    font-size: 7pt;
  }

  .mhlw-weekly-table th {
    background: #f0f0f0 !important;
    font-size: 8pt;
  }

  .time-sub-label {
    font-size: 7pt;
    background: #f0f0f0 !important;
  }

  .mhlw-weekly-table .schedule-entry {
    font-size: 7pt;
    padding: 1px 2px !important;
    margin-bottom: 1px !important;
  }

  /* 第3表: 補足テーブル */
  .mhlw-supplement-table {
    border: 2px solid #000;
  }

  .mhlw-supplement-table th,
  .mhlw-supplement-table td {
    border: 1px solid #333 !important;
    padding: 4px 6px !important;
    font-size: 9pt;
  }

  .mhlw-supplement-table th {
    background: #f0f0f0 !important;
  }

  /* --- 第6表: カレンダーテーブル外枠太線 --- */
  .monthly-calendar-table {
    border: 2px solid #000 !important;
  }

  /* --- 第7表: 印刷時の事業所名列 --- */
  .monthly-plan-print + .card .data-table td:nth-child(2) {
    min-width: 80px;
    font-size: 8pt;
  }
}

/* 横向きページ定義 */
@page landscape-page {
  size: A4 landscape;
  margin: 10mm;
}

@page {
  margin: 12mm;
}
