/* メインスタイルシート */

/* 共通スタイル */
.wrap { 
  max-width: 1600px; 
  margin: 0 auto; 
  padding: 20px; 
}

/* 結果表示時も通常のアンケート画面と同じ幅に統一 */
.wrap.result-mode {
  max-width: 1600px;
  padding: 20px;
  margin: 0 auto;
}

/* アンケート画面用ヘッダー */
.header {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  color: white;
  box-shadow: var(--shadow);
  /* ヘッダー全体の幅確保 */
  min-width: 0;
  width: 100%;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  /* ヘッダータイトルの改行防止 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.header .subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin: 0;
}

.header .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.9;
}

/* 進捗バー */
.progress-container {
  margin-bottom: 32px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.progress-container.initialized {
  opacity: 1;
}

/* ページコンテンツの初期化状態（アニメーション無効化） */
#page {
  opacity: 1; /* 最初から表示 */
  /* transition削除でアニメーション無効化 */
}

#page.initialized {
  opacity: 1;
}

/* インジケーター - デスクトップ版改善 */
.progress-bar {
  background: var(--border);
  border-radius: 25px;
  height: 4px; /* 12px→4pxに変更 */
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  height: 8px; /* 進行部分を8pxに設定 */
  border-radius: 25px;
  transition: width 0.5s ease;
  position: relative;
  top: -2px; /* バーの中央に配置するため上に移動 */
}

/* Shimmerアニメーションを削除 */

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.step-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.step-dot.completed {
  background: #5D9534;
  color: white;
}

.step-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.step-indicator.active .step-label {
  color: var(--primary);
  font-weight: 600;
}

.step-indicator.completed .step-label {
  color: #5D9534;
  font-weight: 500;
}

/* カード */
.card { 
  background: var(--surface);
  border: 1px solid var(--border); 
  border-radius: 16px; 
  padding: 24px; 
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.category-description {
  background: rgba(93, 149, 52, 0.05);
  border: 1px solid rgba(93, 149, 52, 0.1);
  border-radius: 12px;
  padding: 16px;
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* 質問行 */
.question-row { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  padding: 20px 0; 
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.question-row:last-child { 
  border-bottom: none; 
}

.question-row:hover {
  background: rgba(93, 149, 52, 0.05);
  border-radius: 12px;
  padding-left: 16px;
  padding-right: 16px;
  margin-left: -16px;
  margin-right: -16px;
}

.question-text { 
  font-size: 16px; 
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  margin-right: 20px;
  line-height: 1.5;
}

/* 回答選択 */
.answer-options {
  display: flex;
  gap: 8px;
}

.answer-option {
  position: relative;
}

.answer-option input[type="radio"] {
  display: none;
}

/* はい／いいえボタン - デスクトップ版改善 */
.answer-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px; /* 上下パディングを12px→10pxに調整 */
  border: 2px solid var(--border);
  border-radius: 25px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
  margin: 4px 0;
  height: 48px; /* 高さ48pxに固定 */
  /* Android端末での改行防止強化 */
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
  line-height: 1.2;
}

.answer-option input[type="radio"]:checked + label {
  background: #ffcc33;
  color: #333333;
  border-color: #ffcc33;
  transform: scale(1.02); /* 1.05→1.02に調整 */
  box-shadow: var(--shadow);
}

.answer-option label:hover {
  border-color: #ffcc33;
  transform: translateY(-1px);
  background: #ffcc33;
  color: #333333;
  box-shadow: 0 4px 12px rgba(255, 204, 51, 0.3);
}

/* ボタン（variables.cssの共通スタイルを使用） */
.btn { 
  /* btn-baseの共通スタイルを継承 */
  appearance: none; 
  border: none;
  cursor: pointer; 
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
  line-height: 1.2;
  border-radius: 25px;
  padding: 14px 28px;
  box-shadow: var(--shadow);
  
  /* btn専用スタイル */
  background: var(--primary); 
  color: white; 
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}

.btn.outline { 
  background: transparent; 
  color: var(--primary); 
  border: 2px solid var(--primary);
}

.btn.outline:hover {
  background: var(--primary);
  color: white;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ナビゲーション */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.nav-left, .nav-right {
  flex: 1;
}

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

/* フォーム要素 */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 15px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: var(--surface);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 149, 52, 0.1);
}

.form-input::placeholder {
  color: var(--text-secondary);
}

.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: var(--surface);
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  /* テキストエリアの改行制御改善 */
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.5;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(93, 149, 52, 0.1);
}

