/* ============================================================================
   SV Sporex デザインシステム共通CSS
   ----------------------------------------------------------------------------
   全画面で共通利用するスタイル定義。
   ブランドカラー・タイポグラフィ・コンポーネントを統一管理。
   ============================================================================ */

/* === デザイントークン === */
:root {
  /* ブランドグラデーション(虹色) */
  --gradient-rainbow: linear-gradient(90deg, #f87171 0%, #fbbf24 25%, #86efac 50%, #60a5fa 75%, #c084fc 100%);

  /* 虹色の各色 */
  --rainbow-red: #f87171;
  --rainbow-amber: #fbbf24;
  --rainbow-green: #86efac;
  --rainbow-blue: #60a5fa;
  --rainbow-purple: #c084fc;

  /* ロール別カラー */
  --role-super: #0E0E0C;
  --role-super-accent: #D4A943;
  --role-fed: #534AB7;
  --role-fed-light: #EEEDFE;
  --role-team: #FF8C5A;
  --role-team-light: #FFE4D1;
  --role-member: #5DCAA5;
  --role-member-light: #E1F5EE;

  /* 背景 */
  --bg-primary: #FFF8F1;
  --bg-card: #FFFFFF;
  --bg-secondary: #F4F2EB;
  --bg-tertiary: #E8E5DC;

  /* テキスト */
  --text-primary: #4A1B0C;
  --text-secondary: #5F5E5A;
  --text-tertiary: #888780;
  --text-muted: #B0AC9F;

  /* 境界 */
  --border: #E5E1F0;
  --border-strong: #C0BCA8;

  /* セマンティック */
  --color-success: #1D9E75;
  --color-success-bg: #E1F5EE;
  --color-warning: #BA7517;
  --color-warning-bg: #FAEEDA;
  --color-error: #A32D2D;
  --color-error-bg: #FCEBEB;
  --color-info: #185FA5;
  --color-info-bg: #E6F1FB;

  /* 角丸 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* 影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.10);

  /* タップ領域 */
  --tap-target-min: 44px;
}

/* === リセット === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', -apple-system,
               BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; padding: 0; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* === スマホフレーム(プレビュー用) === */
.phone-frame {
  width: 375px;
  min-height: 750px;
  margin: 24px auto;
  background: var(--bg-primary);
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
  border: 8px solid #1a1a1a;
}
.phone-status-bar {
  background: var(--bg-primary);
  padding: 8px 20px 4px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}

/* PC用フレーム */
.desktop-frame {
  max-width: 1280px;
  margin: 24px auto;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.desktop-frame-header {
  background: #f0ebe2;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}
.desktop-frame-header .dot {
  width: 12px; height: 12px; border-radius: 50%;
}
.desktop-frame-url {
  flex: 1; margin: 0 16px;
  background: white; padding: 4px 12px;
  border-radius: 6px; font-size: 11px;
  color: var(--text-tertiary);
  font-family: ui-monospace, monospace;
}

/* === 画面共通レイアウト === */
.screen {
  background: var(--bg-primary);
  min-height: 100vh;
  position: relative;
}

/* ヘッダー */
.app-header {
  background: white;
  border-bottom: 0.5px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header-left {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.app-header-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-secondary);
}
.app-header-title {
  font-size: 16px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-actions {
  display: flex; align-items: center; gap: 8px;
}
.app-header-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-secondary);
  position: relative;
}
.app-header-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: var(--color-error);
  color: white;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* パンくず */
.breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 8px 16px;
  background: var(--bg-secondary);
}
.breadcrumb a { color: var(--text-tertiary); }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }

/* メインコンテンツ */
.app-main {
  padding: 16px;
  padding-bottom: 80px; /* ボトムナビ分 */
}

/* ボトムナビ */
.app-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: white;
  border-top: 0.5px solid var(--border);
  display: flex;
  padding: 6px 0 12px;
  z-index: 40;
}
.app-bottomnav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 6px;
  font-size: 10px;
  color: var(--text-tertiary);
}
.app-bottomnav-item.active {
  color: var(--role-fed);
}
.app-bottomnav-item.active.role-team { color: var(--role-team); }
.app-bottomnav-item.active.role-member { color: var(--role-member); }
.app-bottomnav-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

/* 浮動ホームボタン */
.floating-home {
  position: fixed;
  bottom: 88px; right: 16px;
  width: 56px; height: 56px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  z-index: 30;
}

