﻿/* ==== Chat UI — slate glass, capped input, snappy bubbles ==== */
:root {
    --slate-900: rgb(15 23 42);
    --slate-800: rgb(17 24 39);
    --slate-700: rgb(31 41 55);
    --slate-500: rgb(100 116 139);
    --slate-400: rgb(148 163 184);
    --slate-200: rgb(226 232 240);
    --blue-500: #3b82f6;
    --blue-700: #1d4ed8;
    --glass-bg: rgba(15,23,42,.75);
    --glass-edge: rgba(255,255,255,.06);
    --chip-bg: rgba(255,255,255,.05);
    --user-bg: rgba(148,163,184,.14);
    --shadow-hard: 0 24px 60px rgba(0,0,0,.45);
}

/* ===== FAB ===== */
.eve-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1060;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg,var(--blue-500),var(--blue-700));
    border: 1px solid var(--glass-edge);
}

    .eve-fab .unread-dot {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #22c55e;
        display: none;
    }

    .eve-fab svg {
        width: 26px;
        height: 26px;
    }

@keyframes eyeBlink {
    0%,92%,100% {
        transform: scaleY(1)
    }

    95% {
        transform: scaleY(.12)
    }
}

@keyframes botFloat {
    0%,100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(-2px)
    }
}

.eve-fab .bot {
    animation: botFloat 3s ease-in-out infinite;
}

.eve-fab .eye {
    animation: eyeBlink 4.5s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box
}

/* ===== Overlay ===== */
#eveChatOverlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 1059;
    display: none;
}

    #eveChatOverlay.open {
        display: block
    }

/* ===== Panel (header / body / composer) ===== */
#eveChatPanel {
    position: fixed;
    right: 16px;
    bottom: 84px;
    z-index: 10060;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 540px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--glass-bg);
    color: var(--slate-200);
    border-radius: 16px;
    border: 1px solid var(--glass-edge);
    box-shadow: var(--shadow-hard);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
    transform: translateY(12px) scale(.98);
    opacity: 0;
    pointer-events: none;
    transition: transform .18s ease, opacity .18s ease;
}

    #eveChatPanel.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

/* Desktop Max */
@media (min-width: 768px) {
    #eveChatPanel.max {
        right: 50%;
        transform: translateX(50%);
        bottom: 6vh;
        width: min(960px, 92vw);
        height: 80vh;
        border-radius: 20px;
    }
}

/* ===== Header ===== */
#eveChatHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(17,24,39,.88);
    border-bottom: 1px solid var(--glass-edge);
}

    #eveChatHeader .title {
        font-weight: 700;
        color: #fff;
        letter-spacing: -.015em
    }

    #eveChatHeader .sub {
        font-size: .8rem;
        color: #93c5fd
    }

/* ===== Body ===== */
#eveChatBody {
    overflow: auto;
    padding: 14px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

    #eveChatBody::-webkit-scrollbar {
        width: 8px
    }

    #eveChatBody::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.12);
        border-radius: 6px
    }

#eveChatBody {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

.chat-bubble {
    position: relative;
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    max-width: 82%;
    line-height: 1.55;
    word-break: break-word;
    border: 1px solid var(--glass-edge);
    will-change: transform, opacity;
}

    .chat-bubble.user {
        background: var(--user-bg);
        color: #fff;
        margin-left: auto;
        animation: bubbleUser .18s cubic-bezier(.2,.6,.2,1) both;
    }

    .chat-bubble.assistant {
        background: var(--chip-bg);
        color: var(--slate-200);
        margin-right: auto;
        animation: bubbleAI .22s cubic-bezier(.2,.6,.2,1) both;
    }

    .chat-bubble strong {
        display: block;
        font-weight: 600;
        margin-bottom: 4px;
        color: #93c5fd
    }

.assistant .thinking {
    opacity: .7;
    font-style: italic
}

@keyframes bubbleUser {
    0% {
        opacity: 0;
        transform: translateY(8px) translateX(6px) scale(.98)
    }

    100% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1)
    }
}

@keyframes bubbleAI {
    0% {
        opacity: 0;
        transform: translateY(8px) translateX(-6px) scale(.98)
    }

    100% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1)
    }
}

/* ===== Composer ===== */
#eveChatComposer {
    border-top: 1px solid var(--glass-edge);
    background: var(--glass-bg);
    padding: 10px 12px;
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.composer-main {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--glass-edge);
    border-radius: 12px;
    padding: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02), 0 1px 0 rgba(255,255,255,.03);
}

.composer-input {
    flex: 1 1 auto;
    min-height: 36px;
    max-height: min(22dvh, 240px);
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--slate-200);
    font: 500 14px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.18) transparent;
}

    .composer-input::placeholder {
        color: var(--slate-500)
    }

    .composer-input::-webkit-scrollbar {
        width: 8px
    }

    .composer-input::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.18);
        border-radius: 6px
    }

    .composer-input::-webkit-scrollbar-track {
        background: transparent
    }

.send-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 86px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    padding: 0 14px;
    background: linear-gradient(180deg,var(--blue-500),var(--blue-700));
    color: #fff;
    font-weight: 700;
    letter-spacing: .01em;
    box-shadow: 0 10px 24px rgba(29,78,216,.35);
    transition: transform .06s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
}

    .send-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(29,78,216,.45)
    }

    .send-btn:active {
        transform: translateY(0);
        filter: saturate(1.1)
    }

    .send-btn[disabled] {
        opacity: .55;
        cursor: not-allowed;
        box-shadow: none
    }