.form-textarea::placeholder {
  color: var(--text-secondary);
}

/* グリッド */
.grid2 { 
  display: grid; 
  grid-template-columns: repeat(2, minmax(0, 1fr)); 
  gap: 20px; 
}

/* 警告・エラー */
.warn { 
  color: var(--error); 
  margin-top: 12px; 
  display: none;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
}

.question-row.highlight {
  background: rgba(220, 53, 69, 0.05);
  border-left: 4px solid var(--error);
  padding-left: 20px;
}

/* アニメーション（ボタン位置問題解決のため無効化） */
.fade-in {
  /* animation: fadeIn 0.5s ease-in; */
  /* アニメーション無効化 */
}

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

.slide-in {
  /* animation: slideIn 0.3s ease-out; */
  /* アニメーション無効化 */
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* レスポンシブ */
@media (max-width: 768px) { 
  .wrap { 
    max-width: 100%; 
    padding: 20px 16px; /* デスクトップと同じパディング */
  }
  
  .grid2 { 
    grid-template-columns: 1fr; 
  }
  
  .question-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px; /* 16px → 20px */
    padding: 24px 0; /* 20px → 24px */
  }
  
  /* モバイル版質問文読みやすさ改善 */
  .question-text {
    font-size: 14px; /* 18px→14px（指示書通り） */
    line-height: 1.6; /* 22.4px相当 */
    font-weight: 500; /* 可読性向上 */
  }
  
  .answer-options {
    width: 100%;
    justify-content: space-between;
    gap: 12px; /* 8px → 12px */
  }
  
  /* モバイル版はい／いいえボタン改善 */
  .answer-option label {
    flex: 1;
    min-width: auto;
    font-size: 16px; /* 明示的に16px */
    padding: 8px 16px; /* 20px→16px（横パディング調整） */
    height: 44px; /* 40〜45pxの範囲で44px */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Android端末での改行防止強化（モバイル） */
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
    line-height: 1.2;
    /* 長いテキスト対応 */
    font-size: 14px; /* 16px→14pxに縮小してスペース確保 */
  }
  
  /* モバイルでもデスクトップと同じナビゲーション配置を使用 */
  
  /* ヘッダーのレスポンシブ対応 */
  .header h1 {
    font-size: 24px; /* 26px→24pxに調整して改行防止 */
    line-height: 1.3;
    /* モバイルでのヘッダータイトル改行防止強化 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
    max-width: 100%;
  }
  
  .header .subtitle {
    font-size: 16px; /* 14px → 16px */
  }
  
  /* アンケート本文のモバイル対応 */
  .intro-catchcopy {
    font-size: 18px !important; /* 20px → 18px（モバイル版） */
    line-height: 1.4 !important;
    margin-bottom: 12px !important;
  }
  
  .intro-lead {
    font-size: 14px !important; /* 16px → 14px（モバイル版） */
    line-height: 1.6 !important; /* 22.4px相当 */
    margin-bottom: 16px !important;
  }
  
  /* カードタイトルの改善 */
  .card-title {
    font-size: 22px; /* 20px → 22px */
    line-height: 1.3;
  }
  
  /* カード全体の改善 */
  .card {
    padding: 32px 24px; /* 24px → 32px 24px */
    margin-bottom: 32px; /* 24px → 32px */
  }
  
  /* ボタンの改善 */
  .btn {
    min-height: 48px;
    padding: 16px 24px; /* 32px→24pxに調整してテキスト収納 */
    font-size: 16px; /* 18px→16pxに調整 */
    /* モバイルボタンの改行防止強化 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: keep-all;
    line-height: 1.2;
  }
  
  /* モバイル版インジケーター改善 */
  .progress-container {
    margin-bottom: 24px; /* 32px → 24px（コンパクトに） */
  }
  
  .progress-bar {
    height: 4px; /* デスクトップと同じ4px */
  }
  
  .progress-fill {
    height: 8px; /* 進行部分8px */
    top: -2px; /* バーの中央に配置 */
  }
  
  /* ステップインジケーターのレスポンシブ対応 */
  .progress-steps {
    display: none; /* モバイルでは詳細ステップを非表示 */
  }
  
  /* 代わりにシンプルな進捗テキストを表示 */
  .progress-container::after {
    content: "ステップ " attr(data-current) " / " attr(data-total);
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
  }
  
  /* フォーム要素の改善 */
  .form-input, .form-textarea {
    font-size: 16px; /* iOS Safari のズーム防止 */
    padding: 16px; /* 14px 16px → 16px */
  }
  
  .form-label {
    font-size: 16px; /* 15px → 16px */
    margin-bottom: 12px; /* 8px → 12px */
  }
  
  /* アクセシビリティの改善 */
  .answer-option input[type="radio"]:focus + label {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
  }
  
  .btn:focus {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
  }
  
  .form-input:focus, .form-textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
  }
  
  /* モバイル版マイクロインタラクション改善 */
  .answer-option label:active {
    transform: scale(1.05); /* タップ時に拡大 */
    background: #ffcc33;
    color: #333333;
    transition: all 0.1s ease;
  }
  
  .btn:active {
    transform: scale(1.02) translateY(0); /* タップ時に拡大 */
    transition: all 0.1s ease;
  }
}

