/* Felix AI Chatbot v4.0.0 */

#felix-wrap * { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* ── Toggle Button ── */
#felix-btn {
    position: fixed; bottom: 24px; right: 24px;
    width: 58px; height: 58px; border-radius: 50%;
    background: #1a5fa8; border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    display: flex; align-items: center; justify-content: center;
    z-index: 2147483647; transition: transform .2s, box-shadow .2s; padding: 0;
    color: white;
}
#felix-btn:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0,0,0,.32); }
#felix-btn svg { width: 26px; height: 26px; display: block; }

/* ── Chat Window ── */
#felix-box {
    position: fixed; bottom: 92px; right: 24px;
    width: 380px; height: 560px; max-height: calc(100vh - 110px);
    background: #fff; border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    flex-direction: column; z-index: 2147483646; overflow: hidden;
    animation: felixUp .25s ease-out;
}
@keyframes felixUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }

/* ── Header ── */
#felix-head {
    background: #1a5fa8; color: #fff;
    padding: 14px 16px; display: flex;
    align-items: center; justify-content: space-between; flex-shrink: 0;
}
#felix-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0;
}
#felix-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
#felix-status { font-size: 11px; opacity: .85; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.felix-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; animation: felixPulse 2s infinite; }
@keyframes felixPulse { 0%,100%{opacity:1} 50%{opacity:.4} }
#felix-close {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; line-height: 1; padding: 0; transition: background .15s;
}
#felix-close:hover { background: rgba(255,255,255,.3); }

/* ── Messages ── */
#felix-msgs {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
    background: #f7f8fa; scroll-behavior: smooth;
}
#felix-msgs::-webkit-scrollbar { width: 4px; }
#felix-msgs::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.fmsg { display: flex; gap: 8px; max-width: 88%; animation: felixIn .18s ease-out; }
@keyframes felixIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
.fbot { align-self: flex-start; }
.fusr { align-self: flex-end; flex-direction: row-reverse; }

.fmsg-av {
    width: 26px; height: 26px; border-radius: 50%;
    background: #1a5fa8; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.fmsg-bbl {
    padding: 9px 13px; border-radius: 16px;
    font-size: 14px; line-height: 1.55; word-break: break-word; max-width: 100%;
}
.fbot .fmsg-bbl { background: #fff; color: #222; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.fusr .fmsg-bbl { background: #1a5fa8; color: #fff; border-bottom-right-radius: 4px; }

.fmsg-bbl p { margin: 0 0 6px; }
.fmsg-bbl p:last-child { margin: 0; }
.fmsg-bbl ul, .fmsg-bbl ol { margin: 4px 0 4px 18px; padding: 0; }
.fmsg-bbl li { margin-bottom: 3px; }
.fmsg-bbl strong { font-weight: 700; }
.fmsg-bbl em { font-style: italic; }
.fmsg-bbl a { color: #1a5fa8; text-decoration: underline; }
.fmsg-bbl code { background: #f1f3f4; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* Typing indicator */
.ftyping { display: flex; gap: 4px; padding: 9px 13px; background: #fff; border-radius: 16px; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ftyping span { width: 7px; height: 7px; border-radius: 50%; background: #bbb; animation: felixBounce 1.2s infinite; }
.ftyping span:nth-child(2) { animation-delay: .2s; }
.ftyping span:nth-child(3) { animation-delay: .4s; }
@keyframes felixBounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-7px);opacity:1} }

/* ── Quick Action Chips ── */
#felix-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px 12px 6px;
    background: #f7f8fa;
    flex-shrink: 0;
}
.fchip {
    background: #fff; border: 1.5px solid #1a5fa8;
    color: #1a5fa8; border-radius: 20px;
    padding: 7px 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; text-align: center;
    white-space: normal; line-height: 1.3;
    transition: all .15s; font-family: inherit;
}
.fchip:hover { background: #e8f4fd; }

/* ── Input ── */
#felix-inp-area {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 12px; border-top: 1px solid #eee;
    background: #fff; flex-shrink: 0;
}
#felix-inp {
    flex: 1; border: 1.5px solid #ddd; border-radius: 20px;
    padding: 9px 14px; font-size: 14px; resize: none; outline: none;
    max-height: 90px; overflow-y: auto; line-height: 1.4;
    background: #f9f9f9; color: #222; font-family: inherit;
    transition: border-color .2s;
}
#felix-inp::placeholder { color: #aaa; }
#felix-send {
    width: 40px; height: 40px; border-radius: 50%;
    background: #1a5fa8; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: transform .15s; padding: 0; color: white;
}
#felix-send:hover { transform: scale(1.06); }
#felix-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Footer ── */
#felix-foot {
    text-align: center; font-size: 10px; color: #bbb;
    padding: 4px 10px 8px; background: #fff; flex-shrink: 0;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    #felix-btn { bottom: 16px; right: 16px; width: 52px; height: 52px; }
    #felix-box {
        width: calc(100vw - 20px) !important;
        right: 10px !important; left: 10px !important;
        bottom: 76px !important;
        height: auto !important;
        max-height: 65vh !important;
        min-height: 320px !important;
    }
    .fchip { font-size: 11px !important; padding: 7px 5px !important; }
    #felix-msgs { padding: 10px !important; }
    #felix-inp-area { padding: 8px 10px !important; }
}
