/* Track A Analyzer - Stylesheet */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #059669;
  --success-light: #ecfdf5;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
}

/* スクロールバーのカスタマイズ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #1e293b;
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* アニメーション */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 15px rgba(79, 70, 229, 0.4); }
  50% { box-shadow: 0 0 25px rgba(79, 70, 229, 0.8); }
}

.animate-fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pulse-glow {
  animation: pulseGlow 2s infinite ease-in-out;
}

/* チップ選択UI（Interactive Selection Chips） */
.chip-item {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
}

.chip-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.chip-item.selected {
  border-color: #6366f1 !important;
  background-color: rgba(99, 102, 241, 0.15) !important;
  color: #c7d2fe !important;
  box-shadow: 0 0 0 1px #6366f1, 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

.chip-item.selected .chip-check {
  display: inline-flex !important;
}

/* 積極的理由チップ（アクセル） */
.chip-positive {
  border-left: 3px solid #10b981 !important;
}
.chip-positive.selected {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.15) !important;
  box-shadow: 0 0 0 1px #10b981, 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* 消極的理由チップ（ブレーキ・安全装置） */
.chip-negative {
  border-left: 3px solid #f59e0b !important;
}
.chip-negative.selected {
  border-color: #f59e0b !important;
  background-color: rgba(245, 158, 11, 0.15) !important;
  box-shadow: 0 0 0 1px #f59e0b, 0 4px 12px rgba(245, 158, 11, 0.3) !important;
}

/* Markdown レンダリングの装飾 */
.markdown-body {
  line-height: 1.75;
  color: #e2e8f0;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  color: #f8fafc;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.markdown-body h2 {
  font-size: 1.25rem;
  border-bottom: 1px solid #334155;
  padding-bottom: 0.4rem;
}

.markdown-body h3 {
  font-size: 1.1rem;
  color: #818cf8;
}

.markdown-body ul, .markdown-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-body li {
  margin-bottom: 0.4rem;
}

.markdown-body strong {
  color: #a5b4fc;
  font-weight: 600;
}

.markdown-body blockquote {
  border-left: 4px solid #6366f1;
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  margin: 1.25rem 0;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 8px 8px 0;
}

.markdown-body a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.2s;
}

.markdown-body a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.markdown-body code {
  background: #334155;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.markdown-body pre {
  background-color: #0b0f19;
  border: 1px solid #1e293b;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 1rem 0;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: #cbd5e1;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

.markdown-body th, .markdown-body td {
  border: 1px solid #334155;
  padding: 0.6rem 0.85rem;
  text-align: left;
}

.markdown-body th {
  background-color: #1e293b;
  color: #cbd5e1;
  font-weight: 600;
}

.markdown-body tr:nth-child(even) {
  background-color: rgba(30, 41, 59, 0.35);
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid #334155;
  margin: 1.5rem 0;
}

/* チャットバブル（文字サイズの統一） */
.chat-bubble-ai, .chat-bubble-user {
  font-size: 0.9375rem; /* 15px */
  line-height: 1.75;
}

.chat-bubble-ai {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 1rem 1rem 1rem 0.25rem;
}

.chat-bubble-user {
  background-color: #4338ca;
  color: #ffffff;
  border-radius: 1rem 1rem 0.25rem 1rem;
}

/* チャットバブル内の全要素のフォントサイズを均一化 */
.chat-bubble-ai .markdown-body,
.chat-bubble-user .markdown-body {
  font-size: 0.9375rem !important;
  line-height: 1.75;
}

.chat-bubble-ai .markdown-body p,
.chat-bubble-ai .markdown-body li,
.chat-bubble-ai .markdown-body span,
.chat-bubble-ai .markdown-body div,
.chat-bubble-user .markdown-body p,
.chat-bubble-user .markdown-body li,
.chat-bubble-user .markdown-body span,
.chat-bubble-user .markdown-body div {
  font-size: 0.9375rem !important;
  line-height: 1.75;
  margin-bottom: 0.5rem;
}

/* 見出しも巨大化させず、整った統一サイズにする */
.chat-bubble-ai .markdown-body h1,
.chat-bubble-ai .markdown-body h2,
.chat-bubble-ai .markdown-body h3,
.chat-bubble-ai .markdown-body h4 {
  font-size: 1rem !important; /* 16px */
  font-weight: 700;
  margin-top: 0.6rem;
  margin-bottom: 0.4rem;
  border-bottom: none;
  padding-bottom: 0;
  color: #f1f5f9;
}

.chat-bubble-ai .markdown-body ul,
.chat-bubble-ai .markdown-body ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}


/* ステップインジケーターのアクティブスタイル */
.step-node.active .step-icon {
  background-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(79, 70, 229, 0.6);
  border-color: #818cf8;
}
.step-node.completed .step-icon {
  background-color: #059669;
  color: #ffffff;
  border-color: #34d399;
}
.step-node.active .step-title {
  color: #c7d2fe;
  font-weight: 700;
}

/* タイピングインジケーター（思考中アニメーション） */
.typing-dot {
  width: 8px;
  height: 8px;
  background-color: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ステップ固定ヘッダー（スクロール時にも画面上部に常時吸着・固定） */
.step-sticky-header {
  position: sticky;
  top: 0;
  z-index: 25;
  background-color: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 65, 85, 0.85);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* スクロール領域（内部スクロールコンテナ） */
.step-scroll-area {
  overflow-y: auto;
  min-height: 420px;
  max-height: calc(100vh - 280px);
  padding-right: 0.35rem;
  scrollbar-gutter: stable;
}

@media (max-width: 640px) {
  .step-scroll-area {
    min-height: 180px;
    max-height: calc(100vh - 160px);
    padding-right: 0.15rem;
  }
  .step-sticky-header {
    border-radius: 0.85rem;
  }
}

/* スクロールバー非表示ユーティリティ */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 印刷・PDF用 */
@media print {
  body {
    background-color: #ffffff;
    color: #000000;
  }
  .no-print {
    display: none !important;
  }
  .markdown-body {
    color: #111827;
  }
  #manual-modal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  #manual-modal > div {
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #000 !important;
  }
  #manual-modal button {
    display: none !important;
  }
}
