/* Coach Chat — mobile-first dark theme */
body { overflow: hidden; }

.coach-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.coach-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn {
  color: var(--slate-light);
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
  text-decoration: none;
}
.back-btn:hover { background: var(--surface-2); }
.coach-avatar-header { display: flex; align-items: center; }
.avatar-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(0,229,160,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-slow 3s ease-in-out infinite;
}
.avatar-core {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #0B0F1A;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
}
.coach-info { flex: 1; }
.coach-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.coach-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--green);
  margin-top: 2px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes pulse-slow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,229,160,0.3); }
  50% { box-shadow: 0 0 0 6px rgba(0,229,160,0); }
}

/* Chat area */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scroll-behavior: smooth;
}
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Welcome block */
.welcome-block {
  text-align: center;
  padding: 32px 16px 24px;
}
.welcome-orb {
  width: 64px;
  height: 64px;
  position: relative;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-ring-1, .orb-ring-2, .orb-ring-3 {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,229,160,0.15);
  animation: pulse-coach 3s ease-in-out infinite;
}
.orb-ring-1 { width: 64px; height: 64px; }
.orb-ring-2 { width: 48px; height: 48px; border-color: rgba(0,229,160,0.3); animation-delay: 0.5s; }
.orb-ring-3 { width: 32px; height: 32px; border-color: rgba(0,229,160,0.5); animation-delay: 1s; }
.orb-core-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #0B0F1A;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  position: relative;
  z-index: 1;
}
@keyframes pulse-coach {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.5; }
}
.welcome-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: 1.5px;
  color: var(--text);
  margin-bottom: 10px;
}
.welcome-sub {
  font-size: 13px;
  color: var(--slate-light);
  line-height: 1.65;
  max-width: 320px;
  margin: 0 auto;
}

/* Messages */
#messages { display: flex; flex-direction: column; gap: 14px; }

.msg { display: flex; gap: 10px; animation: fade-up 0.3s ease forwards; }
.msg.user { flex-direction: row-reverse; }
.msg-bubble {
  max-width: 80%;
  padding: 11px 15px;
  border-radius: var(--rounded);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.msg.user .msg-bubble {
  background: var(--green);
  color: #0B0F1A;
  border-bottom-right-radius: 4px;
}
.msg.coach .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.coach .msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green);
  color: #0B0F1A;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg.user .msg-avatar { display: none; }

/* Workout card in coach message */
.workout-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rounded-sm);
  padding: 16px;
  margin-top: 10px;
}
.workout-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--green);
  margin-bottom: 12px;
}
.workout-exercises { display: flex; flex-direction: column; gap: 6px; }
.workout-exercise {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--rounded-sm);
}
.ex-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid rgba(0,229,160,0.3);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ex-details { flex: 1; }
.ex-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ex-meta { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.ex-sets-badge {
  font-size: 10px;
  color: var(--green);
  font-weight: 600;
  background: var(--green-dim);
  padding: 3px 8px;
  border-radius: 20px;
}
.workout-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.workout-tag {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}
.tag-time { background: rgba(0,229,160,0.12); color: var(--green); }
.tag-level { background: rgba(143,163,190,0.12); color: var(--slate-light); }
.tag-focus { background: rgba(26,37,55,0.8); color: var(--text-dim); border: 1px solid var(--border); }

/* Action buttons in coach reply */
.coach-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.coach-action-btn {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
}
.coach-action-btn:active { transform: scale(0.96); }
.coach-action-btn.primary {
  background: var(--green);
  color: #0B0F1A;
}
.coach-action-btn.secondary {
  background: var(--surface-2);
  color: var(--slate-light);
  border: 1px solid var(--border);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 4px;
  animation: fade-up 0.25s ease;
}
.avatar-ring-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(0,229,160,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-slow 3s ease-in-out infinite;
}
.avatar-core-sm {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green);
  color: #0B0F1A;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
}
.dots { display: flex; gap: 4px; align-items: center; }
.dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: dot-bounce 1.4s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Input bar */
.input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px 8px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.input-bar textarea {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rounded);
  padding: 12px 14px;
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color 0.2s;
}
.input-bar textarea:focus {
  outline: none;
  border-color: rgba(0,229,160,0.5);
}
.input-bar textarea::placeholder { color: var(--text-dim); }
.send-btn {
  width: 44px;
  height: 44px;
  background: var(--green);
  color: #0B0F1A;
  border: none;
  border-radius: var(--rounded);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}
.send-btn:hover { opacity: 0.85; }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Suggestions */
.suggestions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 16px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.suggestions::-webkit-scrollbar { display: none; }
.suggestion-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--slate-light);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-family: 'DM Sans', system-ui, sans-serif;
}
.suggestion-chip:hover {
  border-color: rgba(0,229,160,0.4);
  color: var(--green);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .coach-page { max-width: 100%; }
  .msg-bubble { max-width: 88%; }
  .welcome-block { padding: 24px 12px 20px; }
  .welcome-title { font-size: 22px; }
}

/* Scroll to bottom helper */
#chatArea { scroll-behavior: smooth; }