/* ============================================================
   X-Robot – Floating Chat Widget
   ============================================================ */

/* ── Trigger Button ───────────────────────────────────────── */
.chatbot-trigger {
    position: fixed;
    bottom: 84px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(138, 43, 226, 0.5);
    z-index: 9900;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
}
.chatbot-trigger:hover {
    transform: scale(1.12);
    box-shadow: 0 12px 36px rgba(138, 43, 226, 0.65);
}
.chatbot-trigger i {
    font-size: 1.35rem;
    color: #fff;
    transition: transform 0.3s ease, opacity 0.2s ease;
    position: absolute;
}
.chatbot-trigger .icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.chatbot-trigger.is-open .icon-chat { opacity: 0; transform: rotate(90deg) scale(0.6); }
.chatbot-trigger.is-open .icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

/* Notification badge */
.chatbot-badge {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 17px;
    height: 17px;
    background: #ef4444;
    border-radius: 50%;
    border: 2.5px solid #fff;
    display: none;
}
.chatbot-badge.show { display: block; animation: cbBadgePulse 2s ease-in-out infinite; }
@keyframes cbBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ── Chat Window ──────────────────────────────────────────── */
.chatbot-window {
    position: fixed;
    bottom: 106px;
    right: 28px;
    width: 365px;
    height: 530px;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(138, 43, 226, 0.08);
    z-index: 9899;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.85) translateY(18px);
    opacity: 0;
    pointer-events: none;
    transform-origin: bottom right;
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.22s ease;
}
.chatbot-window.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ───────────────────────────────────────────────── */
.cb-header {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.cb-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cb-avatar i { color: #fff; font-size: 1.1rem; }
.cb-info { flex: 1; }
.cb-name { color: #fff; font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.cb-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}
.cb-status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: cbOnlinePulse 2.5s ease-in-out infinite;
}
@keyframes cbOnlinePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}
.cb-status-text { color: rgba(255, 255, 255, 0.82); font-size: 0.72rem; }
.cb-minimize {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.18s ease;
}
.cb-minimize:hover { background: rgba(255, 255, 255, 0.28); }

/* ── Messages Area ────────────────────────────────────────── */
.cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.9rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: #f7f5ff;
    scroll-behavior: smooth;
}
.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: rgba(138, 43, 226, 0.18); border-radius: 4px; }

/* ── Message Rows ─────────────────────────────────────────── */
.cb-row {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    animation: cbMsgIn 0.28s ease forwards;
}
.cb-row.user { flex-direction: row-reverse; }
@keyframes cbMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cb-bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}
.cb-bot-avatar i { color: #fff; font-size: 0.68rem; }

.cb-bubble {
    max-width: 80%;
    padding: 0.6rem 0.9rem;
    border-radius: 18px;
    font-size: 0.845rem;
    line-height: 1.55;
    word-break: break-word;
}
.cb-row.bot .cb-bubble {
    background: #fff;
    color: #1a1a1a;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}
.cb-row.user .cb-bubble {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    color: #fff;
    border-bottom-right-radius: 5px;
}
.cb-bubble strong { font-weight: 700; }

/* ── Typing Indicator ─────────────────────────────────────── */
.cb-typing {
    display: flex;
    gap: 5px;
    padding: 0.6rem 0.9rem;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    width: fit-content;
}
.cb-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c4b5fd;
    animation: cbTyping 1.3s ease-in-out infinite;
}
.cb-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.cb-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cbTyping {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-8px); }
}

/* ── Quick Replies ────────────────────────────────────────── */
.cb-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.15rem 0 0.25rem 0;
}
.cb-qr-btn {
    padding: 0.38rem 0.8rem;
    border-radius: 50px;
    border: 1.5px solid rgba(138, 43, 226, 0.28);
    background: #fff;
    color: #7c3aed;
    font-family: 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.cb-qr-btn:hover {
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(138, 43, 226, 0.3);
}

/* ── Event Cards in Chat ──────────────────────────────────── */
.cb-events-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 82%;
}
.cb-event-card {
    display: block;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid rgba(138, 43, 226, 0.08);
}
.cb-event-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14); }
.cb-event-img {
    height: 72px;
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    overflow: hidden;
    position: relative;
}
.cb-event-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cb-event-img-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.4);
}
.cb-event-info { padding: 0.55rem 0.75rem; }
.cb-event-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}
.cb-event-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cb-event-price { font-size: 0.75rem; font-weight: 700; color: #7c3aed; }
.cb-event-date  { font-size: 0.7rem; color: #888; }
.cb-event-date i { margin-right: 3px; }

/* ── Input Area ───────────────────────────────────────────── */
.cb-input-area {
    padding: 0.7rem 0.9rem;
    background: #fff;
    border-top: 1px solid #f0eaff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.cb-input {
    flex: 1;
    border: 1.5px solid #e8e0ff;
    border-radius: 50px;
    padding: 0.52rem 1rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.83rem;
    outline: none;
    background: #faf8ff;
    transition: border-color 0.18s ease, background 0.18s ease;
    color: #1a1a1a;
}
.cb-input:focus { border-color: #8a2be2; background: #fff; }
.cb-input::placeholder { color: #b0a8c8; }
.cb-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8a2be2 0%, #6a0dad 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cb-send:hover { transform: scale(1.1); box-shadow: 0 4px 14px rgba(138, 43, 226, 0.42); }
.cb-send i { color: #fff; font-size: 0.85rem; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .chatbot-trigger {
        bottom: 120px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 88dvh;
        border-radius: 22px 22px 0 0;
        transform-origin: bottom center;
        transform: translateY(30px) scale(0.97);
    }
    .chatbot-window.is-open {
        transform: translateY(0) scale(1);
    }
    .cb-events-list { max-width: 90%; }
}
