/* ========================================
   AI節約診断 - スタイルシート
   ======================================== */

/* ========================================
   合言葉パスワード画面
   ======================================== */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.password-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.6s ease;
}

.password-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.password-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #2D3436;
}

.password-hint {
  font-size: 13px;
  color: #B2BEC3;
  margin-bottom: 28px;
}

.password-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.password-input-wrap input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #E8ECF1;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

.password-input-wrap input:focus {
  border-color: #6C5CE7;
}

.password-input-wrap .btn-primary {
  white-space: nowrap;
  padding: 12px 20px;
  font-size: 14px;
}

.password-error {
  color: #E17055;
  font-size: 13px;
  font-weight: 600;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* リセット・ベース */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --accent: #00B894;
  --accent-light: #55EFC4;
  --danger: #E17055;
  --danger-light: #FAB1A0;
  --personal: #0984E3;
  --personal-light: #74B9FF;
  --company: #E17055;
  --company-light: #FAB1A0;
  --bg: #F8F9FE;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-muted: #B2BEC3;
  --border: #E8ECF1;
  --shadow: 0 2px 16px rgba(108, 92, 231, 0.08);
  --shadow-hover: 0 4px 24px rgba(108, 92, 231, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  padding-bottom: 40px;
}

/* ========================================
   ヘッダー
   ======================================== */
.header {
  text-align: center;
  padding: 40px 0 20px;
}

.header-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.header-subtitle {
  color: var(--text-light);
  font-size: 15px;
  line-height: 1.6;
}

/* ========================================
   プログレスバー
   ======================================== */
.progress-container {
  margin: 20px 0 30px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width var(--transition);
  width: 16.66%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
}

.step-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  transition: color var(--transition);
}

.step-label.active {
  color: var(--primary);
}

.step-label.completed {
  color: var(--accent);
}

/* ========================================
   フローティング節約額
   ======================================== */
.floating-savings {
  position: sticky;
  top: 10px;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.3);
  margin-bottom: 20px;
}

.floating-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.floating-label {
  font-size: 12px;
  opacity: 0.9;
}

.floating-amount {
  font-size: 22px;
  font-weight: 800;
}

.floating-unit {
  font-size: 12px;
  opacity: 0.8;
}

.floating-sub {
  display: flex;
  gap: 12px;
}

.floating-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  opacity: 0.95;
}

.floating-tag.personal {
  background: rgba(9, 132, 227, 0.3);
}

.floating-tag.company {
  background: rgba(225, 112, 85, 0.3);
}

.floating-tag strong {
  font-weight: 800;
}

/* ========================================
   スクリーン共通
   ======================================== */
.screen {
  display: none;
  animation: fadeIn 0.4s ease;
}

.screen.active {
  display: block;
}

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

/* ========================================
   スタート画面
   ======================================== */
.start-content {
  text-align: center;
  padding: 20px 0 40px;
}

.start-message h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 16px;
  color: var(--text);
}

.start-message p {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.8;
}

.start-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 36px;
}

.cat-chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-start {
  font-size: 18px;
  padding: 16px 48px;
}

.start-note {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================
   ボタン
   ======================================== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--card-bg);
  border-color: var(--primary-light);
  color: var(--primary);
}

.btn-result {
  background: linear-gradient(135deg, var(--accent), #00A381);
}

.btn-result:hover {
  box-shadow: 0 6px 20px rgba(0, 184, 148, 0.3);
}

.btn-arrow {
  font-size: 18px;
}

/* ========================================
   ステップヘッダー
   ======================================== */
.step-header {
  text-align: center;
  margin-bottom: 28px;
}

.step-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
}

.step-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.step-header p {
  color: var(--text-light);
  font-size: 13px;
}

/* ========================================
   アイテムカード（新レイアウト）
   ======================================== */
.items-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.item-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: all var(--transition);
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.item-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.03), rgba(0, 184, 148, 0.03));
  box-shadow: var(--shadow-hover);
}

.item-top-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

/* チェックボックス */
.item-checkbox {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.item-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkmark {
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 6px;
  transition: all var(--transition);
  position: relative;
}

.item-checkbox input:checked ~ .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.item-checkbox input:checked ~ .checkmark::after {
  content: '\2713';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: 700;
}

/* アイテム情報 */
.item-info {
  flex: 1;
  min-width: 0;
}

.item-info h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.item-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.item-range {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 展開エリア */
.item-expand {
  padding: 14px 0 4px 38px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 利用区分トグル */
.usage-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.usage-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

.toggle-option {
  cursor: pointer;
}

.toggle-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.toggle-option input:checked ~ .personal-btn {
  background: rgba(9, 132, 227, 0.1);
  border-color: var(--personal);
  color: var(--personal);
}

.toggle-option input:checked ~ .company-btn {
  background: rgba(225, 112, 85, 0.1);
  border-color: var(--company);
  color: var(--company);
}

/* スライダーセクション */
.slider-section {
  /* no extra padding needed */
}

.slider-label {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.slider-section input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  margin-bottom: 6px;
}

.slider-section input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.slider-section input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.slider-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  text-align: right;
}

.slider-value span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ========================================
   ステップナビゲーション
   ======================================== */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

/* ========================================
   結果画面
   ======================================== */
.result-container {
  padding-bottom: 40px;
}

.result-header {
  text-align: center;
  margin-bottom: 28px;
}

.result-header h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-subtitle {
  color: var(--text-light);
  font-size: 14px;
}

/* メイン比較カード */
.result-main-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-hover);
  margin-bottom: 20px;
}

