/* ==========================================
 * style.css
 * 業務実施報告書作成ツール 共通スタイル
 * ========================================== */

/* Googleフォントの読み込み */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* CSS変数（デザイントークン） */
:root {
  --color-primary:      #1a4a8a;   /* 神奈川県イメージカラー：紺 */
  --color-primary-dark: #0d2f5e;
  --color-primary-light:#2d6cc4;
  --color-accent:       #e8a020;   /* アクセント：金茶 */
  --color-danger:       #c0392b;
  --color-success:      #27ae60;
  --color-bg:           #f0f4f8;
  --color-surface:      #ffffff;
  --color-surface-alt:  #f7f9fc;
  --color-border:       #d0d9e6;
  --color-text:         #1a2535;
  --color-text-muted:   #6b7a8f;
  --color-text-light:   #ffffff;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  16px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.12);

  --transition: 0.2s ease;
  --font-main:  'Noto Sans JP', 'Meiryo', sans-serif;
}

/* === リセット・ベース === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
}
a { color: var(--color-primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === ヘッダー === */
.site-header {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 60%, var(--color-primary-light) 100%);
  color: var(--color-text-light);
  padding: 0 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
}
.site-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-title .badge {
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.05em;
}
.header-nav { display: flex; gap: 4px; }
.nav-btn {
  color: rgba(255,255,255,0.85);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: var(--font-main);
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--color-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem;
}

/* === メインコンテンツ === */
.main-content {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px;
}

/* === ページタイトル === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}
.page-title .sub { font-size: 0.85rem; font-weight: 400; color: var(--color-text-muted); margin-left: 8px; }

/* === カード === */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-body { padding: 20px 24px; }
.card-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex; align-items: center; gap: 8px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* === グリッドレイアウト === */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* === ボタン === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26,74,138,0.25);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 4px 10px rgba(26,74,138,0.35); }
.btn-accent {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 2px 6px rgba(232,160,32,0.3);
}
.btn-accent:hover { background: #c98a18; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover { background: #eef3f9; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #922b21; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* === フォーム === */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.form-label .required {
  color: var(--color-danger);
  margin-left: 3px;
  font-size: 0.8rem;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.92rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(45,108,196,0.12);
}
.form-control::placeholder { color: #b0bac8; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* === テーブル === */
.table-wrap { overflow-x: auto; }
table.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.report-table th {
  background: var(--color-primary);
  color: #fff;
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
}
.report-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.report-table tbody tr:hover { background: var(--color-surface-alt); }
.report-table tbody tr:last-child td { border-bottom: none; }
.report-table .num { text-align: right; font-feature-settings: "tnum"; }

/* === バッジ・ステータス === */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-primary { background: #e8f0fb; color: var(--color-primary); }
.badge-accent  { background: #fef3e2; color: #b87818; }
.badge-success { background: #e8f7ef; color: var(--color-success); }
.badge-muted   { background: #eef0f3; color: var(--color-text-muted); }

/* === 統計カード === */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--color-primary); line-height: 1.1; }
.stat-unit  { font-size: 0.85rem; color: var(--color-text-muted); }

/* === モーダル === */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--color-primary); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--color-text-muted); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* === トースト通知 === */
#toast-container {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  background: var(--color-text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  min-width: 240px;
  animation: slideInRight 0.25s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--color-success); }
.toast.error   { background: var(--color-danger); }
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* === ローディング === */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === エンプティステート === */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  text-align: center;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; font-size: 0.95rem; }

/* === 区切り線 === */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 20px 0; }

/* === セクションタイトル === */
.section-title {
  font-size: 1rem; font-weight: 700;
  color: var(--color-primary);
  border-left: 4px solid var(--color-primary);
  padding-left: 10px;
  margin-bottom: 16px;
}

/* === コントリビューショングラフ === */
.contrib-container {
  display: flex;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}
.contrib-days {
  display: flex;
  flex-direction: column;
  margin-top: 25px; /* 月ラベル(14px) + margin(11px) */
  margin-right: 8px;
  gap: 3px;
}
.contrib-days span {
  height: 14px;
  line-height: 14px;
  width: 14px;
  text-align: right;
}
.contrib-scroll-area {
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  flex: 1;
}
.contrib-scroll-area::-webkit-scrollbar {
  height: 6px;
}
.contrib-scroll-area::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}
.contrib-months {
  position: relative;
  height: 14px;
  margin-bottom: 8px;
}
.contrib-month-label {
  position: absolute;
  top: 0;
  line-height: 14px;
  white-space: nowrap;
}
.contrib-grid {
  display: inline-flex;
  gap: 3px;
}
.contrib-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.contrib-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background-color: #ebedf0;
  outline: 1px solid rgba(27,31,35,0.06);
  outline-offset: -1px;
}
.contrib-cell.level-0 { background-color: #ebedf0; }
.contrib-cell.level-1 { background-color: #9be9a8; }
.contrib-cell.level-2 { background-color: #40c463; }
.contrib-cell.level-3 { background-color: #30a14e; }
.contrib-cell.level-4 { background-color: #216e39; }

.contrib-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  justify-content: flex-end;
  margin-top: 4px;
}

/* === 印刷スタイル === */
@media print {
  body { background: #fff; font-size: 10pt; }
  .site-header, .header-nav, .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .main-content { max-width: 100%; margin: 0; padding: 0; }
  .page-break { page-break-before: always; }
}
