/* ===== CHATBOT STYLES ===== */
.coach-chat {
  max-width: 700px;
  margin: 2rem auto 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  height: 560px;
  overflow: hidden;
  min-height: unset;
  padding: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}

/* Messages */
.chat-msg {
  display: flex;
  gap: 0.75rem;
  max-width: 90%;
  animation: msgIn 0.3s ease;
}

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

.chat-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--bg-dark);
  flex-shrink: 0;
}

.msg-bubble {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px 16px 16px 4px;
  padding: 1rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-on-dark);
}

.chat-msg-user .msg-bubble {
  background: var(--accent);
  color: var(--bg-dark);
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
}

.msg-bubble h2, .msg-bubble h3, .msg-bubble h4 {
  color: var(--accent);
  margin: 1rem 0 0.5rem;
  font-size: 1.05rem;
}

.msg-bubble h2:first-child, .msg-bubble h3:first-child, .msg-bubble h4:first-child {
  margin-top: 0;
}

.msg-bubble strong {
  color: var(--accent);
}

.msg-bubble ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}

.msg-bubble li {
  margin-bottom: 0.3rem;
}

.msg-bubble p {
  margin-bottom: 0.5rem;
}

.msg-bubble p:last-child {
  margin-bottom: 0;
}

/* Progress bar */
.chat-progress {
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  opacity: 0.6;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* Consent checkbox */
.chat-consent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  margin-bottom: 0.75rem;
  width: 100%;
}

.chat-consent input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Input Area */
.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: white;
  font-family: var(--font);
  font-size: 0.92rem;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.5;
}

.chat-textarea::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.chat-textarea:focus {
  border-color: var(--accent);
}

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  color: var(--bg-dark);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* Range Input */
.chat-range-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.range-display {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}

.chat-range {
  width: 100%;
  max-width: 400px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  outline: none;
}

.chat-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.chat-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.range-labels {
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  opacity: 0.5;
  color: var(--text-on-dark);
}

/* Buttons */
.chat-btn {
  border: none;
  border-radius: 100px;
  padding: 0.75rem 2rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.chat-btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}

.chat-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.chat-choice-wrapper {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}

.chat-btn-choice {
  padding: 0.6rem 1.25rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-light);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-btn-choice:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-dark);
  transform: translateY(-1px);
}

/* Thinking animation */
.thinking-dots .dots span {
  animation: blink 1.4s infinite;
  animation-fill-mode: both;
  font-size: 1.2em;
}

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

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

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Error */
.chat-error {
  color: #ff7b7b;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .coach-chat {
    height: 480px;
    margin: 1.5rem auto 0;
  }

  .chat-messages {
    padding: 1rem;
  }

  .chat-input-area {
    padding: 0.75rem 1rem;
  }

  .msg-bubble {
    font-size: 0.88rem;
    padding: 0.8rem 1rem;
  }
}
