/* 人事労務コンシェルジュ 共通スタイル */

:root {
  --brand-primary: #264370;
  --brand-accent: #3f6aa2;
  --brand-soft: #dbe7f3;
}

body {
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}

/* スクロールバーをやわらかく */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* カルテ本文など長文のプレーンテキスト表示 */
.prose-karte {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.8;
}

/* フェード＆スライドの微細なアニメーション */
.fade-in {
  animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   印刷レイアウト（カルテPDF出力用）
   - 画面表示と印刷時で、別々のレイアウトになるよう設計
   - 印刷時は@pageで余白を一元管理し、コンテンツ側は余白ゼロ
   ========================================================== */

/* --- 画面表示時：紙っぽいプレビュー --- */
.print-page {
  max-width: 210mm;
  margin: 0 auto;
  padding: 20mm 18mm;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.print-wrap {
  padding: 32px 16px;
  background: #f1f5f9;
  min-height: 100vh;
}

/* --- 印刷時：@pageで余白管理、コンテンツは余白ゼロ --- */
@media print {
  @page {
    size: A4;
    margin: 15mm 14mm;
  }

  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* 画面用UIは全部隠す */
  .no-print,
  nav,
  aside,
  .sidebar,
  .topbar {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  /* メイン領域のレイアウトをリセット */
  main, .print-wrap {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    background: #fff !important;
    min-height: auto !important;
  }

  /* 紙そのものになるので、画面用の余白・シャドウは落とす */
  .print-page {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .print-page-break {
    page-break-before: always;
  }

  /* 章やテーブルを途中で分断させない */
  .print-section {
    page-break-inside: avoid;
  }
  table, tr, td, th {
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  /* 装飾の最適化 */
  .shadow, .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl {
    box-shadow: none !important;
  }
}

.print-only {
  display: none;
}

/* フォームのフォーカスを柔らかく */
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 106, 162, 0.15);
  border-color: #3f6aa2;
}

/* チャット吹き出し（カルテ化前後でサイズ統一） */
.chat-bubble {
  /* 親側の max-w-[80%] で幅制御するので、ここでは幅指定しない */
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 14px;
}
.chat-bubble-me {
  background: #264370;
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.chat-bubble-other {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

/* タグバッジ */
.tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #dbe7f3;
  color: #264370;
  border: 1px solid #b8cfe7;
}

/* ==========================================================
   レスポンシブ微調整
   ========================================================== */

/* テーブルの横スクロール対応 */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* モバイル：チャット吹き出しの最大幅を拡大 */
@media (max-width: 640px) {
  .chat-bubble {
    max-width: 88%;
    padding: 10px 14px;
    font-size: 14px;
  }
}

/* モバイル：ボタン・リンクのタップ領域を確保 */
@media (max-width: 640px) {
  button, a.btn, [role="button"] {
    min-height: 40px;
  }
}

/* 長い単語・URLで画面が横に伸びないように */
.break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* line-clampの保険（Tailwindの line-clamp と共存） */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
