/* ==========================================================
   雷・サージ・避雷器・アース学習ツール 共通スタイル
   Tailwind CDN をベースに、Tailwind だけでは表現しにくい
   装飾（稲妻アニメーション、図解、アコーディオン等）を補完する
   ========================================================== */

:root {
  --color-navy: #0b1120;
  --color-navy-light: #111a30;
  --color-accent: #facc15; /* 稲妻イエロー */
  --color-accent-2: #38bdf8; /* サージブルー */
  --color-danger: #f87171;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f6f7fb;
}

/* ---------- 稲妻アニメーション ---------- */
.lightning-flash {
  position: relative;
  overflow: hidden;
}

.lightning-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 20%, rgba(250, 204, 21, 0.25), transparent 55%);
  animation: flash 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes flash {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: 1; }
  94% { opacity: 0.2; }
  95% { opacity: 1; }
  97% { opacity: 0; }
}

.bolt-icon {
  filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.6));
}

/* ---------- カード共通 ---------- */
.topic-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.topic-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -15px rgba(15, 23, 42, 0.35);
}

/* ---------- アコーディオン ---------- */
.accordion-item .accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.accordion-item.open .accordion-body {
  max-height: 2000px;
}
.accordion-item .chevron {
  transition: transform 0.3s ease;
}
.accordion-item.open .chevron {
  transform: rotate(180deg);
}

/* ---------- ナビ アクティブ表示 ---------- */
.nav-link {
  position: relative;
}
.nav-link.active {
  color: var(--color-accent) !important;
}
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ---------- 図解（雷の経路など）用の線 ---------- */
.diagram-line {
  stroke: var(--color-accent-2);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
}
.diagram-line-danger {
  stroke: var(--color-danger);
}
.diagram-line-earth {
  stroke: #22c55e;
}

/* ---------- 波形グラフ用の枠 ---------- */
.waveform-box {
  background: #0b1120;
  border-radius: 0.75rem;
}

/* ---------- スクロールバー ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #e5e7eb;
}
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}

/* ---------- クイズ ---------- */
.quiz-option {
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.quiz-option:hover {
  transform: translateX(4px);
}
.quiz-option.correct {
  background-color: #dcfce7 !important;
  border-color: #22c55e !important;
}
.quiz-option.wrong {
  background-color: #fee2e2 !important;
  border-color: #ef4444 !important;
}
.quiz-option[disabled] {
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- 用語集 ---------- */
.glossary-term mark {
  background-color: #fef08a;
  padding: 0 2px;
  border-radius: 2px;
}

/* ---------- バッジ ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ---------- モバイルメニュー ---------- */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
#mobile-menu.open {
  max-height: 600px;
}

/* ---------- 印刷時に隠す ---------- */
@media print {
  header, footer, .no-print { display: none !important; }
}

/* ---------- コースサイドバー レイアウト ---------- */
.course-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .course-layout {
    grid-template-columns: 280px 1fr;
  }
  .course-sidebar-sticky {
    position: sticky;
    top: 5rem;
    align-self: start;
  }
}

/* ---------- レッスンセクション完了バッジ ---------- */
.lesson-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #059669;
  background: #d1fae5;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

/* ---------- タイムライン（ケーススタディ用） ---------- */
.timeline-item {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid #e2e8f0;
  padding-bottom: 1.5rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f87171;
  border: 2px solid white;
  box-shadow: 0 0 0 2px #f87171;
}
.timeline-item:last-child {
  border-left-color: transparent;
}

/* ---------- 修了証プレースホルダー ---------- */
.certificate-frame {
  background: linear-gradient(135deg, #fffbeb 0%, #ffffff 60%);
  border: 3px solid #facc15;
  position: relative;
}
.certificate-frame::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid #fde68a;
  pointer-events: none;
}

/* ---------- レベルバッジ ---------- */
.level-badge-beginner { background: #dbeafe; color: #1d4ed8; }
.level-badge-intermediate { background: #fef3c7; color: #b45309; }
.level-badge-advanced { background: #fee2e2; color: #b91c1c; }