/* Suggestions INSIDE composer */
.chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    background: rgba(255,255,255,.03);
    border: 1px dashed rgba(255,255,255,.06);
    border-radius: 10px;
    max-height: 88px;
    overflow: auto;
    transition: max-height .18s ease, opacity .18s ease, transform .18s ease, padding .18s ease, border-width .18s ease;
}

    .chips-row.hide {
        opacity: 0;
        transform: translateY(-4px);
        max-height: 0;
        padding: 0 6px;
        border-width: 0;
        overflow: hidden;
    }

    .chips-row::-webkit-scrollbar {
        height: 8px
    }

    .chips-row::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,.12);
        border-radius: 6px
    }

.chips-row {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

    .chips-row .chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: .32rem .6rem;
        border-radius: 999px;
        font-size: .8rem;
        font-weight: 600;
        color: var(--slate-200);
        background: rgba(255,255,255,.04);
        border: 1px solid var(--glass-edge);
        box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
        transition: transform .06s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
    }

        .chips-row .chip:hover {
            transform: translateY(-1px);
            background: rgba(255,255,255,.07)
        }

        .chips-row .chip:active {
            transform: translateY(0)
        }

/* Mobile sheet */
@media (max-width: 576px) {
    #eveChatPanel {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 72svh;
        border-radius: 16px 16px 0 0;
    }

    .eve-fab {
        right: 12px;
        bottom: 12px;
    }

    #eveMax {
        display: none !important;
    }

    .chips-row {
        max-height: 72px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    #eveChatPanel {
        transition: none
    }

    .eve-fab .bot, .eve-fab .eye {
        animation: none
    }

    .chat-bubble.user, .chat-bubble.assistant {
        animation: none
    }
}


/* Compact ghost button that matches the glass UI */
.ideas-btn {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--glass-edge);
    border-radius: 10px;
    background: rgba(255,255,255,.04);
    color: var(--slate-200);
    box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
    transition: transform .06s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

    .ideas-btn:hover {
        transform: translateY(-1px);
        background: rgba(255,255,255,.07);
    }

    .ideas-btn.active {
        outline: 2px solid rgba(147,197,253,.35);
    }

/* Chips stay tidy when shown on demand */
.chips-row {
    margin-top: 2px;
}
/* === FAB: slate/teal glass button === */
:root {
    --eve-fab-size: 60px;
    --eve-fab-grad-a: #3b82f6; /* blue-500 */
    --eve-fab-grad-b: #1d4ed8; /* blue-700 */
    --eve-fab-teal: #5eead4; /* teal-300 */
    --eve-fab-shadow: 0 12px 28px rgba(0,0,0,.35);
}

#eveChatFab.eve-fab {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1060;
    width: var(--eve-fab-size);
    height: var(--eve-fab-size);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.14);
    background: radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.16), transparent 40%), linear-gradient(180deg, var(--eve-fab-grad-a), var(--eve-fab-grad-b));
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--eve-fab-shadow), inset 0 1px 0 rgba(255,255,255,.22);
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .18s ease, box-shadow .18s ease, background-position .18s ease;
}

/* subtle teal glow under the button */
#eveChatFab .fab-glow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(94,234,212,.35);
    filter: blur(10px);
    pointer-events: none;
    transition: box-shadow .25s ease;
}

/* faint glass ring */
#eveChatFab .fab-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
    pointer-events: none;
}

/* icon scales and floats a bit */
#eveChatFab .fab-icon {
    transform: translateY(0);
    transition: transform .18s ease;
}

/* hover / focus */
#eveChatFab:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 16px 34px rgba(0,0,0,.45);
}

    #eveChatFab:hover .fab-glow {
        box-shadow: 0 0 24px 6px rgba(94,234,212,.45);
    }

#eveChatFab:active {
    transform: translateY(0) scale(.98);
}

/* keyboard focus */
#eveChatFab:focus-visible {
    box-shadow: 0 0 0 3px rgba(59,130,246,.35), 0 0 0 8px rgba(94,234,212,.25), var(--eve-fab-shadow);
}

/* open state (when your panel is open) */
#eveChatFab[aria-expanded="true"] {
    background: radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.14), transparent 40%), linear-gradient(180deg, #22d3ee, #0ea5e9);
}

/* unread indicator (toggle display with JS by adding .has-unread to the button) */
#eveChatFab .unread-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--eve-fab-teal);
    box-shadow: 0 0 12px rgba(94,234,212,.85);
    transform: scale(0);
    transition: transform .18s ease;
}

#eveChatFab.has-unread .unread-dot {
    transform: scale(1);
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    #eveChatFab, #eveChatFab .fab-icon, #eveChatFab .fab-glow {
        transition: none !important;
    }
}

/* smaller screens: nudge in a bit */
@media (max-width: 576px) {
    #eveChatFab {
        right: 12px;
        bottom: 12px;
        --eve-fab-size: 56px;
    }
}

/* hide bootstrap’s default button visuals if present */
#eveChatFab.btn {
    background: none;
    border: none;
    padding: 0;
}

#eveChatFab .fab-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,.28);
    transform: scale(0);
    animation: fabRipple .45s ease-out forwards;
    pointer-events: none;
    filter: blur(.5px);
}

@keyframes fabRipple {
    to {
        transform: scale(1);
        opacity: 0;
    }
}
