/* ============================================================
   abi.css — Enhanced Abi Chatbot Styles
   Replaces the old abi.css completely
   ============================================================ */

/* ── Toggle button ────────────────────────────────────────── */
#abi-wrap   { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1055; }

#abi-toggle {
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, #2e3191, #d7263d);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(46,49,145,.35);
    transition: transform .25s ease, box-shadow .25s ease;
    position: relative;
}
#abi-toggle:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 10px 28px rgba(46,49,145,.4);
}

/* Keep above mobile bottom nav on small screens */
@media (max-width: 768px) {
    #abi-wrap { bottom: 5rem; right: 1rem; }
}

/* ── Unread badge ─────────────────────────────────────────── */
.abi-badge {
    position: absolute; top: -4px; right: -4px;
    background: #d7263d; color: #fff;
    width: 20px; height: 20px; border-radius: 50%;
    font-size: .65rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}
.abi-badge.d-none { display: none !important; }

/* ── Chat window ──────────────────────────────────────────── */
.abi-window {
    position: absolute; bottom: 70px; right: 0;
    width: 340px; max-height: 520px;
    background: #fff; border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    display: flex; flex-direction: column;
    overflow: hidden;
    opacity: 0; visibility: hidden;
    transform: translateY(20px) scale(.96);
    transition: opacity .3s ease, transform .3s ease, visibility .3s;
}
.abi-window.open {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}
@media (max-width: 400px) {
    .abi-window { width: calc(100vw - 2rem); right: -1rem; }
}

/* ── Header ───────────────────────────────────────────────── */
.abi-header {
    background: linear-gradient(135deg, #2e3191, #1a1f6b);
    padding: .85rem 1rem;
    display: flex; align-items: center; gap: .75rem;
    flex-shrink: 0;
}
.abi-header__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff; font-weight: 800; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.abi-header__name   { color: #fff; font-weight: 700; font-size: .9rem; }
.abi-header__status {
    display: flex; align-items: center;
    gap: .35rem; font-size: .72rem; color: rgba(255,255,255,.7);
}
.abi-online-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #4ade80;
}
.abi-header__close {
    margin-left: auto; background: none; border: none;
    color: rgba(255,255,255,.7); cursor: pointer;
    font-size: 1rem; padding: .25rem;
    transition: color .2s;
}
.abi-header__close:hover { color: #fff; }

/* ── Messages ─────────────────────────────────────────────── */
.abi-messages {
    flex: 1; overflow-y: auto; padding: 1rem;
    display: flex; flex-direction: column; gap: .6rem;
    scroll-behavior: smooth;
}
.abi-messages::-webkit-scrollbar       { width: 4px; }
.abi-messages::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 4px; }

.abi-msg            { display: flex; flex-direction: column; }
.abi-msg--user      { align-items: flex-end; }
.abi-msg--abi       { align-items: flex-start; }

.abi-msg__bubble {
    max-width: 80%;
    padding: .55rem .85rem;
    border-radius: 16px;
    font-size: .85rem; line-height: 1.5;
    word-break: break-word;
}
.abi-msg--user .abi-msg__bubble {
    background: #2e3191; color: #fff;
    border-radius: 16px 16px 4px 16px;
}
.abi-msg--abi .abi-msg__bubble {
    background: #f0f3ff; color: #212529;
    border-radius: 16px 16px 16px 4px;
}
.abi-msg__time { font-size: .65rem; color: #adb5bd; margin-top: .2rem; padding: 0 .2rem; }

/* ── Typing indicator ─────────────────────────────────────── */
.abi-typing-bubble {
    display: flex; align-items: center; gap: 4px;
    padding: .65rem .85rem !important;
}
.abi-typing-bubble span {
    width: 7px; height: 7px; border-radius: 50%;
    background: #adb5bd;
    animation: typingBounce .8s ease-in-out infinite;
}
.abi-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.abi-typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-6px); }
}

/* ── Quick replies ────────────────────────────────────────── */
.abi-quick-replies {
    display: flex; flex-wrap: wrap; gap: .4rem;
    padding: .5rem 1rem; border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.abi-qr-btn {
    background: #eef0fb; color: #2e3191;
    border: 1px solid #d4d9f5; border-radius: 20px;
    padding: .3rem .8rem; font-size: .75rem; font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .15s;
    white-space: nowrap;
}
.abi-qr-btn:hover {
    background: #2e3191; color: #fff;
    border-color: #2e3191; transform: translateY(-1px);
}

/* ── Input row ────────────────────────────────────────────── */
.abi-input-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.abi-input {
    flex: 1; border: 1.5px solid #dee2e6; border-radius: 20px;
    padding: .5rem .9rem; font-size: .85rem; outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.abi-input:focus { border-color: #2e3191; }

.abi-send-btn {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #2e3191, #d7263d);
    border: none; cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, opacity .2s;
}
.abi-send-btn:hover    { transform: scale(1.1); }
.abi-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }