/* ==========================================================================
   Vitalum Chatbot — front-end styles.
   Ported 1:1 from public_html/assets/js/chatbot.js inline CSS.
   Colors driven by --vc-accent / --vc-accent-alt CSS variables, set inline
   by the loader from the admin's chosen colors.
   ========================================================================== */

:root {
    --vc-accent: #2b56f5;
    --vc-accent-alt: #46bdf4;
    --vc-accent-soft: linear-gradient(140deg, rgba(70,189,244,.18), rgba(43,86,245,.18));
    --vc-bg: #0d0f12;
    --vc-surface: #161a1f;
    --vc-surface-alt: #1d2229;
    --vc-border: #262d32;
    --vc-border-strong: #37414c;
    --vc-text: #f5f7fa;
    --vc-text-dim: #9aa6b4;
    --vc-radius: 22px;
    --vc-gradient: linear-gradient(100deg, var(--vc-accent-alt) 0%, var(--vc-accent) 100%);
    --vc-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Roboto, Ubuntu, Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

/* -- Toggle button (floating) --------------------------------------
 * Position (top/right/bottom/left) is set by the loader's inline style
 * based on the admin's "Placement & Layout" settings. */
#vitalum-chat-toggle {
    position: fixed; z-index: 9999;
    font-family: var(--vc-font);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#vitalum-chat-toggle button {
    background: rgba(22,27,33,.88);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(255,255,255,.08);
    color: #ffffff;
    min-width: 118px; height: 54px; padding: 0 26px;
    border-radius: 40px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600; letter-spacing: .4px;
    position: relative; overflow: hidden; line-height: 1;
    transition: box-shadow .45s, transform .28s, border-color .45s, background .6s, color .4s;
}
#vitalum-chat-toggle button:before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.22), rgba(255,255,255,0) 68%);
    mix-blend-mode: screen; opacity: .5; transition: opacity .6s;
}
#vitalum-chat-toggle button:hover {
    box-shadow: 0 0 0 3px rgba(43,86,245,.28), 0 10px 30px -10px rgba(0,0,0,.85);
    border-color: rgba(255,255,255,.18);
    background: linear-gradient(120deg, rgba(43,86,245,.18), rgba(22,161,255,.18));
    color: #fff;
}
#vitalum-chat-toggle button:hover:before { opacity: .9; }
#vitalum-chat-toggle button:active { transform: scale(.9); }
#vitalum-chat-toggle .vc-letter {
    z-index: 2;
    background: linear-gradient(92deg, var(--vc-accent-alt), var(--vc-accent));
    -webkit-background-clip: text; color: transparent;
    text-shadow: 0 2px 6px rgba(0,0,0,.4);
    font-size: 15px; font-weight: 600; letter-spacing: .25px;
    white-space: nowrap;
}
#vitalum-chat-toggle .vc-glow {
    position: absolute; inset: 0; border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(70,189,244,.7);
    animation: vc-breathe 5.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes vc-breathe {
    0%   { box-shadow: 0 0 0 0    rgba(70,189,244,.55); }
    55%  { box-shadow: 0 0 0 24px rgba(70,189,244,0); }
    100% { box-shadow: 0 0 0 0    rgba(70,189,244,0); }
}

/* -- Widget panel --------------------------------------------------
 * Position + width set by loader's inline style. Max-width caps the
 * admin-chosen width to 92vw on narrow screens. */
#vitalum-chat-widget {
    position: fixed; z-index: 9999;
    max-width: 92vw;
    font-family: var(--vc-font);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#vitalum-chat-widget .vc-panel {
    background: linear-gradient(180deg, #111418, #0d0f12 90%);
    border: 1px solid var(--vc-border);
    border-radius: var(--vc-radius);
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 18px 56px -18px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.03);
    max-height: 70vh;
}

