﻿/* CHAT PANEL */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 360px;
    height: 520px;
    background: rgba(255,255,255,0.10);
    backdrop-filter: blur(18px) saturate(180%);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 6000;
    border: 1px solid rgba(255,255,255,0.18);
}

/* HEADER */
.chat-header {
    padding: 14px 18px;
    font-weight: 600;
    background: rgba(255,255,255,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}

.chat-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
}

/* MESSAGES AREA */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* USER MESSAGE */
.chat-msg.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
    white-space: pre-wrap;
}

/* AI MESSAGE */
.chat-msg.ai {
    align-self: flex-start;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 16px 16px 16px 4px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

    /* Markdown inside AI bubble */
    .chat-msg.ai p,
    .chat-msg.ai ul,
    .chat-msg.ai li {
        margin: 6px 0;
    }

    .chat-msg.ai ul {
        padding-left: 18px;
    }

/* INPUT ROW */
.chat-input-row {
    display: flex;
    padding: 12px;
    gap: 8px;
    background: rgba(255,255,255,0.12);
    border-top: 1px solid rgba(255,255,255,0.18);
}

    .chat-input-row input {
        flex: 1;
        padding: 10px 14px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: var(--surface);
        color: var(--text);
    }

    .chat-input-row button {
        background: var(--primary);
        border: none;
        color: white;
        padding: 10px 14px;
        border-radius: var(--radius);
        cursor: pointer;
    }

/* FLOATING TOGGLE BUTTON */
.chat-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 1.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 5000;
}

/* AI daily-allowance indicator in the chat header */
.chat-credits {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    color: #fff;
    margin-left: auto;
    margin-right: 8px;
    white-space: nowrap;
}
.chat-credits:empty { display: none; }
.chat-credits.low { background: #f59e0b; color: #fff; }
.chat-credits.out { background: #ef4444; color: #fff; }
