/* ==========================================================================
   Secret Match 〜社内相性診断〜 - 参加者回答画面スタイル (style.css)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. デザインシステム & 変数定義
   -------------------------------------------------------------------------- */
:root {
  /* カラーパレット */
  --primary-gradient: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
  --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --body-bg: #f5f7fb;
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  
  --accent-color: #ff758c;
  --accent-light: #fff5f6;
  --success-color: #48bb78;
  
  /* シャドウ */
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --button-shadow: 0 4px 15px rgba(255, 117, 140, 0.3);
  --focus-shadow: 0 0 0 3px rgba(255, 117, 140, 0.15);
  
  /* アニメーション */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   2. ベーススタイル
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans JP', 'Outfit', sans-serif;
  background-color: var(--body-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* 背景の装飾用バブル */
.bg-bubble {
  position: absolute;
  border-radius: 50%;
  z-index: 0;
  filter: blur(40px);
  opacity: 0.4;
}

.bubble-1 {
  width: 300px;
  height: 300px;
  background: var(--primary-gradient);
  top: -100px;
  right: -50px;
}

.bubble-2 {
  width: 250px;
  height: 250px;
  background: var(--secondary-gradient);
  bottom: -50px;
  left: -50px;
}

/* --------------------------------------------------------------------------
   3. レイアウトコンテナ
   -------------------------------------------------------------------------- */
.app-container {
  width: 100%;
  max-width: 480px; /* モバイルファーストの最大幅 */
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

/* ヘッダー */
.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logo-emoji {
  font-size: 28px;
  animation: float 3s ease-in-out infinite;
}

.app-header h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 32px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
  margin-top: 4px;
}

/* メインカード */
.main-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

/* --------------------------------------------------------------------------
   4. セクション制御 & アニメーション
   -------------------------------------------------------------------------- */
.section {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.section.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.section-intro {
  margin-bottom: 24px;
  text-align: center;
}

.section-intro h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  display: inline-block;
}

.section-intro h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 10%;
  width: 80%;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.section-intro p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   5. フォーム要素
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-required {
  font-size: 10px;
  background-color: var(--accent-color);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* テキスト入力 */
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background-color: #fafbfc;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: white;
  box-shadow: var(--focus-shadow);
}

/* セレクトボックス */
.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-muted);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fafbfc;
  cursor: pointer;
  appearance: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select:focus {
  outline: none;
  border-color: var(--accent-color);
  background-color: white;
  box-shadow: var(--focus-shadow);
}

.help-text {
  font-size: 12px;
  margin-top: 6px;
}

.help-text a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.help-text a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   6. 価値観アンケート (カスタムラジオボタン)
   -------------------------------------------------------------------------- */
.values-group .group-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.question-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.question-card:focus-within {
  border-color: #ff758c;
  box-shadow: 0 4px 12px rgba(255, 117, 140, 0.08);
}

.q-number {
  position: absolute;
  top: -8px;
  left: 16px;
  background: var(--secondary-gradient);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.q-text {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  margin-top: 4px;
}

.options-container {
  display: flex;
  gap: 10px;
}

.option-button {
  flex: 1;
  cursor: pointer;
  position: relative;
}

.option-button input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.button-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  transition: all var(--transition-fast);
  background-color: #fafbfc;
}

.opt-emoji {
  font-size: 20px;
  margin-bottom: 4px;
  transition: transform var(--transition-fast);
}

.opt-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

/* ラジオボタン選択時のスタイル */
.option-button input[type="radio"]:checked + .button-content {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
}

.option-button input[type="radio"]:checked + .button-content .opt-label {
  color: var(--accent-color);
}

.option-button input[type="radio"]:checked + .button-content .opt-emoji {
  transform: scale(1.2);
}

/* エラーメッセージ */
.error-msg {
  font-size: 12px;
  color: var(--accent-color);
  font-weight: 500;
  margin-top: 6px;
  display: none;
  align-items: center;
  gap: 4px;
}

.error-msg::before {
  content: '⚠️';
}

.form-group.has-error input[type="text"],
.form-group.has-error select {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
}

.form-group.has-error .error-msg {
  display: flex;
}

.question-card.has-error {
  border-color: var(--accent-color);
  background-color: var(--accent-light);
}

/* --------------------------------------------------------------------------
   7. ボタン
   -------------------------------------------------------------------------- */
.primary-btn {
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--button-shadow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 117, 140, 0.4);
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: var(--button-shadow);
}

.btn-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  animation: shine 4s infinite;
}

.secondary-btn {
  background: transparent;
  color: var(--text-muted);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
}

.secondary-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
  background-color: #fafbfc;
}

/* --------------------------------------------------------------------------
   8. 完了・待機画面
   -------------------------------------------------------------------------- */
.thanks-content {
  text-align: center;
  padding: 10px 0;
}

.success-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.heart-pulse {
  display: inline-block;
  animation: pulse 1.5s infinite;
}

.thanks-user-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 8px;
}

.thanks-user-name span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.thanks-message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ローディング/待機演出カード */
.wait-card {
  background: linear-gradient(135deg, #f8f9fd 0%, #f1f3f9 100%);
  border-radius: 18px;
  padding: 24px 16px;
  margin-bottom: 28px;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.spinner-container {
  position: relative;
  width: 70px;
  height: 70px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid var(--accent-color);
  border-radius: 50%;
  animation: ring-pulse 2s infinite ease-out;
}

.spinner-core {
  font-size: 26px;
  z-index: 1;
  animation: search-float 3s ease-in-out infinite;
}

.wait-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #4a5568;
  margin-bottom: 6px;
}

.wait-card p {
  font-size: 13px;
  color: var(--text-muted);
}

/* フッター */
.app-footer {
  text-align: center;
  padding-top: 24px;
}

.app-footer p {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

/* --------------------------------------------------------------------------
   9. アニメーション定義
   -------------------------------------------------------------------------- */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(8deg); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes shine {
  0% { left: -100%; }
  20%, 100% { left: 100%; }
}

@keyframes ring-pulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes search-float {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(15deg); }
}

/* スマホ全画面・全機種幅対応の最適化 */
@media (max-width: 480px) {
  body {
    background-color: var(--body-bg);
  }
  .app-container {
    padding: 8px 4px; /* 余白を最小限にし、横幅いっぱいに広げる */
    width: 100%;
    min-height: 100vh;
  }
  .main-card {
    border-radius: 20px; /* スマートフォンで角丸をわずかに残しつつ幅を最大化 */
    padding: 20px 14px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
  }
  .app-header {
    margin-bottom: 12px;
  }
  .form-group {
    margin-bottom: 18px;
  }
  .question-card {
    padding: 12px;
    margin-bottom: 12px;
  }
  .button-content {
    padding: 10px 6px;
  }
  .opt-emoji {
    font-size: 18px;
  }
  .opt-label {
    font-size: 11px;
  }
}