/* カテゴリスコア新デザイン（共通） */
.category-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.category-score-row:last-child {
  border-bottom: none;
}

.category-score-row:hover {
  background: rgba(93, 149, 52, 0.03);
  padding-left: 16px;
  padding-right: 16px;
  margin-left: -16px;
  margin-right: -16px;
  border-radius: 12px;
}

.category-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.category-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  font-size: 18px;
  font-weight: 700;
  border-radius: 8px;
  flex-shrink: 0;
}

.category-label {
  font-size: 22px;
  font-weight: 700;
  color: #333333;
  line-height: 1.3;
}

.score-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.my-score-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.avg-score-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* スコアグリッドの調整 */
.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* デスクトップで3列表示（1,2,3と4,5,6の2行） */
  gap: 20px;
  margin-top: 16px;
}

/* モバイル対応 - カテゴリスコア */
@media (max-width: 768px) {
  .score-grid {
    display: block; /* モバイルではブロック表示を維持 */
    gap: 0;
  }
  
  .category-score-row {
    padding: 16px 0;
  }
  
  .category-number {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 7px;
  }
  
  .category-label {
    font-size: 18px;
    color: #333333;
  }
  
  .my-score-value {
    font-size: 20px;
  }
  
  .avg-score-text {
    font-size: 12px;
  }
}

/* トースト通知システム */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border-left: 4px solid var(--primary);
  animation: slideInRight 0.3s ease-out;
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
  word-wrap: break-word;
}

.toast.success { 
  border-left-color: var(--success); 
}

.toast.warning { 
  border-left-color: var(--warning); 
}

.toast.error { 
  border-left-color: var(--error); 
}

.toast-icon {
  flex-shrink: 0;
  font-size: 18px;
  margin-top: 2px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.error .toast-icon { color: var(--error); }
.toast.info .toast-icon { color: var(--primary); }

.toast-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.toast-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 15px;
}

.toast-message {
  color: var(--text-secondary);
  font-size: 14px;
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 16px;
  line-height: 1;
}

.toast-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--text-primary);
}

/* アニメーション */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast.removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* モバイル対応 - トースト */
@media (max-width: 768px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .toast {
    margin-bottom: 8px;
    padding: 14px 16px;
  }
  
  .toast-content {
    font-size: 13px;
  }
  
  .toast-title {
    font-size: 14px;
  }
}
