/* ============================================================
   DIFO-TEST — simulation-common.css
   シミュレーション実習ページ共通スタイル
   difo-test デザインシステム（common.css）準拠
   ============================================================ */

/* ============================================================
   LAYOUT — セクション・コンテナ
   ============================================================ */
body {
  padding-top: var(--nav-h);
}

.container-area {
  width: 100%;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 48px;
}

section {
  padding: var(--section-py) 0;
}

section:nth-child(even) {
  background: var(--neutral-light);
}

section:nth-child(odd) {
  background: var(--white);
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
/* common.css の .section-title を div コンテナとして上書きするため
   フォント関連プロパティをリセットしてから h4 で再定義する */
.section-title {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title h4 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--neutral-dark);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.section-title h4 .subtitle {
  display: inline-block;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--primary-pale);
  padding: 2px 12px;
  border-radius: var(--radius-pill);
  margin-left: 10px;
  vertical-align: middle;
}

/* ============================================================
   PRACTICE / REQUIREMENTS / DESCRIPTION CONTENT
   ============================================================ */
.practice-content,
.requirements-content {
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
  color: var(--neutral-medium);
}

.practice-content p,
.requirements-content p {
  margin-bottom: 1rem;
}

.practice-content ol {
  padding-left: 2rem;
  list-style: decimal;
}

.practice-content li {
  margin-bottom: 0.75rem;
  color: var(--neutral-medium);
}

/* ============================================================
   IMAGE CONTAINER — 技術資料図面
   ============================================================ */
.image-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.image-container img {
  max-width: 820px;
  width: 100%;
  max-height: 80vh;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.image-container img:hover {
  transform: scale(1.015);
  box-shadow: var(--shadow-lg);
}

.drawing-image {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.drawing-image:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}

/* Doc image switching */
.doc-img {
  max-width: 100%;
  height: auto;
  display: none;
  margin: 0 auto;
  object-fit: contain;
}

.doc-img.active {
  display: block;
}

/* ============================================================
   UTILITY
   ============================================================ */
.user-select-none {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* ============================================================
   CONSTRUCTION ITEMS — 作業実施
   ============================================================ */
.construction-content,
.implementation-content {
  max-width: 900px;
  margin: 0 auto;
}

.construction-item {
  background: var(--white);
  padding: 24px 28px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary-color);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}

.construction-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(2px);
}

/* 白背景セクション(odd)上では func-detail と同様にカードを淡色にする */
section:nth-child(odd) .construction-item {
  background: var(--primary-bg);
  border-left-color: var(--secondary-color);
}

section:nth-child(odd) .construction-item:hover {
  box-shadow: var(--shadow-md);
}

.construction-item h5 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
  line-height: 1.4;
}

.item-icon {
  margin-right: 6px;
  color: var(--primary-color);
}

.construction-item p {
  line-height: 1.85;
  color: var(--neutral-medium);
  margin-bottom: 8px;
}

.construction-item p:last-child {
  margin-bottom: 0;
}

.construction-item ol {
  padding-left: 1.5rem;
  list-style: decimal;
  margin-top: 8px;
}

.construction-item li {
  margin-bottom: 8px;
  line-height: 1.8;
  color: var(--neutral-medium);
}

.construction-item strong {
  color: var(--neutral-dark);
  font-weight: 600;
}

/* ============================================================
   SIMULATION BUTTON
   ============================================================ */
.simulation-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem 0;
}

.simulation-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary-color);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(47, 122, 182, 0.28);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.simulation-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(47, 122, 182, 0.38);
}

.simulation-button:active:not(:disabled) {
  transform: translateY(0);
}

.simulation-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--neutral-medium);
  box-shadow: none;
}

.button-text {
  display: inline-block;
}

.loading-text {
  position: relative;
  font-style: italic;
  opacity: 0.85;
}

.loading-text::after {
  content: '';
  display: inline-block;
  animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ============================================================
   GUIDE BUTTON
   ============================================================ */
.guide-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
}

.guide-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--primary-color);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.guide-button:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
}

/* ============================================================
   DOC SWITCH BAR — 技術資料切替
   ============================================================ */
.doc-switch-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 1.5rem 0 1rem;
}

.doc-btn {
  padding: 8px 20px;
  border: 1.5px solid rgba(47, 122, 182, 0.25);
  background: var(--primary-bg);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-medium);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.doc-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-pale);
}

.doc-btn.active {
  background: var(--primary-color);
  color: var(--white);
  border-color: var(--primary-color);
}

/* ============================================================
   SIM BACK BUTTON — 実例リストへ戻る
   ============================================================ */
.sim-back-btn {
  position: fixed;
  left: 24px;
  top: calc(var(--nav-h) + 28px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s var(--ease);
  z-index: 90;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
  white-space: nowrap;
}

.sim-back-btn:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.sim-back-btn:active {
  transform: scale(0.97);
}

.sim-back-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}

.sim-back-btn:hover svg {
  transform: translateX(-3px);
}

.sim-back-btn:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* ============================================================
   PAGE TOGGLE BUTTON — 解答例切替
   ============================================================ */
