/* Chat header */
.chat-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  z-index: 10;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.btn-back:hover {
  background: var(--color-surface-raised);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.btn-header-action {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-header-action:hover {
  background: var(--color-surface-raised);
  color: var(--color-text);
}
.btn-header-action.active {
  background: var(--color-primary);
  color: white;
}

/* Pause overlay */
.pause-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(6px);
  z-index: 50;
  align-items: center;
  justify-content: center;
}
.pause-overlay.active {
  display: flex;
}
.pause-content {
  text-align: center;
  color: var(--color-text);
  padding: var(--space-xl);
}
.pause-content svg {
  color: var(--color-primary);
  margin-bottom: var(--space-md);
}
.pause-content h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-sm);
}
.pause-content p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-base);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  justify-content: center;
}

.chat-logo {
  height: 32px;
  width: auto;
}

.chat-scenario-name {
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--font-size-base);
}

.chat-difficulty-badge {
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-difficulty-badge.rookie {
  background: #58a6ff;
  color: white;
}
.chat-difficulty-badge.beginner {
  background: var(--color-beginner);
  color: white;
}
.chat-difficulty-badge.intermediate {
  background: var(--color-intermediate);
  color: white;
}
.chat-difficulty-badge.advanced {
  background: var(--color-advanced);
  color: white;
}
.chat-difficulty-badge.expert {
  background: #bc4dff;
  color: white;
}

/* Tips panel */
.tips-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: right var(--transition-base);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.tips-panel.open {
  right: 0;
}

.tips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.tips-header h3 {
  font-size: var(--font-size-lg);
  color: var(--color-primary);
}

.tips-close {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  padding: var(--space-xs);
}

.tips-content {
  padding: var(--space-lg);
}

.tips-content h4 {
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
  margin-top: var(--space-lg);
}

.tips-content h4:first-child {
  margin-top: 0;
}

.tips-content li {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
  padding-left: var(--space-md);
  position: relative;
}

.tips-content li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--color-bg);
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: messageIn 0.3s ease;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-sender {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: 2px;
  padding: 0 var(--space-sm);
}

.message-bubble {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: var(--font-size-base);
  word-wrap: break-word;
}

.message.user .message-bubble {
  background: var(--color-user-bubble);
  color: var(--color-user-text);
  border-bottom-right-radius: var(--radius-sm);
}

.message.assistant .message-bubble {
  background: var(--color-ai-bubble);
  color: var(--color-ai-text);
  border-bottom-left-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.message.assistant .message-bubble.speaking {
  box-shadow: 0 0 0 2px var(--color-primary), 0 0 15px rgba(0, 188, 212, 0.2);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-md) var(--space-lg);
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--color-text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* Input area */
.chat-input-area {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-md) var(--space-lg);
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
}

.chat-input {
  flex: 1;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-base);
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--transition-fast);
  line-height: 1.5;
  background: var(--color-surface-raised);
  color: var(--color-text);
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(0, 188, 212, 0.2);
}

.chat-input::placeholder {
  color: var(--color-text-muted);
}

.btn-mic, .btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-mic {
  background: var(--color-surface-raised);
  color: var(--color-text-secondary);
  border: 2px solid var(--color-border);
}
.btn-mic:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-mic.listening {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
  animation: pulse 1.5s infinite;
}

.btn-send {
  background: var(--color-accent);
  color: white;
}
.btn-send:hover:not(:disabled) {
  background: var(--color-accent-dark);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(245, 146, 30, 0.3);
}
.btn-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-sm);
  padding: 0 var(--space-sm);
}

.voice-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}

.voice-toggle input {
  accent-color: var(--color-primary);
}

.speech-status {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .message { max-width: 90%; }
  .tips-panel { width: 100%; right: -100%; }
  .chat-header-info { flex-direction: column; gap: 2px; }
}
