/* ===== Coach Tab ===== */

.om-coach-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ===== Coach Header Card ===== */
.om-coach-profile {
    display: none;
}

/* Coach character overlay in chat */
.om-coach-char-overlay {
    position: absolute;
    bottom: 60px;
    left: 0;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.om-coach-char-img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    object-position: bottom left;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
    opacity: 0.85;
    border-radius: 20px;
}
.om-coach-char-name {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted, #666);
    margin-top: 2px;
    text-align: center;
}

.om-coach-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-border);
    flex-shrink: 0;
}

.om-coach-avatar-fallback {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 2px solid var(--accent-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.om-coach-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.om-coach-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.om-coach-switch-btn {
    margin-left: auto;
    padding: 0.375rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.om-coach-switch-btn:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}

/* ===== Chat Messages ===== */
.om-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    -webkit-overflow-scrolling: touch;
}

.om-chat-msg {
    display: flex;
    gap: 0.625rem;
    max-width: 88%;
}

.om-chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.om-chat-msg.coach {
    align-self: flex-start;
}

.om-chat-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 2px;
}

.om-chat-bubble {
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 100%;
}

.om-chat-msg.coach .om-chat-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.om-chat-msg.user .om-chat-bubble {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: var(--radius-sm);
}

.om-chat-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 4px;
    align-self: flex-end;
}

.om-chat-msg.user .om-chat-time {
    text-align: right;
}

/* Typing indicator */
.om-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-bottom-left-radius: var(--radius-sm);
    width: fit-content;
}

.om-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: om-typing-bounce 1.2s infinite;
}

.om-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.om-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes om-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ===== Chat Input ===== */
.om-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + var(--safe-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.om-chat-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    transition: border-color 0.15s;
}

.om-chat-input:focus {
    border-color: var(--accent-border);
}

.om-chat-input::placeholder {
    color: var(--text-muted);
}

.om-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition-fast);
    box-shadow: 0 2px 8px var(--accent-glow);
}

.om-chat-send-btn:hover {
    background: #0d9488;
    transform: scale(1.06);
}

.om-chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ===== Coach Select Sheet ===== */
.om-coach-select-sheet {
    padding: 1.25rem;
}

.om-coach-select-sheet h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.om-coach-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.om-coach-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.625rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.om-coach-option:hover,
.om-coach-option.selected {
    border-color: var(--accent-border);
    background: var(--accent-dim);
}

.om-coach-option-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.om-coach-option-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.om-coach-option-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.om-coach-option-check {
    margin-left: auto;
    font-size: 1.125rem;
    color: var(--accent);
    opacity: 0;
}

.om-coach-option.selected .om-coach-option-check {
    opacity: 1;
}

/* ===== Coach Chat Layout (coachChat.js) ===== */
.om-coach-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

.om-coach-layout > .om-coach-sidebar {
    display: none;
}

.om-coach-avatar {
    position: relative;
    width: 52px;
    height: 52px;
}

.om-coach-glow {
    display: none;
}

.om-coach-img-stack {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.om-coach-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.om-coach-face.active {
    opacity: 1;
}

.om-coach-layout .om-coach-name {
    margin-top: 0.75rem;
    text-align: center;
}

.om-coach-layout .om-coach-name h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0;
}

.om-coach-speech {
    margin-top: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: rgba(20,184,166,0.08);
    border: 1px solid rgba(20,184,166,0.2);
    border-radius: 10px;
    font-size: 0.72rem;
    color: var(--text-primary, #fff);
    max-width: 150px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.om-coach-speech.visible {
    opacity: 1;
}

/* Chat Panel */
.om-coach-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

.om-coach-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    -webkit-overflow-scrolling: touch;
}

.om-coach-greeting {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary, #888);
}

.om-coach-greeting h3 {
    margin-top: 0.75rem;
    color: var(--text-primary, #fff);
}

.om-coach-greeting p {
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

.om-coach-bubble {
    max-width: 85%;
    padding: 0.65rem 0.9rem;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.om-coach-ai {
    align-self: flex-start;
    background: var(--bg-tertiary, #1a1a2e);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    color: var(--text-primary, #fff);
    border-bottom-left-radius: 4px;
}

.om-coach-user {
    align-self: flex-end;
    background: #14b8a6;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.om-coach-typing {
    display: flex;
    gap: 4px;
    padding: 0.65rem 1rem;
    align-self: flex-start;
    background: var(--bg-tertiary, #1a1a2e);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.om-coach-typing span {
    width: 6px;
    height: 6px;
    background: var(--text-muted, #666);
    border-radius: 50%;
    animation: om-typing-bounce 1.2s infinite;
}

.om-coach-typing span:nth-child(2) { animation-delay: 0.2s; }
.om-coach-typing span:nth-child(3) { animation-delay: 0.4s; }

.om-coach-input-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    background: var(--bg-secondary, #111);
}

.om-coach-input-row .om-input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: var(--bg-tertiary, #1a1a2e);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: 20px;
    color: var(--text-primary, #fff);
    font-size: 0.9rem;
    outline: none;
}

.om-coach-input-row .om-input:focus {
    border-color: rgba(20,184,166,0.4);
}

.om-coach-input-row .om-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.om-coach-bounce {
    animation: om-coach-bounce 0.4s ease;
}

@keyframes om-coach-bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