.page-toggle-button {
  position: fixed;
  right: 24px;
  top: calc(var(--nav-h) + 28px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s var(--ease);
  z-index: 90;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
  white-space: nowrap;
}

.page-toggle-button:hover {
  background: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.page-toggle-button:active {
  transform: scale(0.97);
}

.page-toggle-button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}

.page-toggle-button:hover svg {
  transform: translateX(3px);
}

.page-toggle-button:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* ============================================================
   DIALOG — iframe-dialog
   ============================================================ */
.common-dialog.iframe-dialog {
  border: none;
  padding: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  max-width: 95vw;
  width: 1400px;
}

.common-dialog.iframe-dialog::backdrop {
  background: rgba(10, 18, 32, 0.65);
  backdrop-filter: blur(4px);
}

/* ============================================================
   FADE-IN ANIMATIONS (difo-original class support)
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

.fade-in-1 { transition-delay: 0.05s; }
.fade-in-2 { transition-delay: 0.12s; }
.fade-in-3 { transition-delay: 0.20s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .container-area {
    padding: 0 32px;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: var(--nav-h);
  }

  .container-area {
    padding: 0 20px;
  }

  section {
    padding: 48px 0;
  }

  .section-title h4 {
    font-size: 1.25rem;
  }

  .construction-item {
    padding: 18px 20px;
  }

  .sim-back-btn {
    left: 12px;
    top: calc(var(--nav-h) + 16px);
    padding: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    justify-content: center;
  }

  .sim-back-btn span {
    display: none;
  }

  .sim-back-btn svg {
    width: 20px;
    height: 20px;
  }

  .page-toggle-button {
    right: 12px;
    top: calc(var(--nav-h) + 16px);
    padding: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    justify-content: center;
  }

  .page-toggle-button span {
    display: none;
  }

  .page-toggle-button svg {
    width: 20px;
    height: 20px;
  }

  .image-container img {
    border-radius: var(--radius-sm);
  }

  .report-table td.label {
    width: 120px;
  }

  .test-results {
    grid-template-columns: 1fr;
  }

  .radio-inline {
    gap: 6px 10px;
  }
}

@media (max-width: 480px) {
  .simulation-button {
    padding: 12px 24px;
    font-size: 0.9rem;
  }
}

/* ============================================================
   SECTION DESCRIPTION — セクション概要テキスト
   ============================================================ */
.section-description {
  max-width: 800px;
  margin: 0 auto 1.5rem;
  line-height: 1.8;
  color: var(--neutral-medium);
  text-align: center;
}

/* ============================================================
   OBJECTIVES CONTENT — 実習内容（番号リスト）
   ============================================================ */
.objectives-content {
  max-width: 800px;
  margin: 0 auto;
}

.objectives-content ol {
  padding-left: 1.75rem;
  counter-reset: none;
  list-style: decimal;
}

.objectives-content ol li {
  padding: 8px 0;
  line-height: 1.8;
  color: var(--neutral-medium);
  border-bottom: 1px solid rgba(47, 122, 182, 0.08);
}

.objectives-content ol li:last-child {
  border-bottom: none;
}

/* ============================================================
   EVALUATION CONTENT — 評価表
   ============================================================ */
.evaluation-content {
  max-width: 900px;
  margin: 0 auto;
}

/* ============================================================
   REPORT — 実習報告書
   ============================================================ */
.report-content {
  max-width: 900px;
  margin: 0 auto;
}

.report-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--neutral-dark);
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-color);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.report-table tr {
  border-bottom: 1px solid rgba(47, 122, 182, 0.1);
}

.report-table tr:last-child {
  border-bottom: none;
}

.report-table td {
  padding: 14px 20px;
  line-height: 1.75;
  color: var(--neutral-medium);
  vertical-align: top;
}

.report-table td.label {
  width: 160px;
  font-weight: 600;
  color: var(--neutral-dark);
  background: var(--primary-bg);
  white-space: nowrap;
}

.input-field {
  width: 100%;
  max-width: 320px;
  padding: 8px 12px;
  border: 1.5px solid rgba(47, 122, 182, 0.25);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--neutral-dark);
  background: var(--white);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(47, 122, 182, 0.12);
}

/* ============================================================
   RESULTS SECTION — 実習結果
   ============================================================ */
.results-section {
  background: var(--neutral-light);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 1.5rem;
}

.results-section > h5 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--neutral-dark);
  margin-bottom: 1.25rem;
}

.question-section {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary-color);
}

.question-section:last-child {
  margin-bottom: 0;
}

p.question {
  font-weight: 600;
  color: var(--neutral-dark);
  margin-bottom: 10px;
  line-height: 1.7;
}

.radio-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  line-height: 1.7;
  color: var(--neutral-medium);
}

.radio-inline label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--neutral-medium);
}

.radio-inline input[type="radio"] {
  accent-color: var(--primary-color);
  cursor: pointer;
}

.test-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.test-column {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.test-column h6 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--neutral-dark);
  margin-bottom: 10px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-group label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--neutral-medium);
  line-height: 1.6;
}

.radio-group input[type="radio"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* ============================================================
   ADJUSTMENT STEPS — 通電調整リスト
   ============================================================ */
ol.adjustment-steps {
  padding-left: 1.5rem;
  list-style: decimal;
  margin-top: 8px;
}

ol.adjustment-steps li {
  margin-bottom: 8px;
  line-height: 1.8;
  color: var(--neutral-medium);
}

/* ============================================================
   REPORT ACTIONS — 保存ボタン
   ============================================================ */
.report-actions {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.save-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 40px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--primary-color);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(47, 122, 182, 0.28);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.save-button:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(47, 122, 182, 0.38);
}

.save-button:active {
  transform: translateY(0);
}

/* ============================================================
   ACCESSIBILITY — prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .sim-back-btn,
  .page-toggle-button,
  .construction-item,
  .simulation-button,
  .save-button,
  .fade-in {
    transition: none !important;
  }

  .page-toggle-button:hover,
  .page-toggle-button:hover svg {
    transform: none !important;
  }
}
