/* ============================================================
   mclc-learning  共通スタイル
   白基調 / Power Platform を意識した落ち着いたパープルアクセント
   ============================================================ */

:root {
  /* 色 */
  --bg: #ffffff;
  --surface: #f7f8fb;
  --surface-2: #eef0f6;
  --border: #e3e6ef;
  --border-strong: #d2d7e5;

  --text: #1b1e2b;
  --text-muted: #5b6275;
  --text-dim: #9298ab;

  --accent: #6b3fd4;          /* Power Platform 系パープル */
  --accent-hover: #5a31c0;
  --accent-soft: #f1ecfc;
  --accent-line: #d9cdf6;

  --success: #14935a;
  --success-soft: #e7f5ee;
  --warning: #b9740a;
  --warning-soft: #fdf2e0;

  /* フォント */
  --font-en: 'Inter', system-ui, sans-serif;
  --font-ja: 'Noto Sans JP', system-ui, sans-serif;

  /* その他 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(27,30,43,0.06);
  --shadow: 0 4px 16px rgba(27,30,43,0.08);
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ja);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── ヘッダー ── */
.site-header {
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #9b6cf0);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.85rem;
}

.header-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── 汎用ボタン ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-ja);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:disabled { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }

.btn-ghost { background: #fff; color: var(--text-muted); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger { background: #fff; color: #c0392b; border-color: #eccfca; }
.btn-danger:hover { background: #fcf0ee; }

/* ============================================================
   学習ページ レイアウト
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: calc(100vh - 60px);
}

/* サイドナビ */
.side-nav {
  border-right: 1px solid var(--border);
  padding: 2rem 1.4rem;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.nav-eyebrow {
  font-family: var(--font-en);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.step-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.step-item:hover { background: var(--surface); }
.step-item.active { background: var(--accent-soft); border-color: var(--accent-line); }

.step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-en);
  font-size: 0.74rem;
  font-weight: 700;
  transition: all 0.2s;
}
.step-num.inactive { background: #fff; color: var(--text-dim); border: 1.5px solid var(--border-strong); }
.step-num.active { background: var(--accent); color: #fff; }
.step-num.done { background: var(--success); color: #fff; }

.step-text { font-size: 0.83rem; color: var(--text-muted); line-height: 1.45; }
.step-item.active .step-text { color: var(--text); font-weight: 500; }

/* 進捗 */
.progress-wrap { margin-top: 1.8rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.progress-label {
  display: flex; justify-content: space-between;
  font-family: var(--font-en);
  font-size: 0.72rem; color: var(--text-dim); margin-bottom: 8px;
}
.progress-bar { height: 5px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9b6cf0);
  border-radius: 5px;
  width: 0%;
  transition: width 0.4s ease;
}

/* メイン */
.content { padding: 2.5rem 3rem; max-width: 800px; }

.step-panel { display: none; }
.step-panel.visible { display: block; animation: fadeUp 0.25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.step-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.8rem; }
.step-icon {
  width: 46px; height: 46px;
  border-radius: 11px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.step-eyebrow {
  font-family: var(--font-en);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.step-title { font-size: 1.45rem; font-weight: 700; line-height: 1.3; }
.step-sub { font-size: 0.86rem; color: var(--text-muted); margin-top: 3px; }

.body-text { font-size: 0.92rem; color: var(--text-muted); margin-bottom: 1.4rem; }
.body-text .hl { color: var(--text); font-weight: 600; }
.body-text .hl-accent { color: var(--accent); font-weight: 600; }

h3.section-h {
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  margin: 1.8rem 0 0.7rem;
}

/* ── 画像スロット ── */
.media-slot { margin: 1.5rem 0; }

.media-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.media-frame img { display: block; width: 100%; height: auto; }

/* 画像未設定時のプレースホルダー */
.media-placeholder {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.6rem;
  display: flex; flex-direction: column; gap: 12px;
}
.media-ph-top { display: flex; align-items: center; gap: 10px; }
.media-ph-icon { font-size: 1.5rem; opacity: 0.5; }
.media-ph-title { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.media-ph-slot {
  font-family: var(--font-en);
  font-size: 0.68rem; color: var(--text-dim);
  margin-left: auto;
  background: #fff; border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 5px;
}
.prompt-label {
  font-family: var(--font-en);
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.prompt-text {
  font-size: 0.8rem; color: var(--text-muted);
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; line-height: 1.65;
}

/* ── インフォボックス ── */
.info {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.9rem 1.1rem;
  margin: 1.2rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.info.tip { border-left-color: var(--success); background: var(--success-soft); }
.info.warn { border-left-color: var(--warning); background: var(--warning-soft); }
.info-label {
  font-family: var(--font-en);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 4px; color: var(--accent);
}
.info.tip .info-label { color: var(--success); }
.info.warn .info-label { color: var(--warning); }
.info code, .mono {
  font-family: var(--font-en);
  background: #fff; border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px; font-size: 0.85em; color: var(--text);
}

/* ── チェックリスト ── */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 10px; margin: 1.1rem 0; }
.check-item {
  display: flex; align-items: flex-start; gap: 11px;
  font-size: 0.88rem; color: var(--text-muted); cursor: pointer;
}
.check-box {
  width: 20px; height: 20px; border-radius: 6px;
  border: 2px solid var(--border-strong); flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; background: #fff;
}
.check-item.checked .check-box { background: var(--success); border-color: var(--success); }
.check-item.checked .check-box::after { content: '✓'; color: #fff; font-size: 0.72rem; font-weight: 700; }
.check-item.checked span { text-decoration: line-through; color: var(--text-dim); }
.check-box.static-num { background: var(--accent); border-color: var(--accent); color: #fff; font-family: var(--font-en); font-size: 0.66rem; font-weight: 700; }

/* ── アプリグリッド（ワッフルの説明図） ── */
.app-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin: 1rem 0; max-width: 320px;
}
.app-tile {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 6px; text-align: center; font-size: 0.7rem; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.app-tile.highlight { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
.app-tile-icon { font-size: 1.4rem; }

/* ── ナビボタン ── */
.nav-buttons {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 2.5rem; padding-top: 1.4rem; border-top: 1px solid var(--border);
}
.step-counter { font-family: var(--font-en); font-size: 0.78rem; color: var(--text-dim); }

/* ── クイズ ── */
.quiz-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.quiz-q { padding: 14px 16px; cursor: pointer; font-size: 0.88rem; font-weight: 500; display: flex; justify-content: space-between; gap: 12px; }
.quiz-q::after { content: '＋'; color: var(--text-dim); }
.quiz-item.open .quiz-q::after { content: '−'; }
.quiz-a { display: none; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--success); background: var(--success-soft); }
.quiz-item.open .quiz-a { display: block; }

/* ── 完了カード ── */
.done-card {
  margin-top: 2.5rem; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center;
}
.done-emoji { font-size: 2rem; margin-bottom: 10px; }
.done-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.done-sub { font-size: 0.85rem; color: var(--text-muted); }

/* ── まとめ箱 ── */
.summary-box {
  border: 1px solid var(--border); border-left: 3px solid var(--success);
  background: var(--success-soft); border-radius: var(--radius-sm);
  padding: 1rem 1.2rem; margin: 1.2rem 0;
}
.summary-box ul { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; font-size: 0.86rem; color: var(--text-muted); }

/* ============================================================
   トップページ（コース一覧）
   ============================================================ */
.hero {
  max-width: var(--maxw); margin: 0 auto; padding: 4rem 2rem 2.5rem;
}
.hero-eyebrow {
  font-family: var(--font-en); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.8rem;
}
.hero-title { font-size: 2.4rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; max-width: 620px; }
.hero-sub { font-size: 1rem; color: var(--text-muted); margin-top: 1rem; max-width: 560px; }

.course-grid {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem 2rem 4rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem;
}
.course-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; background: #fff; transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.course-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--accent-line); text-decoration: none; }
.course-card.disabled { opacity: 0.55; pointer-events: none; }
.course-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.course-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.course-desc { font-size: 0.85rem; color: var(--text-muted); flex: 1; }
.course-meta { font-family: var(--font-en); font-size: 0.74rem; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.tag {
  font-size: 0.66rem; font-weight: 600; padding: 2px 8px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
}
.tag.soon { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }

/* ============================================================
   管理画面
   ============================================================ */
.admin-wrap { max-width: 860px; margin: 0 auto; padding: 2.5rem 2rem 4rem; }
.admin-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 0.4rem; }
.admin-sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 2rem; }

.admin-section {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; margin-bottom: 1.4rem; background: #fff;
}
.admin-section h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field .hint { font-size: 0.76rem; color: var(--text-dim); margin-top: 4px; }

.input, .select {
  width: 100%; padding: 10px 12px; font-size: 0.88rem; font-family: var(--font-ja);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text);
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mono-input { font-family: var(--font-en); }

/* ドロップゾーン */
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 2rem; text-align: center; background: var(--surface);
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 1.8rem; opacity: 0.5; }
.drop-text { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; }
.drop-preview { margin-top: 1rem; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: none; }

/* スロット一覧テーブル */
.slot-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.slot-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); font-family: var(--font-en); padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.slot-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.slot-table tr:last-child td { border-bottom: none; }
.slot-thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); }
.slot-key { font-family: var(--font-en); font-size: 0.78rem; color: var(--text); }
.slot-date { font-family: var(--font-en); font-size: 0.72rem; color: var(--text-dim); }

/* トースト */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.85rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #c0392b; }
.toast.success { background: var(--success); }

/* 設定バナー（WORKER_URL未設定時の警告） */
.config-banner {
  background: var(--warning-soft); border: 1px solid #f0d9b0; color: var(--warning);
  border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; margin-bottom: 1.4rem; font-size: 0.83rem;
}

/* ── レスポンシブ ── */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side-nav { display: none; }
  .content { padding: 1.6rem 1.3rem; }
  .step-title { font-size: 1.2rem; }
  .hero-title { font-size: 1.8rem; }
}