.result-comparison {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-before, .result-after {
  text-align: center;
  flex: 1;
}

.result-label {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 6px;
}

.result-amount {
  display: block;
  font-size: 26px;
  font-weight: 800;
}

.result-amount.red {
  color: var(--danger);
}

.result-amount.green {
  color: var(--accent);
}

.result-arrow-container {
  text-align: center;
  flex-shrink: 0;
}

.result-arrow {
  font-size: 24px;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 4px;
}

.result-ai-cost {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.result-ai-cost strong {
  color: var(--primary);
}

/* 年間節約額 */
.result-annual {
  margin-bottom: 20px;
}

.result-annual-card {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.25);
}

.result-annual-label {
  display: block;
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.result-annual-amount {
  display: block;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
}

/* 個人/会社 別スプリットカード */
.result-usage-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.usage-split-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  border: 2px solid var(--border);
  text-align: center;
}

.usage-split-card.personal-split {
  border-color: var(--personal-light);
}

.usage-split-card.company-split {
  border-color: var(--company-light);
}

.split-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.split-info {
  margin-bottom: 8px;
}

.split-label {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 4px;
}

.split-amount {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.personal-split .split-amount {
  color: var(--personal);
}

.company-split .split-amount {
  color: var(--company);
}

.split-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.split-yearly {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.split-yearly-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-right: 4px;
}

.split-yearly-amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

/* タイプ判定 */
.result-type-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.result-type-icon {
  font-size: 40px;
  flex-shrink: 0;
}

.result-type-info h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--primary);
}

.result-type-info p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.6;
}

/* カテゴリ別内訳 */
.result-breakdown {
  margin-bottom: 24px;
}

.result-breakdown h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
}

.breakdown-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.breakdown-info {
  flex: 1;
}

.breakdown-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.breakdown-bar-container {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 1s ease;
}

.breakdown-amount {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
  min-width: 90px;
  text-align: right;
}

/* 選択項目詳細 */
.result-items-detail {
  margin-bottom: 24px;
}

.result-items-detail h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-item-name {
  font-size: 14px;
  font-weight: 600;
}

.detail-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.detail-item-category {
  font-size: 11px;
  color: var(--text-muted);
}

.detail-item-usage-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
}

.detail-item-usage-badge.personal {
  background: rgba(9, 132, 227, 0.1);
  color: var(--personal);
}

.detail-item-usage-badge.company {
  background: rgba(225, 112, 85, 0.1);
  color: var(--company);
}

.detail-item-amount {
  font-size: 16px;
  font-weight: 800;
  color: var(--danger);
}

/* メッセージ */
.result-message {
  margin-bottom: 28px;
}

.message-box {
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.06), rgba(0, 184, 148, 0.06));
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.message-box h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.8;
  margin-bottom: 12px;
  color: var(--primary-dark);
}

.message-box p {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.8;
}

/* 結果アクション */
.result-actions {
  text-align: center;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
    padding-bottom: 30px;
  }

  .header h1 {
    font-size: 24px;
  }

  .start-message h2 {
    font-size: 18px;
  }

  .result-comparison {
    flex-direction: column;
    gap: 20px;
  }

  .result-arrow-container {
    transform: rotate(90deg);
  }

  .result-annual-amount {
    font-size: 32px;
  }

  .result-amount {
    font-size: 22px;
  }

  .floating-savings {
    padding: 8px 14px;
    gap: 4px;
  }

  .floating-amount {
    font-size: 18px;
  }

  .floating-sub {
    gap: 8px;
  }

  .floating-tag {
    font-size: 10px;
    padding: 2px 8px;
  }

  .item-card {
    padding: 14px 16px;
  }

  .item-expand {
    padding-left: 0;
  }

  .usage-toggle {
    gap: 6px;
  }

  .result-usage-split {
    grid-template-columns: 1fr;
  }

  .split-amount {
    font-size: 20px;
  }

  .breakdown-item {
    padding: 12px 14px;
  }

  .message-box h3 {
    font-size: 14px;
  }
}

/* ========================================
   アニメーション
   ======================================== */
@keyframes countUp {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.animate-count {
  animation: countUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.pulse {
  animation: pulse 2s infinite;
}
