/* デザインシステム及びスタイル定義：AI行政コンパス */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --bg-color: #080c14;
  --panel-bg: rgba(20, 30, 55, 0.4);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* スコアに応じたネオンカラー定義 */
  --color-s: #00f2fe;     /* シアン (極めて優秀) */
  --color-a: #4facfe;     /* ブルー (優秀) */
  --color-b: #00g272;     /* エメラルド (平均以上) */
  --color-c: #f9d423;     /* イエロー (課題あり) */
  --color-d: #ff4e50;     /* レッド (停滞) */
  
  --shadow-neon-s: 0 0 15px rgba(0, 242, 254, 0.4);
  --shadow-neon-a: 0 0 15px rgba(79, 172, 254, 0.4);
  --shadow-neon-b: 0 0 15px rgba(0, 168, 150, 0.4);
  --shadow-neon-c: 0 0 15px rgba(249, 212, 35, 0.4);
  --shadow-neon-d: 0 0 15px rgba(255, 78, 80, 0.4);
}

/* スクロールバーのカスタマイズ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #080c14;
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  background-image: 
    radial-gradient(at 10% 10%, rgba(20, 40, 90, 0.15) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(90, 20, 120, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(8, 12, 20, 1) 0px, rgba(8, 12, 20, 0.95) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

header {
  padding: 2rem 5%;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area h1 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-area p {
  margin: 5px 0 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: var(--color-s);
}

main {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
  }
}

.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* カード共通スタイル（グラスモルフィズム） */
.glass-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.3s, border-color 0.3s;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-title {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

/* 地図グリッドレイアウト */
.map-grid-container {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 8px;
  aspect-ratio: 8 / 7;
  max-width: 600px;
  margin: 0 auto;
}

.map-tile {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.map-tile .ward-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.map-tile .ward-grade {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  margin-top: 2px;
}

.map-tile.empty {
  visibility: hidden;
  cursor: default;
}

/* 各グレードごとの配色設定 */
.map-tile.grade-S { border-color: var(--color-s); color: var(--color-s); }
.map-tile.grade-A { border-color: var(--color-a); color: var(--color-a); }
.map-tile.grade-B { border-color: #10b981; color: #10b981; } /* エメラルドグリーン */
.map-tile.grade-C { border-color: var(--color-c); color: var(--color-c); }
.map-tile.grade-D { border-color: var(--color-d); color: var(--color-d); }

.map-tile.grade-S:hover { background: rgba(0, 242, 254, 0.15); box-shadow: var(--shadow-neon-s); transform: scale(1.05); }
.map-tile.grade-A:hover { background: rgba(79, 172, 254, 0.15); box-shadow: var(--shadow-neon-a); transform: scale(1.05); }
.map-tile.grade-B:hover { background: rgba(16, 185, 129, 0.15); box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); transform: scale(1.05); }
.map-tile.grade-C:hover { background: rgba(249, 212, 35, 0.15); box-shadow: var(--shadow-neon-c); transform: scale(1.05); }
.map-tile.grade-D:hover { background: rgba(255, 78, 80, 0.15); box-shadow: var(--shadow-neon-d); transform: scale(1.05); }

.map-tile.active.grade-S { background: rgba(0, 242, 254, 0.25); box-shadow: var(--shadow-neon-s); border-width: 2px; }
.map-tile.active.grade-A { background: rgba(79, 172, 254, 0.25); box-shadow: var(--shadow-neon-a); border-width: 2px; }
.map-tile.active.grade-B { background: rgba(16, 185, 129, 0.25); box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); border-width: 2px; }
.map-tile.active.grade-C { background: rgba(249, 212, 35, 0.25); box-shadow: var(--shadow-neon-c); border-width: 2px; }
.map-tile.active.grade-D { background: rgba(255, 78, 80, 0.25); box-shadow: var(--shadow-neon-d); border-width: 2px; }

/* 詳細パネル */
.detail-panel {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

/* 詳細パネル内のスクロールバーのカスタムデザイン */
.detail-panel::-webkit-scrollbar {
  width: 6px;
}

.detail-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

.detail-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.detail-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  color: var(--text-muted);
  text-align: center;
}

.detail-placeholder i {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.detail-content {
  display: none;
}

.detail-content.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.detail-title-area h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
}

.detail-title-area .eng-name {
  font-family: 'Outfit', sans-serif;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-grade {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  border: 1px solid;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.badge-grade.grade-S { border-color: var(--color-s); color: var(--color-s); background: rgba(0, 242, 254, 0.1); }
.badge-grade.grade-A { border-color: var(--color-a); color: var(--color-a); background: rgba(79, 172, 254, 0.1); }
.badge-grade.grade-B { border-color: #10b981; color: #10b981; background: rgba(16, 185, 129, 0.1); }
.badge-grade.grade-C { border-color: var(--color-c); color: var(--color-c); background: rgba(249, 212, 35, 0.1); }
.badge-grade.grade-D { border-color: var(--color-d); color: var(--color-d); background: rgba(255, 78, 80, 0.1); }

/* 評価時点日付バッジ */
.evaluation-date-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-weight: normal;
}

/* 基本情報グリッド */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1.5rem;
}

.stat-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 4px;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
}

/* レーダーチャート領域 */
.radar-container {
  height: 220px;
  position: relative;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: center;
}

/* タブコンテンツ */
.tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--color-s);
  border-bottom-color: var(--color-s);
}

.tab-pane {
  display: none;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* 処方箋リスト */
.prescription-list {
  padding-left: 20px;
  margin: 0;
}

.prescription-list li {
  margin-bottom: 10px;
  color: var(--text-primary);
}

.prescription-list li::marker {
  color: var(--color-s);
}

/* 散布図とランキングのセクション */
.section-full {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 1024px) {
  .section-full {
    grid-template-columns: 1fr;
  }
}

/* テーブルスタイル */
.table-container {
  overflow-x: auto;
  max-height: 400px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

th:hover {
  color: var(--text-primary);
}

th.sort-asc::after {
  content: ' ↑';
}

th.sort-desc::after {
  content: ' ↓';
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.clickable-row {
  cursor: pointer;
}

.text-right {
  text-align: right;
}

footer {
  text-align: center;
  padding: 3rem;
  border-top: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(8, 12, 20, 0.8);
}

/* 特集レポートセクションのスタイル */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.feature-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-s);
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.1);
}

.feature-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.badge-category {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 242, 254, 0.1);
  color: var(--color-s);
  font-weight: 500;
}

.feature-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

.feature-card-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

.feature-card-summary {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

.feature-card-footer {
  font-size: 0.75rem;
  color: var(--color-s);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* モーダルのスタイル */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-meta-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 0.75rem;
}

.modal-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

.modal-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-body-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