.vc-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: var(--vc-accent-soft), linear-gradient(#161a1f, #161a1f);
    border-bottom: 1px solid var(--vc-border);
    box-shadow: 0 4px 18px -8px rgba(0,0,0,.55);
}
.vc-brand { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: #fff; font-weight: 600; }
.vc-brand .vc-avatar {
    width: 40px; height: 40px; border-radius: 12px;
    background: rgba(255,255,255,0);
    display: flex; align-items: center; justify-content: center;
    padding: 2px;
}
.vc-brand .vc-avatar img {
    width: 100%; height: 100%; object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
    border-radius: 10px;
}
.vc-close {
    background: rgba(255,255,255,.08); border: 0;
    width: 36px; height: 36px; border-radius: 12px;
    color: var(--vc-text); font-size: 1.05rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .35s, color .35s;
}
.vc-close:hover { background: rgba(255,255,255,.16); color: #fff; }

/* -- Body / thread ------------------------------------------------- */
.vc-body {
    flex: 1; display: flex; flex-direction: column;
    padding: 18px 20px 14px; overflow-y: auto; gap: 18px;
    scroll-behavior: smooth;
    background: radial-gradient(circle at 22% 18%, rgba(70,189,244,.06), rgba(70,189,244,0) 58%);
}
.vc-body::-webkit-scrollbar { width: 10px; }
.vc-body::-webkit-scrollbar-track { background: transparent; }
.vc-body::-webkit-scrollbar-thumb { background: #183454; border-radius: 8px; }
.vc-body::-webkit-scrollbar-thumb:hover { background: #21456d; }

.vc-thread { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.vc-thread.user { flex-direction: row-reverse; }
.vc-thread .vc-msg-avatar { display: none !important; }

.vc-bubble {
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
    color: var(--vc-text);
    padding: 10px 16px 11px; border-radius: 18px;
    line-height: 1.6; font-size: .9rem; letter-spacing: .15px; font-weight: 470;
    max-width: 80%; position: relative;
    box-shadow: 0 4px 16px -10px rgba(0,0,0,.65);
    border: 1px solid rgba(255,255,255,.07);
    min-height: 44px; min-width: 140px;
    backdrop-filter: blur(2px);
}
.vc-bubble.typing { min-width: 180px; min-height: 54px; }
.vc-thread.user .vc-bubble {
    background: linear-gradient(145deg, #2442c9 0%, var(--vc-accent) 55%, #3f8ff8 100%);
    color: #fff;
    border: 1px solid rgba(80,150,255,.35);
    box-shadow: 0 6px 20px -10px rgba(43,86,245,.55);
    font-weight: 520;
}
.vc-bubble a { color: #7cc6ff; text-decoration: underline; pointer-events: auto; }
.vc-bubble a:hover { color: #b6e1ff; }

/* Typing indicator */
.vc-bubble.typing {
    display: inline-flex; gap: 7px; align-items: center;
    padding: 10px 15px;
}
.vc-bubble.typing span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--vc-accent); opacity: .45;
    animation: vcDot 1.2s ease-in-out infinite;
}
.vc-thread.user .vc-bubble.typing span { background: #fff; }
.vc-bubble.typing span:nth-child(2) { animation-delay: .25s; }
.vc-bubble.typing span:nth-child(3) { animation-delay: .5s; }
@keyframes vcDot {
    0%, 100% { transform: translateY(0);    opacity: .4; }
    50%      { transform: translateY(-6px); opacity: 1; }
}

/* -- Input form ----------------------------------------------------
 * align-items:flex-end keeps the send button pinned to the bottom when
 * the textarea auto-grows on user typing. */
.vc-form {
    display: flex; gap: 12px; padding: 14px 16px;
    background: #101418; border-top: 1px solid var(--vc-border);
    align-items: flex-end;
}
/* Textarea — locked to a single-row starting height. The autoGrow()
 * JS raises it only when the user types multi-line content, up to
 * max-height. `!important` beats any theme's global textarea styles. */
#vc-input {
    flex: 1 1 auto;
    box-sizing: border-box !important;
    background: #181d23 !important;
    border: 1px solid var(--vc-border) !important;
    color: var(--vc-text) !important;
    padding: 12px 16px !important;
    margin: 0 !important;
    border-radius: 16px !important;
    font-size: .85rem !important;
    resize: none !important;
    height: 46px !important;      /* one-line starting height */
    min-height: 46px !important;
    max-height: 170px !important;
    line-height: 1.55 !important;
    outline: none !important;
    overflow-y: auto !important;
    font-weight: 480 !important;
    letter-spacing: .2px !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .35s, background .4s, box-shadow .4s;
    font-family: var(--vc-font);
}
#vc-input:focus {
    border-color: var(--vc-accent-alt) !important;
    background: #1f252c !important;
    box-shadow: 0 0 0 2px rgba(70,189,244,.25) !important;
}
#vc-input::-webkit-scrollbar { width: 8px; }
#vc-input::-webkit-scrollbar-thumb { background: #2a3139; border-radius: 6px; }
#vc-input::placeholder { color: var(--vc-text-dim); opacity: .9; letter-spacing: .25px; }

.vc-send {
    position: relative;
    background-image: linear-gradient(140deg, #2346d6 0%, var(--vc-accent) 50%, var(--vc-accent-alt) 100%);
    border: 0; width: 60px; height: 46px; border-radius: 16px;
    color: #fff; font-size: 1.05rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px -10px rgba(43,86,245,.55);
    transition: filter .4s, transform .3s, box-shadow .5s, opacity .35s;
    font-weight: 600; overflow: hidden;
    flex-shrink: 0;
}
.vc-send:before {
    content: ''; position: absolute; inset: 0; opacity: 0;
    transition: opacity .55s;
    background-image: linear-gradient(140deg, #1d3bb8 0%, #244edc 40%, #3f8ff8 100%);
}
.vc-send:hover:before { opacity: 1; }
.vc-send:hover { box-shadow: 0 12px 34px -10px rgba(43,86,245,.7); }
.vc-send:active { transform: translateY(2px); }
.vc-send:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.35); box-shadow: 0 0 0 0 rgba(0,0,0,0); }

/* -- Disclaimer footer -------------------------------------------- */
.vc-disclaimer {
    font-size: .62rem; letter-spacing: .4px; text-align: center;
    padding: 6px 14px 10px; color: var(--vc-text-dim); opacity: .85; font-weight: 450;
    background: #101418; border-top: 1px solid var(--vc-border);
}

/* -- Formatting inside bubbles ------------------------------------ */
.vc-bubble strong { font-weight: 650; }
.vc-bubble em     { font-style: italic; opacity: .95; }
.vc-bubble code   {
    background: #1f252c; border: 1px solid rgba(255,255,255,.08);
    padding: 2px 6px; border-radius: 6px;
    font-size: .72rem; letter-spacing: .5px;
    font-family: ui-monospace, Consolas, monaco, monospace;
}
.vc-bubble pre {
    background: #1f252c; border: 1px solid rgba(255,255,255,.08);
    padding: 10px 12px; border-radius: 10px;
    font-size: .72rem; overflow: auto; max-height: 260px; line-height: 1.4;
}
.vc-bubble ul { margin: 6px 0 10px 18px; padding: 0; list-style: disc; }
.vc-bubble li { margin-bottom: 4px; font-size: inherit; line-height: inherit; letter-spacing: .15px; }
.vc-bubble p  { margin: 4px 0 8px; font-size: inherit; line-height: inherit; letter-spacing: .15px; }
.vc-bubble p:last-child { margin-bottom: 0; }
.vc-bubble.typing-sizing { font-size: .9rem; letter-spacing: .15px; line-height: 1.6; }

.vc-bubble .vc-more-toggle {
    display: inline-block; margin-top: 10px;
    font-size: .58rem; font-weight: 600; letter-spacing: .7px;
    text-transform: uppercase; color: #7cc6ff; cursor: pointer;
    background: rgba(255,255,255,.08); padding: 5px 8px 6px;
    border-radius: 7px; border: 1px solid rgba(255,255,255,.12);
    transition: background .35s, color .35s;
    user-select: none;
}
.vc-bubble .vc-more-toggle:hover { background: rgba(255,255,255,.16); color: #b6e1ff; }

.vc-thread.bot .vc-bubble,
.vc-thread.bot .vc-bubble p,
.vc-thread.bot .vc-bubble li,
.vc-thread.bot .vc-bubble code,
.vc-thread.bot .vc-bubble strong,
.vc-thread.bot .vc-bubble em { color: var(--vc-text); }
.vc-thread.bot .vc-bubble a  { color: #7cc6ff; }

/* -- Responsive --------------------------------------------------- */
@media (max-height: 680px) { #vitalum-chat-widget .vc-panel { max-height: 78vh; } }
@media (max-width: 600px) {
    #vitalum-chat-widget { width: 92vw !important; }
    #vitalum-chat-toggle button { min-width: 70px; height: 58px; padding: 0 20px; }
    .vc-bubble { max-width: 86%; }
}
