/* ---------------------------------------------------------------------------
 * AI support chat widget (templates/header.php + assets/js/support-chat.js).
 * Loaded on every page. Uses the shared theme variables from style-v2.css,
 * so it follows light / dark / auto automatically.
 * ------------------------------------------------------------------------- */

.support-chat {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 50;
}

.support-chat-bubble {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    padding: 0;
    color: var(--color-primary-fg);
    background: var(--color-primary);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: transform .15s ease;
}
.support-chat-bubble:hover { transform: scale(1.06); }
.support-chat-bubble:focus-visible { outline: 2px solid var(--color-fg); outline-offset: 3px; }

.support-chat-panel {
    position: absolute;
    right: 0;
    bottom: 66px;
    display: flex;
    flex-direction: column;
    width: min(340px, calc(100vw - 32px));
    height: min(460px, calc(100vh - 120px));
    color: var(--color-fg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .3);
    overflow: hidden;
}
.support-chat-panel[hidden] { display: none; }

.support-chat-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    font-weight: 600;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.support-chat-header > span:first-child { flex: 1; }
.support-chat-header .muted { font-weight: 400; font-size: .85em; color: var(--color-muted); }

.support-chat-switch,
.support-chat-close,
.support-chat-enlarge {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 14px;
    text-decoration: none;
    color: var(--color-fg);
    background: none;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}
.support-chat-switch:hover,
.support-chat-close:hover,
.support-chat-enlarge:hover { background: var(--color-hover); }
.support-chat-enlarge[hidden] { display: none; }

.support-chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
}

.support-chat-msg {
    max-width: 85%;
    padding: 8px 11px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
    border-radius: 12px;
}
.support-chat-msg--bot {
    align-self: flex-start;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}
.support-chat-msg--me {
    align-self: flex-end;
    color: var(--color-primary-fg);
    background: var(--color-primary);
    border-bottom-right-radius: 4px;
}

.support-chat-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.support-chat-mode-btn {
    padding: 6px 12px;
    font: inherit;
    font-size: 13px;
    color: var(--color-primary);
    background: var(--color-bg);
    border: 1px solid var(--color-primary);
    border-radius: 999px;
    cursor: pointer;
}
.support-chat-mode-btn:hover { color: var(--color-primary-fg); background: var(--color-primary); }

.support-chat-form {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--color-border);
}
.support-chat-form input {
    flex: 1;
    min-width: 0;
    padding: .45rem .6rem;
    font: inherit;
    color: var(--color-fg);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius, 8px);
}

/* Homepage: pink bubble with glow, as in the design */
body.page-home .support-chat { bottom: 46px; }
body.page-home .support-chat-bubble {
    color: #fff;
    background: #e8789f;
    box-shadow: 0 6px 16px rgba(227, 107, 149, .4);
}
:root[data-theme="dark"] body.page-home .support-chat-bubble {
    color: #2b1a22;
    background: #f7a0c0;
    box-shadow: 0 0 18px rgba(255, 111, 163, .5), 0 6px 14px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] body.page-home .support-chat-bubble {
        color: #2b1a22;
        background: #f7a0c0;
        box-shadow: 0 0 18px rgba(255, 111, 163, .5), 0 6px 14px rgba(0, 0, 0, .3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat-bubble { transition: none; }
}
