/* 共通のページスタイル */
.content {
    padding: 30px;
    background-color: #fafafa;
    min-height: calc(100vh - 200px);
}

/* 指標説明セクション */
.indicator-explanation {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-container {
    width: 100%;
    height: 700px;
}

.filter-container {
    background-color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-family: "Noto Sans JP", sans-serif;
}

.filter-container label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.filter-container input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f9fcff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.filter-container input[type="date"]:focus {
    outline: none;
    border-color: #4a90e2;
}

.filter-container button {
    background-color: #4a90e2;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-container button:hover {
    background-color: #357ab8;
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background-color: #4f46e5;
    color: white;
    cursor: pointer;
}

button:hover {
    background-color: #4338ca;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(4px);
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    width: 75%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
}

#areaForm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px 16px; /* 行間・列間 */
}


.close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 24px;
    cursor: pointer;
}

.confirm {
    margin-top: 20px;
    width: 100%;
}

.scroll-container {
    max-height: 60vh;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 8px; /* スクロールバーとテキストの重なり防止 */
}

.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.secondary {
    background-color: #e5e7eb;
    color: #111827;
    border: none;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.secondary:hover {
    background-color: #d1d5db;
}
.date-range-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #f0f4ff;  /* 薄い青で強調 */
    border-radius: 8px;
}

.date-range-group label {
    font-weight: bold;
    color: #333;
    margin-right: 6px;
}

.date-range-group select,
.date-range-group button {
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
}

.date-range-group span {
    font-weight: bold;
    margin: 0 6px;
}

/* 年月の単位表示 */
.unit-label {
    margin-right: 8px;
    font-size: 14px;
    color: #555;
}

/* 年月セレクトボックスをまとめる */
.date-select-block {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* セレクトが注目されやすいように枠や背景強調 */
.select-highlight {
    background-color: #f9fcff;
    border: 1px solid #bbb;
    padding: 6px;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

.select-highlight:hover,
.select-highlight:focus {
    border-color: #4a90e2;
}

/* ラベル補足説明 */
.note {
    font-size: 12px;
    color: #888;
    margin-left: 4px;
}

#confirmBtn_input {
  width: auto;      /* .confirm の width:100% を打ち消す */
  margin-top: 0;    /* 折り返し防止 */
  padding: 6px 14px;
}

/* 大分類・中分類・確定を横並びに（PC表示） */
.select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.indicator-title {
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 20px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.explanation-summary {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin-bottom: 25px;
}

.explanation-summary p {
    color: #555;
    font-size: 1.1em;
    line-height: 1.7;
    margin: 0;
}

/* データ活用ガイド */
.usage-guide {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.usage-guide h2 {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.explanation-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-2px);
}

.detail-item h3 {
    color: #2c3e50;
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.detail-item p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* 関連指標リンク */
.related-indicators {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.related-indicators h2 {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.indicator-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.indicator-link {
    display: block;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.indicator-link:hover {
    background: #e3f2fd;
    border-color: #3498db;
    transform: translateY(-2px);
}

.link-title {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.link-desc {
    display: block;
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

.notation {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-top: 20px;
}

.notation p {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

/* テーブルセクション */
.table-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.table-section h2 {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.table-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.compact-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #333;
    min-width: 150px;
    transition: border-color 0.2s;
}

.compact-select:focus {
    outline: none;
    border-color: #3498db;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.compact-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 13px;
}

.compact-table th {
    background: #f8f9fa;
    padding: 12px 8px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
}

.compact-table td {
    padding: 8px;
    border-bottom: 1px solid #e9ecef;
}

.compact-table tbody tr:hover {
    background-color: #f8f9fa;
}

.compact-table tbody tr.hidden {
    display: none;
}

.year-col, .year-cell {
    width: 15%;
    min-width: 80px;
}

.area-col, .area-cell {
    width: 20%;
    min-width: 100px;
}

.big-category-col, .big-category-cell {
    width: 25%;
    min-width: 120px;
}

.value-col, .value-cell {
    width: 15%;
    min-width: 80px;
    text-align: right;
}

.date-col, .date-cell {
    width: 20%;
    min-width: 100px;
}

.year-cell, .date-cell {
    font-weight: 500;
    color: #495057;
}

.area-cell, .area-cell {
    color: #333;
    font-size: 12px;
    font-weight: 500;
}

.value-cell, .value-cell {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.value {
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    min-width: 40px;
}

.value-na {
    color: #6c757d;
    font-style: italic;
}

@media screen and (max-width: 768px) {
  .filter-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1em;
  }

  .date-range-group {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .select-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .select-wrapper label {
    margin-top: 8px;
  }

  .select-wrapper select {
    width: 100%;
  }

  .chart-container {
    height: 80vh;  /* 高さを調整 */
  }

  .indicator-explanation,
  .table-section,
  .usage-guide,
  .related-indicators {
    padding: 20px;
    margin-bottom: 20px;
  }

  .content {
    padding: 5px;  /* ← パディングを削除 */
  }

  /* コンパクトテーブルセクション */
.table-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.table-section h2 {
  color: #2c3e50;
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 15px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

.table-controls {
  margin-bottom: 15px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.compact-select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  color: #333;
  font-size: 13px;
  min-width: 140px;
  transition: border-color 0.2s ease;
}

.compact-select:focus {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.table-container {
  overflow-x: auto;
  border: 1px solid #e1e5e9;
  border-radius: 4px;
  max-height: 500px;
  overflow-y: auto;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 13px;
  line-height: 1.4;
}

.compact-table thead {
  background: #f8f9fa;
  color: #495057;
  position: sticky;
  top: 0;
  z-index: 10;
}

.compact-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 2px solid #dee2e6;
  border-right: 1px solid #dee2e6;
}

.compact-table th:last-child {
  border-right: none;
}

.year-col { width: 40px; }
.area-col ,.big-category-col{ width: auto; }
.value-col { 
  width: 80px; 
  text-align: right;
}

.compact-table tbody tr {
  border-bottom: 1px solid #f1f3f4;
  transition: background-color 0.15s ease;
}

.compact-table tbody tr:hover {
  background-color: #f8f9fa;
}

.compact-table tbody tr:nth-child(even) {
  background-color: #fdfdfd;
}

.compact-table td {
  padding: 6px 12px;
  color: #333;
  border-right: 1px solid #f1f3f4;
  vertical-align: middle;
}

.compact-table td:last-child {
  border-right: none;
}

.year-cell {
  font-weight: 500;
  color: #495057;
  text-align: center;
}

.area-cell , .big-category-cell{
  color: #333;
  font-size: 12px;
}

.value-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: #2c3e50;
}

/* フィルタ適用時の非表示行 */
.compact-table tbody tr.hidden {
  display: none;
}
}