/* 基本スタイル */
.kk-survey-container {
  color: #333;
  line-height: 1.7;
  margin: 0 auto 40px;
}

/* タブナビゲーション */
.tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
}

.tab-button {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.6rem;
  color: #495057;
  transition: all 0.2s;
}

.tab-button:hover {
  color: #000;
}

.tab-button.active {
  color: #3490dc;
  border-bottom: 2px solid #3490dc;
  font-weight: bold;
}

/* コンテンツエリア */
.view-content {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

/* サイドバー */
.sidebar {
  flex: 1;
  min-width: 250px;
  max-width: 300px;
  background-color: #f1f5f9;
  border-radius: 8px;
  padding: 15px;
}

.sidebar-title {
  font-size: 1.8rem;
  font-weight: bold;
  margin-bottom: 15px;
}

/* 質問/回答者項目（改修版） */
.question-item, .respondent-item {
  padding: 10px 15px;
  margin-bottom: 8px;
  background-color: white;
  border-radius: 6px;
  border: 1px solid #ddd;
  cursor: pointer;
  font-size: 1.4rem;
  /* トランジション追加 */
    transition: max-height 0.3s ease-out,
              opacity 0.3s ease-out,
              margin-bottom 0.3s ease-out,
              padding 0.3s ease-out,
              border-color 0.2s ease;
  overflow: hidden;
  opacity: 1;
  box-sizing: border-box;
}

/* 折りたたみ状態のスタイル追加 */
.question-item.collapsed, .respondent-item.collapsed {
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.question-item:hover, .respondent-item:hover {
  background-color: #f0f9ff;
  border-color: #93c5fd;
}

.question-item.selected, .respondent-item.selected {
  background-color: #dbeafe;
  border-color: #3b82f6;
  font-weight: bold;
}

/* メインエリア */
.main-area {
  flex: 3;
  min-width: 0;
}

.main-area h2 {
  font-size: 2.0rem;
  margin-top: 0;
  margin-bottom: 20px;
  line-height: 1.4;
}

.select-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  background-color: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  font-size: 1.6rem;
}

/* 回答アイテム */
.response-item {
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  border: 1px solid;
}

.question-view .response-header {
  display: block !important;
  margin-bottom: 10px;
}

.question-view .response-header h3 {
  margin: 0 0 8px 0;
  font-size: 1.8rem;
}

.question-view .response-choice {
  display: inline-block;
  margin: 5px 0;
}

.respondent-view .response-header {
  display: block !important;
  margin-bottom: 10px;
}

.respondent-view .response-header h3 {
  margin: 0 0 8px 0;
  font-size: 1.8rem;
}

.respondent-view .response-choice {
  display: inline-block;
  margin: 5px 0;
}

.response-header h3 {
  margin: 0;
  font-size: 1.8rem;
}

.response-choice:empty,
.response-choice:blank {
  display: none !important;
}

.response-choice[content=""],
.response-choice[content="-"] {
  display: none !important;
}

.response-choice {
  background-color: white;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 1.4rem;
  font-weight: bold;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.response-reason {
  margin: 0 0 2px 0 !important;
  font-size: 1.4rem;
}

/* 選択肢表示用 */
.options-container {
  margin: 10px 0 20px;
  width: 100%;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 10px 0;
  background-color: #f9fafb;
}

.options-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  width: 100%;
}

.options-label {
  font-size: 1.2rem;
  color: #666;
  margin-right: 5px;
  font-weight: normal;
}

.question-option {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  border: 1px solid transparent; /* 初期は透明にしておく */
  white-space: normal;
  display: inline-block;
  margin-bottom: 3px;
  max-width: 100%;
  box-sizing: border-box;
}

/* 回答の色分け（6段階） */
.response-purple {
  background-color: #f3e8ff;  /* 明るい紫 */
  border-color: #c084fc;      /* 紫のボーダー */
}

.response-red {
  background-color: #fee2e2;
  border-color: #e4606b;
}

.response-orange {
  background-color: #ffe6cc;  /* 明るいオレンジ */
  border-color: #ff9900;      /* オレンジのボーダー */
}

.response-yellow {
  background-color: #fef3c7;
  border-color: #fcd34d;
}

.response-green {
  background-color: #d1fae5;
  border-color: #6ee7b7;
}

.response-gray {
  background-color: #f3f4f6;
  border-color: #bbb;
}

.response-white {
  background-color: #fff;
  border-color: #ddd;
}

/* データビジュアライゼーション */
#data-viz {
  background-color: #f1f5f9;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0 30px;
}

#data-viz h3 {
  font-size: 1.8rem;
  margin: 0 0 15px 0;
}

.viz-bar-container {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.viz-label {
  width: 25%;
  font-weight: 500;
  font-size: 1.4rem;
}

.viz-bar-outer {
  width: 60%;
  display: flex;
  align-items: center;
}

.viz-bar {
  height: 24px;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.viz-count {
  margin-left: 10px;
  font-size: 1.4rem;
}

/* 全展開ボタンのスタイル（質問用） */
.expand-all-button {
  display: block;
  width: 100%;
  padding: 5px 10px;
  margin: 10px 0;
  box-sizing: border-box;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.expand-all-button:hover {
  background-color: #2563eb;
}

/* 全展開ボタンのスタイル（回答者用） */
.expand-all-respondent-button {
  display: block;
  width: 100%;
  padding: 5px 10px;
  margin: 10px 0;
  box-sizing: border-box;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.expand-all-respondent-button:hover {
  background-color: #2563eb;
}

/* 東京都知事回答の注釈スタイル */
.tokyo-note {
  font-size: 1.4rem;
  color: #555;
  margin: 10px 0 20px;
  font-weight: normal;
  line-height: 1.4;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  .view-content {
    flex-direction: column;
  }
  .sidebar {
    max-width: 100%;
  }
  .viz-label {
    width: 40%;
  }
  .viz-bar-outer {
    width: 45%;
  }
}

/* ユーティリティクラス */
.hidden {
  display: none;
}

.loading {
  text-align: center;
  padding: 50px;
  color: #666;
}

.error-message {
  text-align: center;
  padding: 50px;
  color: #dc2626;
  background-color: #fee2e2;
  border-radius: 8px;
}