/* The conversation and message box shared by the client app and the coach workspace. */
.chat-thread { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.chat-empty { margin: auto; text-align: center; max-width: 300px; color: var(--muted); font-size: 13px; }
.chat-day { align-self: center; margin: 6px 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 16px; display: grid; gap: 4px; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.bubble a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--lime); color: var(--lime-ink); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; background: var(--card-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble-name { font-size: 11px; font-weight: 700; color: var(--accent); }
.bubble-time { justify-self: end; font-size: 10px; opacity: .65; }
.bubble.kind-image, .bubble.kind-gif { padding: 4px; }
.bubble.kind-image .bubble-time, .bubble.kind-gif .bubble-time, .bubble.kind-image .bubble-name { padding: 0 6px 2px; }
.chat-image, .chat-gif { display: block; max-width: 240px; max-height: 300px; width: 100%; object-fit: cover; border-radius: 12px; }
.chat-file { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.chat-file > span:last-child { display: grid; }
.chat-file-icon { display: grid; place-items: center; width: 40px; height: 48px; border-radius: 6px; background: rgba(220, 60, 50, .85); color: #fff; font: 700 10px Inter, sans-serif; flex: none; }
.chat-memo { display: flex; align-items: center; gap: 8px; }
.memo-length { font-size: 12px; opacity: .8; }
.memo-note { font-size: 12px; opacity: .75; }
.memo-transcript summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.memo-transcript p, .memo-text { margin-top: 4px; font-size: 14px; }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer[hidden] { display: none; }
.composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; resize: none; }
.composer-tool { display: grid; place-items: center; width: 40px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text-2); cursor: pointer; }
.composer-tool:hover { color: var(--text); border-color: var(--line-strong); }
.composer-tool.gif { font: 800 11px Inter, sans-serif; }
.composer-send { flex: none; min-height: 44px; }
.composer-extra { margin-top: 8px; }
.recording { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #ef4444; animation: rec-pulse 1s infinite; }
@keyframes rec-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.recording .button { margin-left: auto; }
.recording .button + .button { margin-left: 0; }
.gif-panel { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.gif-panel input { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
/* GIF results: fixed-size tiles that scroll, each GIF kept inside its own tile. */
.gif-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 104px; align-content: start; gap: 6px; max-height: 330px; overflow-y: auto; }
.gif-option { position: relative; display: block; width: 100%; height: 100%; min-height: 0; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--card-2); }
.gif-option:hover, .gif-option:focus-visible { border-color: var(--accent); outline: none; }
.gif-option img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-credit { justify-self: end; }
.chat-thread, .composer, .composer-extra { min-width: 0; max-width: 100%; }
.bubble { min-width: 0; }
.bubble.kind-voice { width: min(82%, 300px); }
.chat-memo { min-width: 0; }

/* Voice memo player (uses the saved memo length, so the bar keeps time). */
.memo-player { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; width: 100%; min-width: 200px; }
.memo-player audio { display: none; }
.memo-play { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--memo-fill, var(--accent)); color: var(--memo-icon, var(--bg, #000)); cursor: pointer; }
.memo-play svg { width: 16px; height: 16px; }
.memo-bar { flex: 1; min-width: 60px; height: 6px; margin: 0; border-radius: 999px; appearance: none; -webkit-appearance: none; background: linear-gradient(to right, var(--memo-fill, var(--accent)) var(--pos, 0%), var(--memo-track, var(--line-strong)) var(--pos, 0%)); cursor: pointer; }
.memo-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--memo-fill, var(--accent)); border: 0; }
.memo-bar::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--memo-fill, var(--accent)); border: 0; }
.memo-time { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; opacity: .85; }
.recording .memo-player { flex-basis: 100%; }
.bubble.mine .memo-player { --memo-fill: #11150d; --memo-icon: var(--accent); --memo-track: rgba(0, 0, 0, .22); }
/* Coach only: "Seen" / "Not seen yet" under the latest coach message. */
.bubble-seen { align-self: flex-end; margin: -4px 4px 0; font-size: 11px; opacity: .7; }
.bubble-seen.is-seen { color: var(--accent); opacity: 1; }

/* Emoji (like a phone keyboard): search, the groups, and tabs to jump between them. */
.emoji-panel { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 8px; }
.emoji-search { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.emoji-list { height: 240px; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.emoji-heading { position: sticky; top: 0; margin: 0; padding: 6px 2px 4px; background: var(--card); color: var(--text-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; z-index: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.emoji-cell { height: 40px; border: 0; border-radius: 8px; background: none; font-size: 26px; line-height: 1; cursor: pointer; padding: 0; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--line); }
.emoji-tabs { display: flex; justify-content: space-between; gap: 2px; border-top: 1px solid var(--line); padding-top: 6px; overflow-x: auto; }
.emoji-tab { flex: 1; min-width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; font-size: 18px; cursor: pointer; filter: grayscale(.6); }
.emoji-tab:hover { background: var(--line); filter: none; }
.composer-tool[aria-expanded="true"] { color: var(--text); border-color: var(--line-strong); }
/* Phones have the emoji keyboard, so the button is left off to keep room for typing. */
@media (max-width: 600px) and (pointer: coarse) { .composer-tool[data-emoji-toggle] { display: none; } }
