/**
 * File:          /pwa/css/chat-bubbles.css
 * Version:       0.2.2
 * Last Modified: 2026-10-24 07:01 PM ET
 * Changes:       0.2.2: .thinking-phrase. | 0.2.1: .thinking-phrase (rotating working phrase); .thinking-notice — admin-only model-backup line under the thinking dots.
 *                0.2.0: your bubble = solid pale blue + dark text, 4px tail corner
 *                bottom right; coach bubble tail bottom left (iOS MessageBubble 0.6.0).
 *                0.1.0: New — iOS MessageBubble + composer look for every chat surface
 *                (Coach, Nutrition, Journal, Finance). Assistant bubble =
 *                bg-secondary + hairline border, user bubble = accent @18%,
 *                radius 14, padding 12, 15px text, 30px avatars, 36px open
 *                space on the far side, thumbs + 11px time under the bubble.
 *                Web markdown (bold, lists, code) is kept inside the bubble.
 *                Composer: 22px radius field, round up-arrow send, [+] menu,
 *                mode pill. Coach search bar.
 */

/* ---------- Messages ---------- */
.chat-messages { padding: 8px 0 12px; }

.message {
  gap: 10px;
  padding: 7px 12px;
  align-items: flex-start;
}
.message.assistant { padding-right: 48px; }  /* 12 + Spacer(minLength: 36) */
.message.user { padding-left: 48px; }

.message-avatar,
.message .message-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  margin-top: 0;
}
.message.assistant .message-avatar {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.message.assistant .message-avatar .icon { width: 15px; height: 15px; }

.message-content {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.message.user .message-content { align-items: flex-end; text-align: left; }

.message-bubble {
  max-width: 100%;
  padding: 12px;
  border-radius: var(--radius-bubble);
  font-size: var(--fs-body);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.message.assistant .message-bubble {
  background: var(--message-assistant-bg);
  border: var(--hairline) solid var(--border-primary);
}
/* Your messages: solid pale blue + dark text; tail corner on the speaker's side */
.message.assistant .message-bubble { border-bottom-left-radius: 4px; }
.message.user .message-bubble {
  background: var(--message-user-bg);
  color: var(--message-user-text);
  border-bottom-right-radius: 4px;
}
.message.user .message-bubble a { color: var(--message-user-link); }
.message.user .message-bubble code,
.message.user .message-bubble pre { background: rgba(0, 0, 0, 0.08); color: var(--message-user-text); }

.message-bubble p { margin: 0 0 8px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 0 0 8px; padding-left: 20px; }
.message-bubble pre { margin: 8px 0; padding: 12px; }

.message-time {
  margin-top: 0;
  padding: 0 4px;
  font-size: var(--fs-caption2);
  color: var(--text-tertiary);
}
.message .msg-feedback { margin-top: 0; min-height: 22px; gap: 8px; padding-left: 2px; }
.message .msg-feedback-icon { width: 13px; height: 13px; }

/* Thinking + council bubbles share the bubble look */
.message.typing .message-content,
.message.council-status .message-content {
  flex-direction: row;
  padding: 12px;
  border-radius: var(--radius-bubble);
  background: var(--message-assistant-bg);
  border: var(--hairline) solid var(--border-primary);
}

/* Rotating "working" phrase beside the thinking dots (iOS ChatActivityIndicator) */
.message.typing .message-content { align-items: center; gap: 4px; }
.thinking-phrase {
  margin-left: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Admin-only model-backup line under the thinking dots */
.thinking-notice {
  margin: -2px 48px 6px 52px;
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* Message actions (⋯) sit on the bubble's outer corner */
.message.assistant .message-actions { right: 14px; top: 8px; }
.message.user .message-actions { left: 14px; top: 8px; }

/* ---------- Coach search ---------- */
.chat-search-bar { padding: 4px 12px 8px; max-width: 800px; width: 100%; margin: 0 auto; }
.chat-search-bar[hidden] { display: none; }
.chat-search-bar .form-input { border-radius: var(--radius-field); }
.chat-search-status { font-size: var(--fs-caption); color: var(--text-tertiary); padding: 6px 4px 0; }
.chat-search-status:empty { display: none; }

/* ---------- Composer ---------- */
.chat-input-area { padding: 8px 12px 10px; }

.chat-input-wrapper {
  min-height: 72px;
  padding: 12px 12px 10px 16px;
  background: var(--bg-secondary);
  border: var(--hairline) solid var(--border-primary);
  border-radius: var(--radius-composer);
}
.chat-input-wrapper textarea { align-self: stretch; }
.chat-input-wrapper textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.send-btn { opacity: 0.35; }
.send-btn.active,
.send-btn[aria-label="Stop response"],
.send-btn[aria-label="Send correction"] { opacity: 1; }
.send-btn .icon { stroke-width: 2.6; }

.chat-controls-row { padding: 8px 0 0; gap: 10px; flex-wrap: wrap; }

.composer-plus-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  cursor: pointer;
}
.composer-plus-btn .icon { width: 16px; height: 16px; stroke-width: 2.6; }

.composer-plus-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 4px;
  background: var(--bg-elevated);
  border: var(--hairline) solid var(--border-secondary);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.composer-plus-menu[hidden] { display: none; }
.composer-plus-item {
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.composer-plus-item:hover { background: var(--bg-hover); }
.composer-plus-item[data-audio-kind="voice"] { border-top: var(--hairline) solid var(--border-primary); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }

.chat-mode-pill {
  height: 32px;
  padding: 0 12px;
  gap: 6px;
  border: var(--hairline) solid var(--border-primary);
  color: var(--text-primary);
}
.chat-mode-menu { left: 42px; }

@media (max-width: 768px) {
  .message { padding: 7px 12px; gap: 10px; }
  .message.assistant { padding-right: 48px; }
  .message.user { padding-left: 48px; }
  .chat-input-area { padding: 8px 12px 10px; }
}

/* === END OF FILE (FILENAME: /pwa/css/chat-bubbles.css) === */
