/* ═══════════════════════════════════════════════════════════════════
   Gem & Jewellery Sales Bot — Widget Styles
   Luxury dark gold theme
═══════════════════════════════════════════════════════════════════ */

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

:root {
    --cb-gold:         #C9A84C;
    --cb-gold-light:   #E8C97A;
    --cb-gold-dark:    #9A7535;
    --cb-bg:           #0C0B0F;
    --cb-surface:      #13121A;
    --cb-surface2:     #1A1826;
    --cb-border:       rgba(201, 168, 76, 0.18);
    --cb-border-soft:  rgba(201, 168, 76, 0.08);
    --cb-text:         #EDE8DC;
    --cb-text-muted:   #7A7565;
    --cb-bot-bubble:   #171622;
    --cb-shadow:       0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,168,76,0.12);
    --cb-radius:       22px;
    --cb-font-display: 'Cormorant Garamond', Georgia, serif;
    --cb-font:         'DM Sans', -apple-system, sans-serif;
}

/* ── TOGGLE BUTTON ─────────────────────────────────────────────── */
#cb-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, #C9A84C, #8B6914);
    border: 1px solid rgba(232, 201, 122, 0.3);
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(201,168,76,0.35), 0 2px 8px rgba(0,0,0,0.4);
    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(201,168,76,0.55);
}
#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);
}
/* Soft glow ring */
#cb-toggle::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 60%, rgba(232,201,122,0.4) 80%, transparent 100%);
    animation: cb-spin 4s linear infinite;
}
@keyframes cb-spin { to { transform: rotate(360deg); } }

/* Pulse */
#cb-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(201,168,76,0.3);
    opacity: 0;
    animation: cb-pulse 3s ease-out infinite;
}
@keyframes cb-pulse {
    0%   { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.9); opacity: 0; }
}

/* ── CHAT WINDOW ────────────────────────────────────────────────── */
#cb-window {
    position: fixed;
    bottom: 106px;
    right: 28px;
    width: 385px;
    height: 590px;
    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(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
#cb-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Subtle gem pattern overlay */
#cb-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 15% 85%, rgba(201,168,76,0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(201,168,76,0.03) 0%, transparent 35%);
    pointer-events: none;
    z-index: 0;
}

/* ── HEADER ─────────────────────────────────────────────────────── */
#cb-header {
    background: linear-gradient(135deg, #0E0C14 0%, #1C1608 50%, #0E0C14 100%);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--cb-border);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
#cb-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cb-gold), transparent);
    opacity: 0.4;
}
.cb-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C9A84C, #6B4C0E);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(201,168,76,0.25), 0 4px 12px rgba(0,0,0,0.4);
}
.cb-header-info { flex: 1; }
.cb-header-name {
    font-family: var(--cb-font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--cb-gold-light);
    letter-spacing: 0.03em;
}
.cb-header-subtitle {
    font-size: 11px;
    color: var(--cb-text-muted);
    margin-top: 2px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.cb-header-status {
    font-size: 11.5px;
    color: var(--cb-text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.cb-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ADE80;
    box-shadow: 0 0 5px #4ADE80;
    animation: cb-blink 2.5s ease-in-out infinite;
}
@keyframes cb-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
#cb-minimize {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cb-text-muted);
    padding: 5px;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    z-index: 1;
}
#cb-minimize:hover {
    color: var(--cb-gold-light);
    background: rgba(201,168,76,0.1);
}

/* ── MESSAGES ───────────────────────────────────────────────────── */
#cb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}
#cb-messages::-webkit-scrollbar { width: 3px; }
#cb-messages::-webkit-scrollbar-track { background: transparent; }
#cb-messages::-webkit-scrollbar-thumb {
    background: rgba(201,168,76,0.2);
    border-radius: 4px;
}

/* ── BUBBLES ────────────────────────────────────────────────────── */
.cb-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: cb-msg-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes cb-msg-in {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    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, #C9A84C, #6B4C0E);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-bottom: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.cb-bubble {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--cb-text);
    word-break: break-word;
}
.cb-msg.bot .cb-bubble {
    background: var(--cb-bot-bubble);
    border: 1px solid rgba(201,168,76,0.1);
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.cb-msg.user .cb-bubble {
    background: linear-gradient(135deg, #8B6914, #5C4309);
    border: 1px solid rgba(201,168,76,0.25);
    border-bottom-right-radius: 5px;
    color: #F0E8D0;
}
.cb-bubble strong {
    font-weight: 600;
    color: var(--cb-gold-light);
}
.cb-msg.user .cb-bubble strong { color: #F5E8B0; }

/* ── TYPING ─────────────────────────────────────────────────────── */
#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(201,168,76,0.1);
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    padding: 12px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}
.cb-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cb-gold);
    opacity: 0.4;
    animation: cb-bounce 1.3s 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 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    position: relative;
    z-index: 1;
}
.cb-qr-btn {
    background: transparent;
    border: 1px solid rgba(201,168,76,0.3);
    color: #C9A84C;
    font-family: var(--cb-font);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.cb-qr-btn:hover {
    background: rgba(201,168,76,0.12);
    border-color: var(--cb-gold);
    color: var(--cb-gold-light);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(201,168,76,0.15);
}
.cb-qr-btn:active { transform: translateY(0); }

/* ── INPUT AREA ──────────────────────────────────────────────────── */
#cb-input-area {
    padding: 10px 14px 14px;
    background: var(--cb-surface);
    border-top: 1px solid var(--cb-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}
#cb-input-area::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,0.25), transparent);
}
#cb-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(201,168,76,0.15);
    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, background 0.2s;
    caret-color: var(--cb-gold);
}
#cb-input::placeholder { color: var(--cb-text-muted); }
#cb-input:focus {
    border-color: rgba(201,168,76,0.5);
    background: rgba(201,168,76,0.04);
}
#cb-send {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #C9A84C, #8B6914);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(201,168,76,0.3);
}
#cb-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(201,168,76,0.5);
}
#cb-send:active { transform: scale(0.95); }

/* ── FOOTER ─────────────────────────────────────────────────────── */
#cb-footer {
    text-align: center;
    padding: 5px;
    font-size: 10.5px;
    color: #3A3525;
    font-family: var(--cb-font);
    letter-spacing: 0.04em;
    position: relative;
    z-index: 1;
}

/* ── BADGE ───────────────────────────────────────────────────────── */
#cb-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 19px;
    height: 19px;
    background: linear-gradient(135deg, #E8C97A, #C9A84C);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #0C0B0F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cb-font);
    padding: 0 4px;
    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); }
}

/* ── LEAD PROGRESS BAR ───────────────────────────────────────────── */
#cb-lead-progress {
    height: 2px;
    background: rgba(201,168,76,0.08);
    position: relative;
    flex-shrink: 0;
    z-index: 1;
}
#cb-lead-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #C9A84C, #E8C97A);
    transition: width 0.5s ease;
    border-radius: 0 2px 2px 0;
}

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