:root {
    /* Premium Dark Theme Palette */
    --chat-bg-main: #131316;       /* Rich, deep obsidian */
    --chat-bg-surface: #1c1c21;    /* Slightly lighter surface for cards/inputs */
    --chat-bg-bubble: #272730;     /* Distinct tone for bot messages */
    --chat-accent: #3b82f6;        /* Vibrant, premium electric blue for inner accents */
    --chat-accent-hover: #2563eb;
    
    /* High-Visibility Attention Accents */
    --chat-success-glow: #10b981;  /* High-visibility Emerald Green for the chat trigger */
    --chat-success-hover: #059669;
    
    --chat-text-main: #f3f4f6;     /* Off-white (easier on the eyes) */
    --chat-text-muted: #9ca3af;    /* Sleek muted gray */
    
    /* Elegant UI Physics */
    --chat-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 
                   0 1px 3px rgba(255, 255, 255, 0.05) inset;
    --chat-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- HIGH-VISIBILITY CHAT BUBBLE TRIGGER --- */
#bac-chat-bubble {
    position: fixed;
    right: 24px;
    bottom: 24px;
    height: 54px; /* Taller presence to capture attention */
    padding: 0 8px 0 22px; /* Breathing room for the text, tighter wrap around icon */
    border-radius: 40px;
    background: var(--chat-success-glow);
    color: #ffffff;
    
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    cursor: pointer;
    z-index: 999999;
    
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Bold, Catchy Text Label */
.bac-bubble-label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); /* High readability overlay */
    user-select: none;
}

/* Icon Badge Container */
.bac-bubble-icon {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Eye-Catching Radar Wave Ring */
.bac-pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-sizing: border-box;
    animation: bac-radar-pulse 2s infinite ease-out;
    pointer-events: none;
}

/* Trigger Hover Enhancements */
#bac-chat-bubble:hover {
    transform: translateY(-4px) scale(1.03); /* Lift and micro-expand */
    background: var(--chat-success-hover);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.5);
}

#bac-chat-bubble:hover .bac-pulse-ring {
    animation: none;
    display: none; /* Turn off tracking loops while interacting */
}

/* --- CHAT WINDOW CONTAINER --- */
#bac-chat-window {
    position: fixed;
    right: 24px;
    bottom: 96px; /* Positioned cleanly above the elongated capsule */
    width: 380px;  
    height: 600px; 
    background: var(--chat-bg-main);
    border-radius: 20px;
    overflow: hidden;
    display: none; 
    flex-direction: column;
    z-index: 999999;
    box-shadow: var(--chat-shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- HEADER SECTION --- */
.bac-header {
    background: var(--chat-bg-surface);
    color: var(--chat-text-main);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bac-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.bac-status {
    font-size: 12px;
    color: var(--chat-text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Live glowing indicator inside window */
.bac-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--chat-success-glow); 
    border-radius: 50%;
    display: inline-block;
}

#bac-close {
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
}

#bac-close:hover {
    color: var(--chat-text-main);
    background: rgba(255, 255, 255, 0.08);
}

/* --- MESSAGES AREA --- */
#bac-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chat-bg-main);
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Premium Chat Bubble Shapes */
.bac-bot-message {
    background: var(--chat-bg-surface);
    color: var(--chat-text-main);
    padding: 12px 16px;
    border-radius: 16px 16px 16px 4px;
    max-width: 75%;
    font-size: 14.5px;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.04);
    align-self: flex-start;
}

.bac-user-message {
    background: var(--chat-accent);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    max-width: 75%;
    font-size: 14.5px;
    line-height: 1.5;
    align-self: flex-end;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

/* --- FOOTER INPUT AREA --- */
.bac-footer {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--chat-bg-surface);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#bac-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--chat-bg-main);
    color: var(--chat-text-main);
    font-size: 14px;
    transition: var(--chat-transition);
    outline: none;
}

#bac-input:focus {
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#bac-input::placeholder {
    color: #555563;
}

#bac-send {
    height: 40px;
    width: 40px;
    border: none;
    border-radius: 10px;
    background: var(--chat-accent);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

#bac-send:hover {
    background: var(--chat-accent-hover);
    transform: translateY(-1px);
}

/* --- KEYFRAME ANIMATIONS --- */
@keyframes bac-radar-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}