/* === カード === */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  border: 0.5px solid var(--border);
  margin-bottom: 12px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* === セクション見出し === */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 16px 0 8px;
}

/* === ボタン === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  min-height: var(--tap-target-min);
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--role-fed);
  color: white;
}
.btn-primary.role-team { background: var(--role-team); }
.btn-primary.role-member { background: var(--role-member); }

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 0.5px solid var(--border-strong);
}

.btn-text {
  color: var(--role-fed);
  background: transparent;
  padding: 8px 12px;
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-rainbow {
  background: var(--gradient-rainbow);
  color: white;
}

/* === 入力フィールド === */
.field {
  margin-bottom: 16px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.field-label .required {
  color: var(--color-error);
  margin-left: 4px;
}
.field-label .optional {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: 6px;
  font-weight: 400;
}
.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: white;
  font-size: 15px;
  color: var(--text-primary);
  transition: border-color 0.15s;
}
.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--role-fed);
  box-shadow: 0 0 0 2px rgba(83, 74, 183, 0.15);
}
.field-textarea { min-height: 88px; resize: vertical; }
.field-help {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* === バッジ === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-fed { background: var(--role-fed-light); color: var(--role-fed); }
.badge-team { background: var(--role-team-light); color: var(--role-team); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* === リスト === */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border-bottom: 0.5px solid var(--border);
}
.list-item:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.list-item:last-child { border-bottom: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.list-item:only-child { border-radius: var(--radius-lg); }

.list-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.list-content {
  flex: 1;
  min-width: 0;
}
.list-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.list-arrow {
  color: var(--text-tertiary);
  font-size: 16px;
}

/* === アラート === */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.alert-info { background: var(--color-info-bg); color: var(--color-info); }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.alert-error { background: var(--color-error-bg); color: var(--color-error); }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }

/* === ステップインジケーター === */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 16px 8px;
  background: white;
}
.step-dot {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
}
.step-dot.active { background: var(--role-fed); }
.step-dot.complete { background: var(--color-success); }
.step-label {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  padding-bottom: 8px;
  background: white;
}
.step-label .current {
  color: var(--text-primary);
  font-weight: 500;
}

/* === ロゴSVG用 === */
.logo {
  display: inline-block;
  vertical-align: middle;
}

/* === ユーティリティ === */
.text-center { text-align: center; }
.text-muted { color: var(--text-tertiary); }
.text-small { font-size: 12px; }
.text-tiny { font-size: 11px; }
.text-bold { font-weight: 600; }
.text-rainbow {
  background: var(--gradient-rainbow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* === 「次にやること」バナー === */
.next-action {
  background: linear-gradient(135deg, var(--role-fed) 0%, #7F77DD 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.next-action-label {
  font-size: 11px;
  opacity: 0.9;
}
.next-action-text {
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}
.next-action-arrow {
  margin-left: auto;
  font-size: 20px;
}

/* === 統計タイル === */
.stat-tile {
  background: white;
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  border: 0.5px solid var(--border);
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.stat-delta {
  font-size: 11px;
  margin-top: 4px;
}
.stat-delta.up { color: var(--color-success); }
.stat-delta.down { color: var(--color-error); }


/* ============================================================================
   実機表示用スタイル(本番アプリ用)
   ----------------------------------------------------------------------------
   - スマホ: ナチュラルに全画面表示
   - PC・iPad: 中央に375px幅で表示、周囲はグレー背景
   - .phone-frame を使うカタログ用ページには影響しない
   ============================================================================ */

/* PCで見た時の背景・余白 */
@media (min-width: 376px) {
  body {
    background: #f0ebe2;
    min-height: 100vh;
  }

  /* phone-frame を使っていない実画面のラッパー */
  body > header,
  body > main,
  body > nav,
  body > .flash-message {
    max-width: 375px;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg-primary);
  }

  /* ヘッダーとボトムナビ:角丸で上下に枠 */
  body > header.app-header {
    border-radius: 16px 16px 0 0;
    margin-top: 24px;
  }

  body > nav.app-bottomnav {
    border-radius: 0 0 16px 16px;
    margin-bottom: 24px;
  }
}

/* スマホ画面で全画面表示 */
@media (max-width: 375px) {
  body {
    background: var(--bg-primary);
  }
}

/* ボトムナビがある画面で、main部分が隠れないように余白 */
body > main.app-main {
  padding-bottom: 80px;
}
