/**
 * ９区墓苑管理システム - 共通デザインシステム (v2)
 * 弥生会計スタイルのクリーンで機能的なデザインをベースに構築
 */

:root {
  /* カラーシステム */
  --bg-main: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #2c3e50;

  --primary-color: #3498db;
  --secondary-color: #95a5a6;
  --success-color: #27ae60;
  --danger-color: #e74c3c;
  --warning-color: #f1c40f;

  --text-main: #2c3e50;
  --text-muted: #7f8c8d;
  --text-light: #ecf0f1;

  --border-color: #dee2e6;
  --border-radius: 4px;

  /* グラデーション */
  --grad-blue: linear-gradient(to bottom, #4facfe 0%, #00f2fe 100%);
  --grad-light: linear-gradient(to bottom, #ffffff 0%, #f9f9f9 100%);

  /* シャドウ */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body {
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* メインコンテンツの外枠 (sidebar.jsで自動挿入される) */
.main-content {
  padding: 30px;
  min-height: 100vh;
}

h1,
h2,
h3 {
  margin-top: 0;
  color: var(--text-main);
}

h1,
h2 {
  font-size: 20px;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 10px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* カード形式のコンテナ */
.form-container,
.list-container,
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

/* フォーム行のスタイル */
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.form-row label {
  width: 120px;
  font-weight: bold;
  color: var(--text-main);
}

.form-row .field {
  flex: 1;
}

/* 入力要素のスタイル */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 14px;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 入力フィールドの幅指定 */
.short-input {
  width: 150px !important;
}

.medium-input {
  width: 300px !important;
}

.large-input {
  width: 500px !important;
}

.full-width {
  width: 100% !important;
}

/* ボタンのスタイル (弥生スタイル) */
button {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-weight: bold;
  font-size: 14px;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button.primary {
  background: var(--grad-blue);
  color: white;
  border: none;
}

button.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button.secondary {
  background: var(--grad-light);
  color: var(--text-main);
}

button.secondary:hover {
  background: #f0f0f0;
}

/* テーブルスタイル */
table {
  width: 100%;
  border-collapse: separate; /* sticky header のために collapse から separate に変更 */
  border-spacing: 0;
  margin-top: 15px;
  background: #fff;
}

table th {
  background-color: #f8f9fa;
  color: var(--text-main);
  font-weight: bold;
  padding: 12px;
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid #eee; /* 縦線追加 */
  text-align: left;
  position: sticky; /* 見出し固定用 */
  top: 0;
  z-index: 10;
}

table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  border-right: 1px solid #eee; /* 縦線追加 */
}

table th:last-child,
table td:last-child {
  border-right: none;
}

table tr:hover {
  background-color: #fcfcfc;
}

/* スクロール可能なテーブルコンテナ */
.table-wrapper {
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.table-wrapper table {
  margin-top: 0;
  border: none;
}

/* 必須マーク */
.required {
  color: var(--danger-color);
  margin-left: 4px;
}

/* ユーティリティ */
.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}