/* ─────────────────────────────────────────────────────────
   VoxiLearn Live Chat — styles
   ───────────────────────────────────────────────────────── */

/* Root container */
.vox-chat-root {
    font-family: inherit;
    border: 1px solid #0dcaf0;
    border-radius: 0.625rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 4px 24px rgba(13, 202, 240, 0.12);
}

/* Two-column layout */
.vox-chat-layout {
    display: flex;
    height: 620px;
    min-height: 420px;
}

/* ── Online Users Sidebar ─────────────────────────────── */
.vox-chat-sidebar {
    width: 190px;
    flex-shrink: 0;
    border-right: 1px solid rgba(13, 202, 240, 0.25);
    padding: 1rem;
    background: #f4fdff;
    overflow-y: auto;
}

.vox-chat-sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0dcaf0;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vox-online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    min-width: 8px;
    background: #198754;
    border-radius: 50%;
}

.vox-online-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.vox-online-user {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.15rem 0;
}

.vox-online-empty {
    font-size: 0.78rem;
    color: #aaa;
    font-style: italic;
    padding: 0.15rem 0;
}

/* ── Chat Main ─────────────────────────────────────────── */
.vox-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vox-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(13, 202, 240, 0.2);
    background: #f4fdff;
}

.vox-chat-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #0a7aad;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.vox-chat-subtitle {
    font-size: 0.72rem;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Message Log ───────────────────────────────────────── */
.vox-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scroll-behavior: smooth;
}

.vox-chat-loading,
.vox-chat-empty {
    color: #aaa;
    font-style: italic;
    text-align: center;
    margin: auto;
    font-size: 0.9rem;
}

/* ── Individual message bubble ─────────────────────────── */
.vox-msg {
    max-width: 75%;
    align-self: flex-start;
    animation: voxMsgIn 0.15s ease;
}

@keyframes voxMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.vox-msg--own {
    align-self: flex-end;
}

.vox-msg--ai {
    max-width: 85%;
    align-self: flex-start;
}

.vox-msg-meta {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-bottom: 0.2rem;
}

.vox-msg--own .vox-msg-meta {
    flex-direction: row-reverse;
}

.vox-msg-author {
    font-size: 0.72rem;
    font-weight: 700;
    color: #555;
}

.vox-msg--own .vox-msg-author {
    color: #0a7aad;
}

.vox-msg--ai .vox-msg-author {
    color: #6f42c1;
}

.vox-msg-time {
    font-size: 0.68rem;
    color: #bbb;
}

.vox-msg-bubble {
    background: #f0f2f5;
    border-radius: 0 0.75rem 0.75rem 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    color: #222;
}

.vox-msg--own .vox-msg-bubble {
    background: #0dcaf0;
    color: #fff;
    border-radius: 0.75rem 0 0.75rem 0.75rem;
}

.vox-msg--ai .vox-msg-bubble {
    background: #ede9ff;
    color: #3b007a;
    border-radius: 0 0.75rem 0.75rem 0.75rem;
    border-left: 3px solid #6f42c1;
}

/* ── Input Form ────────────────────────────────────────── */
.vox-chat-form {
    padding: 0.75rem 1rem 0.6rem;
    border-top: 1px solid rgba(13, 202, 240, 0.2);
    background: #fafeff;
}

.vox-ai-indicator {
    background: #ede9ff;
    color: #5a2cad;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: 0.35rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #6f42c1;
}

.vox-thinking {
    font-size: 0.8rem;
    color: #6f42c1;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.vox-thinking-dots::after {
    content: '';
    animation: voxDots 1.2s steps(3, end) infinite;
}

@keyframes voxDots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}

.vox-chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.vox-chat-input {
    flex: 1;
    resize: none;
    font-size: 0.9rem;
    min-height: 2.6rem;
    border-color: rgba(13, 202, 240, 0.4);
}

.vox-chat-input:focus {
    border-color: #0dcaf0;
    box-shadow: 0 0 0 0.2rem rgba(13, 202, 240, 0.2);
}

.vox-chat-send-btn {
    flex-shrink: 0;
    align-self: flex-end;
    padding: 0.4rem 1rem;
}

.vox-chat-hint {
    margin: 0.3rem 0 0;
    font-size: 0.72rem;
    color: #aaa;
}

.vox-chat-hint kbd {
    font-size: 0.68rem;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 0 3px;
}

.vox-chat-error {
    color: #dc3545;
    font-size: 0.8rem;
    margin: 0.35rem 0 0;
}

/* ── Login Prompt ──────────────────────────────────────── */
.vox-chat-login-prompt {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid rgba(13, 202, 240, 0.2);
    background: #fafeff;
}

/* ── AI Toggle Button ──────────────────────────────────── */
.vox-ai-toggle-btn.active,
.vox-ai-toggle-btn[aria-pressed="true"] {
    background: #0dcaf0;
    color: #fff;
    border-color: #0dcaf0;
}

/* ── Responsive: stack vertically on small screens ─────── */
@media (max-width: 600px) {
    .vox-chat-layout {
        flex-direction: column;
        height: auto;
        min-height: 520px;
    }

    .vox-chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(13, 202, 240, 0.25);
        max-height: 72px;
        padding: 0.5rem 1rem;
    }

    .vox-chat-sidebar-title {
        margin-bottom: 0.4rem;
    }

    .vox-online-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem 0.75rem;
    }

    .vox-chat-messages {
        min-height: 320px;
        max-height: 360px;
    }

    .vox-msg,
    .vox-msg--ai {
        max-width: 90%;
    }
}
