/* ===== Coach layout ===== */

.coach-content {
    height: calc(100vh - 98px);
    /* 58px global topbar + ~40px for any in-page chrome. Kept tight since the
       global shell is now thin (see .app-header in style.css). */
    overflow: hidden;
}

.coach-layout {
    display: flex;
    height: 100%;
}

/* Anonymous mode: no sidebar, main fills the width. The .coach-main
   flex child already grows; this class is a hook for any future
   anon-specific overrides (e.g. upsell card above the chat). */
.coach-layout-anon .coach-main {
    width: 100%;
}

.coach-login-hint {
    color: var(--primary-color, #00d4ff);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.coach-login-hint:hover { color: #fff; }

/* ===== Sidebar ===== */

.coach-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--border, #3a3f47);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.coach-new-btn {
    width: 100%;
    padding: 8px;
    font-size: 0.85rem;
}

.coach-session-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.coach-session-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary, #b0bec5);
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.coach-session-item:hover {
    background: var(--surface-hover, #2a2f36);
}
.coach-session-item.active {
    background: rgba(79,195,247,0.1);
    color: var(--accent, #4fc3f7);
}

.coach-no-sessions {
    font-size: 0.78rem;
    color: var(--text-secondary, #b0bec5);
    text-align: center;
    padding: 16px 0;
}

/* ===== Main chat area ===== */

.coach-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Pre-conversation state: center the welcome card + input mid-screen rather
   than letting the empty messages pane push the input to the bottom. Once the
   first message is appended, _appendMessage() removes .coach-welcome and the
   layout falls back to the chat-style grow-from-bottom behavior. */
.coach-main:has(.coach-welcome) {
    justify-content: center;
}
.coach-main:has(.coach-welcome) .coach-messages {
    flex: 0 0 auto;
    overflow: visible;
}
.coach-main:has(.coach-welcome) .coach-input-area {
    border-top: none;
}

/* Constrain the content column to a readable width and center it — on wide
   displays the full-width chat felt sparse, especially in anonymous mode
   where there is no sidebar to eat space on the left. */
.coach-messages,
.coach-input-area {
    width: 100%;
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

.coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Welcome screen ===== */

.coach-welcome {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary, #b0bec5);
}
.coach-welcome h3 {
    font-size: 1.5rem;
    color: var(--text-primary, #e0e0e0);
    margin: 0 0 8px;
}
.coach-welcome p {
    margin: 0 0 20px;
    font-size: 0.9rem;
}

.coach-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}
.coach-suggest {
    padding: 8px 14px;
    border: 1px solid var(--border, #3a3f47);
    border-radius: 20px;
    background: transparent;
    color: var(--text-primary, #e0e0e0);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.coach-suggest:hover {
    background: var(--surface-hover, #2a2f36);
    border-color: var(--accent, #4fc3f7);
}

/* ===== Messages ===== */

.coach-msg {
    max-width: 700px;
    padding: 10px 14px;
    border-radius: 10px;
}

.coach-msg-user {
    align-self: flex-end;
    background: rgba(79,195,247,0.12);
    border: 1px solid rgba(79,195,247,0.2);
}

.coach-msg-assistant {
    align-self: flex-start;
    background: var(--surface, #1e2228);
    border: 1px solid var(--border, #3a3f47);
}

.coach-msg-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary, #b0bec5);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.coach-msg-content {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-primary, #e0e0e0);
}
.coach-msg-content code {
    background: rgba(255,255,255,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.82rem;
}
.coach-msg-content pre {
    background: rgba(0,0,0,0.3);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}
.coach-msg-content pre code {
    background: none;
    padding: 0;
}
.coach-msg-content h3, .coach-msg-content h4 {
    margin: 8px 0 4px;
    color: var(--accent, #4fc3f7);
}
.coach-msg-content ul {
    margin: 4px 0;
    padding-left: 20px;
}
.coach-msg-content strong {
    color: #fff;
}

/* Streaming cursor */
.coach-streaming::after {
    content: '|';
    animation: blink 0.7s infinite;
    color: var(--accent, #4fc3f7);
}
@keyframes blink {
    50% { opacity: 0; }
}

/* ===== Input area ===== */

.coach-input-area {
    padding: 12px 24px;
    border-top: 1px solid var(--border, #3a3f47);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.coach-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border, #3a3f47);
    border-radius: 8px;
    background: var(--surface-alt, #262b33);
    color: var(--text-primary, #e0e0e0);
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    min-height: 42px;
    max-height: 150px;
}
.coach-input:focus {
    border-color: var(--accent, #4fc3f7);
}

.coach-send-btn {
    padding: 10px 20px;
    flex-shrink: 0;
}
.coach-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Responsive ===== */

@media (max-width: 700px) {
    .coach-sidebar { display: none; }
    .coach-messages { padding: 12px; }
    .coach-input-area { padding: 8px 12px; }
}
