/* css/style.css */

/* =========================================
   変数定義
========================================= */
:root {
  --primary-color: #005a9c;
  --primary-hover: #004070;
  --accent-color: #a00;
  --success-color: #080;
  --bg-body: #036;
  --bg-container: #fff;
  --text-main: #333;
  --border-color: #ccc;
  /* 集計表・詳細カードの外枠のスタイル */
  --outer-border: 2px solid #333; 
}

/* =========================================
   基本設定 (Base)
========================================= */
html, body {
  margin: 0;
  padding: 0;
  height: auto;
  min-height: 100%;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  line-height: 1.6;
/* 変更前：background-color: var(--bg-body); */
  /* 変更後：以下の行に差し替えます */
  background-color:#aaa;
  color: var(--text-main);
}

body {
  padding: 20px 20px 80px 20px;
  box-sizing: border-box;
}

/* コンテナ共通設定（一覧画面、詳細カード、集計表） */
.container,
#printCardContainer,
#summaryContainer {
  margin: 0 auto;
  background: var(--bg-container);
  padding: 30px;
    border: 1px solid #E2E8F0; /* 濃い2pxの枠線から、極細で薄い枠線に変更 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* 濃く落ちる影から、薄く広がる現代的な影に変更 */
  border-radius: 10px;
  box-shadow: none;
  min-height: 80vh;
  margin-bottom: 0;
  overflow: hidden; 
  box-sizing: border-box;
}

/* 一覧画面と集計表は最大幅1200px */
.container, 
#summaryContainer {
  max-width: 1200px;
}

/* =========================================
   ヘッダー・検索エリア
========================================= */
.header-area {
  margin-bottom: 0px;
  padding-bottom: 0px;
}

.header-area h1 {
  font-size: 1.8rem;
  margin: 0 0 0px 0;
  color: var(--text-main);
}

.header-sub-text {
  font-size: 10pt;
  color: #333;
  margin-bottom: 5px;
}

.search-area {
  background-color: #ccc;
  border-radius: 6px;
  padding: 10px 15px;
  margin-bottom: 15px;
  border: 1px solid #888;
  color: #222;
  font-size: 0.9rem;
}

.search-row {
  margin-bottom: 0;
  padding: 1px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

hr {
  border: 0;
  border-top: 1px dashed #888;
  margin: 2px 0;
  height: 0;
}

label {
  cursor: pointer;
  user-select: none;
}

select, input[type="text"] {
  padding: 4px 6px;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

input[type="text"] {
  width: 300px;
  max-width: 100%;
}

/* =========================================
   ボタン基本
========================================= */
.btn, 
.dl-button, 
.dl-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
  transition: transform 0.1s ease-out, background-color 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}

.btn:hover, 
.dl-button:hover, 
.dl-mini-btn:hover {
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
}

.btn {
  padding: 4px 12px;
  font-size: 0.9rem;
  background-color: #eee;
  color: #333;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-info {
  background-color: #6c757d;
  color: white;
  font-size: 0.9rem;
  padding: 2px 12px;
}

.btn-outline {
  background-color: #6c757d;
  color: white;
  padding: 2px 8px;
  font-size: 0.85rem;
}

.btn:hover {
  background-color: #800 !important;
  color: #fff !important;
  border-color: #800;
}

.dl-button {
  display: inline-block;
  padding: 2px 10px;
  background-color: var(--primary-color);
  color: #fff;
  font-size: 0.9rem;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.dl-mini-btn {
  display: inline-block;
  padding: 2px 8px;
  background-color: var(--primary-color);
  color: #fff;
  font-size: 0.8rem;
}

/* =========================================
   テーブル（一覧・共通設定）
========================================= */
#resultTableContainer {
  margin-bottom: 20px;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  background: white;
  table-layout: fixed;
  border: none !important; 
}

th, td {
  border: 1px solid #888;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
}

th { 
  background-color: #ddd; 
  font-weight: bold; 
  color: var(--text-main); 
  text-align: center; 
}

.amount-cell {
  text-align: right;
  white-space: nowrap;
}

.nowrap-cell {
  white-space: nowrap;
}

.simple-table th, 
.simple-table td {
  padding: 6px 8px;
  font-size: 0.9rem;
  vertical-align: middle;
}

.company-link {
  color: var(--primary-color, #0056b3);
  text-decoration: underline;
  cursor: pointer;
  font-weight: bold;
}

.company-link:hover {
  color: #003d82;
}

/* =========================================
   詳細表示カード（事案の詳細）
========================================= */
#printCardContainer {
  max-width: 800px;
  display: flex;
  flex-direction: column;
}

#printCardContainer table {
  width: 100% !important;
  border-collapse: collapse;
  margin-top: 10px;
  table-layout: fixed !important;
  border: none !important; 
}

#printCardContainer th, 
#printCardContainer td {
  border: 1px solid #333 !important; 
  padding: 12px !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
}

#printCardContainer th {
  background-color: #f8f9fa !important;
  width: 15% !important;
  min-width: 90px !important;
}

.print-actions {
  margin-top: auto;
  padding-top: 30px;
  text-align: center;
}

/* =========================================
   集計表 (#summaryContainer)
========================================= */
#summaryContainer {
  display: flex;
  flex-direction: column;
}

#summaryContainer table {
  border: none !important; 
}

/* =========================================
   オーバーレイ（モーダル表示等）
========================================= */
#detailOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(2px);
}

#detailOverlayContent {
  background-color: white;
  padding: 30px;
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#detailOverlayClose {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 1.5rem;
  color: #666;
  font-weight: bold;
}

#detailOverlayClose:hover {
  color: #000;
}

.detail-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 15px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}

/* =========================================
   フッター
========================================= */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #222;
  color: #ccc;
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  z-index: 9999;
}

.site-footer a {
  color: #ccc;
  text-decoration: none;
}

/* =========================================
   レスポンシブ & 印刷設定
========================================= */
@media (max-width: 768px) {
  .container, #printCardContainer, #summaryContainer { 
    padding: 15px; 
  }
  .search-row { flex-direction: column; align-items: flex-start; }
  input[type="text"] { width: 100%; }
  table { min-width: 600px; }
}

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body { background: none !important; }
  
  /* 標準のUIを隠す */
  body > .container, .site-footer, #detailOverlay, #formOverlay { display: none !important; }
  
  /* ▼ 印刷トラブル修正：display:block の強制を解除しました */
  #printCardContainer, #summaryContainer {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important; 
    border: var(--outer-border) !important;
    box-shadow: none !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  .no-print { display: none !important; }
  .company-link { text-decoration: none !important; color: #000 !important; }
}