/* ═══════════════════════════════════════════════════════════════════
   PixelCraft Agency — Sales Chatbot Widget Styles
   Drop this file in your project or paste into your main CSS
═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --cb-primary: #6C63FF;
    --cb-primary-dark: #5A52E0;
    --cb-accent: #FF6B6B;
    --cb-bg: #0F0F1A;
    --cb-surface: #1A1A2E;
    --cb-surface2: #16213E;
    --cb-border: rgba(108, 99, 255, 0.2);
    --cb-text: #E8E8F0;
    --cb-text-muted: #8888A0;
    --cb-bot-bubble: #1E1E35;
    --cb-user-bubble: #6C63FF;
    --cb-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(108,99,255,0.15);
    --cb-radius: 20px;
    --cb-font: 'Plus Jakarta Sans', -apple-system, sans-serif;
}

/* ── WIDGET TOGGLE BUTTON ── */
#cb-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-primary), #9B5DE5);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.45), 0 2px 8px rgba(0,0,0,0.3);
    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;
    z-index: 9999;
    outline: none;
}
#cb-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(108, 99, 255, 0.6);
}
#cb-toggle .cb-icon-open,
#cb-toggle .cb-icon-close {
    position: absolute;
    transition: opacity 0.2s ease, transform 0.3s ease;
}
#cb-toggle .cb-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.7);
}
#cb-toggle.active .cb-icon-open {
    opacity: 0;
    transform: rotate(90deg) scale(0.7);
}
#cb-toggle.active .cb-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Pulse ring */
#cb-toggle::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--cb-primary);
    opacity: 0;
    animation: cb-pulse 2.5s ease-out infinite;
}
@keyframes cb-pulse {
    0%   { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ── CHAT WINDOW ── */
#cb-window {
    position: fixed;
    bottom: 104px;
    right: 28px;
    width: 380px;
    height: 580px;
    background: var(--cb-bg);
    border-radius: var(--cb-radius);
    box-shadow: var(--cb-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    font-family: var(--cb-font);
    overflow: hidden;
    border: 1px solid var(--cb-border);
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#cb-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ── HEADER ── */
#cb-header {
    background: linear-gradient(135deg, #1A1A35 0%, #2D1B69 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--cb-border);
    position: relative;
    overflow: hidden;
}
#cb-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(108,99,255,0.3) 0%, transparent 70%);
}
.cb-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-primary), #9B5DE5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(108,99,255,0.3);
}
.cb-header-info {
    flex: 1;
}
.cb-header-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}
.cb-header-status {
    font-size: 12px;
    color: #8888A0;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.cb-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ADE80;
    box-shadow: 0 0 6px #4ADE80;
    animation: cb-blink 2s ease-in-out infinite;
}
@keyframes cb-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
#cb-minimize {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cb-text-muted);
    padding: 4px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    display: flex;
}
#cb-minimize:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ── MESSAGES AREA ── */
#cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}
#cb-messages::-webkit-scrollbar {
    width: 4px;
}
#cb-messages::-webkit-scrollbar-track {
    background: transparent;
}
#cb-messages::-webkit-scrollbar-thumb {
    background: rgba(108,99,255,0.3);
    border-radius: 4px;
}

/* ── MESSAGE BUBBLES ── */
.cb-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: cb-msg-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cb-msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cb-msg.bot { flex-direction: row; }
.cb-msg.user { flex-direction: row-reverse; }

.cb-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cb-primary), #9B5DE5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-bottom: 2px;
}
.cb-bubble {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--cb-text);
    word-break: break-word;
}
.cb-msg.bot .cb-bubble {
    background: var(--cb-bot-bubble);
    border: 1px solid rgba(108,99,255,0.15);
    border-bottom-left-radius: 6px;
}
.cb-msg.user .cb-bubble {
    background: var(--cb-user-bubble);
    border-bottom-right-radius: 6px;
    color: #fff;
}

/* Markdown-like formatting in bot bubbles */
.cb-bubble strong {
    font-weight: 700;
    color: #C4BFFF;
}
.cb-msg.user .cb-bubble strong {
    color: #fff;
}
.cb-bubble br + br {
    display: block;
    content: '';
    margin-top: 4px;
}

/* ── TYPING INDICATOR ── */
#cb-typing {
    display: none;
    align-items: flex-end;
    gap: 8px;
    padding: 0 4px;
}
#cb-typing.visible {
    display: flex;
    animation: cb-msg-in 0.3s ease;
}
.cb-typing-bubble {
    background: var(--cb-bot-bubble);
    border: 1px solid rgba(108,99,255,0.15);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.cb-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cb-primary);
    opacity: 0.4;
    animation: cb-bounce 1.2s ease-in-out infinite;
}
.cb-dot:nth-child(2) { animation-delay: 0.2s; }
.cb-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ── QUICK REPLIES ── */
#cb-quick-replies {
    padding: 0 16px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cb-qr-btn {
    background: transparent;
    border: 1px solid rgba(108,99,255,0.4);
    color: #C4BFFF;
    font-size: 12px;
    font-family: var(--cb-font);
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.cb-qr-btn:hover {
    background: rgba(108,99,255,0.2);
    border-color: var(--cb-primary);
    color: #fff;
    transform: translateY(-1px);
}
.cb-qr-btn:active {
    transform: translateY(0);
}

/* ── INPUT AREA ── */
#cb-input-area {
    padding: 12px 16px 16px;
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
#cb-input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(108,99,255,0.2);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: var(--cb-font);
    color: var(--cb-text);
    outline: none;
    resize: none;
    max-height: 100px;
    min-height: 42px;
    line-height: 1.4;
    transition: border-color 0.2s;
    caret-color: var(--cb-primary);
}
#cb-input::placeholder { color: var(--cb-text-muted); }
#cb-input:focus {
    border-color: var(--cb-primary);
    background: rgba(108,99,255,0.08);
}
#cb-send {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cb-primary), #9B5DE5);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(108,99,255,0.4);
}
#cb-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(108,99,255,0.6);
}
#cb-send:active { transform: scale(0.95); }
#cb-send svg { color: #fff; }

/* ── POWERED BY FOOTER ── */
#cb-footer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #444460;
    font-family: var(--cb-font);
}

/* ── NOTIFICATION BADGE ── */
#cb-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--cb-accent);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cb-font);
    box-shadow: 0 2px 8px rgba(255,107,107,0.5);
    animation: cb-badge-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cb-badge-in {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    #cb-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
        height: 72vh;
        max-height: 550px;
    }
    #cb-toggle {
        right: 16px;
        bottom: 16px;
    }
}
