/* ============================================
   会話コラム レイアウト
   2キャラクター（ユーザー / AI）のチャット風UI
   ============================================ */

/* ---------- Conversation Block ---------- */
.conversation-block {
  margin-bottom: var(--space-2xl);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.conversation-block-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.conversation-block-title .conv-icon {
  font-size: 1.15rem;
}

/* ---------- Chat Container ---------- */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.chat-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(99, 102, 241, 0.1) 15%,
    rgba(99, 102, 241, 0.1) 85%,
    transparent 100%
  );
  z-index: 0;
  pointer-events: none;
  display: none;
}

/* ---------- Chat Row ---------- */
.chat-row {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  position: relative;
  z-index: 1;
  animation: chatFadeIn 0.4s ease-out both;
}

.chat-row:nth-child(1) { animation-delay: 0.05s; }
.chat-row:nth-child(2) { animation-delay: 0.15s; }
.chat-row:nth-child(3) { animation-delay: 0.25s; }
.chat-row:nth-child(4) { animation-delay: 0.35s; }
.chat-row:nth-child(5) { animation-delay: 0.45s; }
.chat-row:nth-child(6) { animation-delay: 0.55s; }
.chat-row:nth-child(7) { animation-delay: 0.65s; }
.chat-row:nth-child(8) { animation-delay: 0.75s; }

@keyframes chatFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* AI row: left-aligned */
.chat-row.ai {
  flex-direction: row;
  padding-right: 48px;
}

/* User row: right-aligned */
.chat-row.user {
  flex-direction: row-reverse;
  padding-left: 48px;
}

/* ---------- Avatar ---------- */
.chat-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-glass);
  transition: var(--transition-fast);
  position: relative;
}

.chat-row.user .chat-avatar {
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.1);
}

.chat-row.ai .chat-avatar {
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Bubble ---------- */
.chat-bubble {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  max-width: 100%;
  flex: 1;
}

/* AI bubble */
.chat-row.ai .chat-bubble {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-top-left-radius: 4px;
}

/* User bubble */
.chat-row.user .chat-bubble {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-top-right-radius: 4px;
}

/* Speaker name */
.chat-speaker {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}

.chat-row.user .chat-speaker {
  color: #fbbf24;
}

.chat-row.ai .chat-speaker {
  color: var(--accent-3);
}

/* Bubble text */
.chat-text {
  color: var(--text-primary);
  font-weight: 400;
}

.chat-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.chat-text em {
  color: var(--accent-3);
  font-style: normal;
  font-weight: 500;
}

/* Bubble code / highlight */
.chat-text code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: #f0abfc;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* ---------- Typing indicator ---------- */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
}

.chat-typing span {
  width: 6px;
  height: 6px;
  background: var(--accent-3);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ---------- Explanation Section ---------- */
.explanation-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
  position: relative;
}

.explanation-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.explanation-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.explanation-title .expl-icon {
  font-size: 1.1rem;
}

.explanation-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 400;
}

.explanation-body p {
  margin-bottom: var(--space-md);
}

.explanation-body p:last-child {
  margin-bottom: 0;
}

.explanation-body ul {
  list-style: none;
  padding: 0;
  margin: var(--space-sm) 0 var(--space-md);
}

.explanation-body li {
  padding-left: var(--space-lg);
  position: relative;
  margin-bottom: var(--space-sm);
}

.explanation-body li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-3);
  font-size: 0.8rem;
}

/* ---------- Key Point Box ---------- */
.key-point {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-md);
}

.key-point-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-3);
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-point-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---------- Bad Example Highlight ---------- */
.bad-example .chat-row.user .chat-bubble {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.bad-example .chat-row.user .chat-speaker {
  color: #f87171;
}

.bad-example .chat-row.user .chat-avatar {
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.1);
}

/* Bad example label */
.bad-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-bottom: var(--space-sm);
}

/* Good example label */
.good-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  margin-bottom: var(--space-sm);
}

/* ---------- Chat Notice Card ---------- */
/* 会話の外に配置する教育的な注意喚起カード */
.chat-notice {
  margin-top: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.7;
  position: relative;
  z-index: 10;
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  animation: chatFadeIn 0.4s ease-out both;
}

.chat-notice-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chat-notice-content {
  flex: 1;
  min-width: 0;
}

.chat-notice-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: block;
}

.chat-notice-text {
  color: var(--text-secondary);
  font-weight: 300;
}

.chat-notice-text strong {
  font-weight: 500;
}

/* Warning variant (default) */
.chat-notice.notice-warning {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-left: 3px solid rgba(245, 158, 11, 0.6);
}

.chat-notice.notice-warning .chat-notice-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.chat-notice.notice-warning .chat-notice-label {
  color: #f59e0b;
}

.chat-notice.notice-warning .chat-notice-text strong {
  color: #fbbf24;
}

/* Danger variant */
.chat-notice.notice-danger {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-left: 3px solid rgba(239, 68, 68, 0.6);
}

.chat-notice.notice-danger .chat-notice-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.chat-notice.notice-danger .chat-notice-label {
  color: #f87171;
}

.chat-notice.notice-danger .chat-notice-text strong {
  color: #fca5a5;
}

/* Info variant */
.chat-notice.notice-info {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-left: 3px solid rgba(99, 102, 241, 0.5);
}

.chat-notice.notice-info .chat-notice-icon {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-3);
}

.chat-notice.notice-info .chat-notice-label {
  color: var(--accent-3);
}

.chat-notice.notice-info .chat-notice-text strong {
  color: var(--text-primary);
}

/* ---------- Separator ---------- */
.conv-separator {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border-glass),
    transparent
  );
  margin: var(--space-xl) 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .conversation-block {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .chat-row.user {
    padding-right: 12px;
  }

  .chat-row.ai {
    padding-left: 12px;
  }

  .chat-avatar {
    width: 48px;
    height: 48px;
  }

  .chat-bubble {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.87rem;
  }

  .chat-container {
    padding: var(--space-md);
  }

  .explanation-section {
    padding: var(--space-lg);
  }
}

@media (max-width: 480px) {
  .chat-row.user,
  .chat-row.ai {
    padding-left: 0;
    padding-right: 0;
  }

  .chat-avatar {
    width: 40px;
    height: 40px;
  }

  .chat-bubble {
    padding: var(--space-sm);
  }
}
