/* ==========================================================================
   SecretaryBot White Label AI Chat Plugin - Isolated Stylesheet
   All classes use the `.sb-chat-*` prefix to prevent any CSS collision
   ========================================================================== */

:root {
    --sb-bg-dark: #0A0E1A;
    --sb-bg-card: rgba(17, 24, 39, 0.85);
    --sb-border-glow: rgba(56, 189, 248, 0.25);
    --sb-accent-primary: #38BDF8;
    --sb-accent-secondary: #00E676;
    --sb-accent-purple: #8B5CF6;
    --sb-text-primary: #F8FAFC;
    --sb-text-secondary: #94A3B8;
    --sb-text-muted: #64748B;
    --sb-font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --sb-font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --sb-radius-md: 12px;
    --sb-radius-lg: 18px;
    --sb-radius-xl: 24px;
    --sb-shadow-glow: 0 10px 40px rgba(56, 189, 248, 0.2);
}

/* ==========================================
   1. Hero Overlay Mode
   ========================================== */
.sb-chat-hero-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(23, 32, 54, 0.97);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--sb-radius-xl);
    padding: 1.5rem;
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    /* Subtle 3D Neon Aura Glow visible on dark background */
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85), 
                0 0 22px rgba(56, 189, 248, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.3s ease;
    animation: sbHeroFloating 3.5s infinite ease-in-out;
}

/* Pause floating animation when user interacts or hovers */
.sb-chat-hero-wrapper:hover,
.sb-chat-hero-wrapper:focus-within {
    animation-play-state: paused;
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 
                0 0 32px rgba(56, 189, 248, 0.3);
}

@keyframes sbHeroFloating {
    0%, 100% {
        transform: translateY(0);
        border-color: rgba(56, 189, 248, 0.3);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85), 
                    0 0 18px rgba(56, 189, 248, 0.15);
    }
    50% {
        transform: translateY(-8px);
        border-color: rgba(56, 189, 248, 0.55);
        box-shadow: 0 25px 55px rgba(0, 0, 0, 0.9), 
                    0 0 28px rgba(56, 189, 248, 0.28);
    }
}

.sb-chat-hero-wrapper.sb-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
    animation: none;
}

/* Header Live Badge */
.sb-chat-live-badge {
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid rgba(0, 230, 118, 0.4);
    color: #00E676;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.25);
    animation: sbLiveBadgePulse 2s infinite ease-in-out;
}

.sb-chat-live-badge i {
    color: #F59E0B;
}

@keyframes sbLiveBadgePulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 18px rgba(0, 230, 118, 0.4); }
}

/* Header */
.sb-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.sb-chat-brand-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sb-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(0, 230, 118, 0.2));
    border: 1px solid var(--sb-accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sb-accent-primary);
    font-size: 1rem;
}

.sb-chat-title-group h4 {
    font-family: var(--sb-font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sb-text-primary);
    margin: 0;
    line-height: 1.2;
}

.sb-chat-status {
    font-size: 0.75rem;
    color: var(--sb-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sb-chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--sb-accent-secondary);
    box-shadow: 0 0 8px var(--sb-accent-secondary);
}

/* Chat Body */
.sb-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.sb-chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.35rem;
    margin-bottom: 1rem;
}

/* Custom Scrollbar */
.sb-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.sb-chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}
.sb-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.3);
    border-radius: 10px;
}
.sb-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.6);
}

/* Messages */
.sb-chat-msg {
    padding: 0.9rem 1.15rem;
    border-radius: var(--sb-radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 90%;
    animation: sbFadeIn 0.3s ease;
}

@keyframes sbFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.sb-chat-msg.user {
    align-self: flex-end;
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-bottom-right-radius: 4px;
    color: var(--sb-text-primary);
}

.sb-chat-msg.ai {
    align-self: flex-start;
    background: rgba(14, 38, 38, 0.9);
    border: 1px solid rgba(0, 230, 118, 0.35);
    border-bottom-left-radius: 4px;
    color: var(--sb-text-primary);
}

.sb-chat-msg-author {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.sb-chat-msg.user .sb-chat-msg-author { color: var(--sb-accent-primary); }
.sb-chat-msg.ai .sb-chat-msg-author { color: var(--sb-accent-secondary); }

/* Typing Indicator */
.sb-chat-typing {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--sb-radius-md);
    align-self: flex-start;
    font-size: 0.8rem;
    color: var(--sb-text-secondary);
}

.sb-typing-dots {
    display: flex;
    gap: 0.25rem;
}

.sb-typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--sb-accent-primary);
    border-radius: 50%;
    animation: sbBlink 1.4s infinite ease-in-out both;
}

.sb-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.sb-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes sbBlink {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Quick Suggestion Chips */
.sb-chat-chips {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sb-chat-chips::-webkit-scrollbar {
    display: none;
}
.sb-chip {
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: var(--sb-accent-primary);
    font-size: 0.775rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.sb-chip:hover {
    background: rgba(56, 189, 248, 0.25);
    border-color: var(--sb-accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Input Form */
.sb-chat-input-bar {
    display: flex;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sb-radius-md);
    padding: 0.4rem 0.5rem 0.4rem 1rem;
    transition: border-color 0.3s ease;
}

.sb-chat-input-bar:focus-within {
    border-color: var(--sb-accent-primary);
}

.sb-chat-input-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--sb-text-primary);
    font-family: var(--sb-font-main);
    font-size: 0.9rem;
}

.sb-chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--sb-accent-primary) 0%, var(--sb-accent-purple) 100%);
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
    animation: sbSendBtnBounce 6s infinite ease-in-out;
}

@keyframes sbSendBtnBounce {
    0%, 90%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4); }
    94% { transform: scale(1.15) rotate(-8deg); box-shadow: 0 6px 22px rgba(56, 189, 248, 0.7); }
    97% { transform: scale(1.08) rotate(4deg); }
}

.sb-chat-send-btn:hover {
    transform: scale(1.05);
}

.sb-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   2. Floating Bubble & Drawer Mode
   ========================================== */
.sb-chat-bubble {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sb-accent-primary) 0%, var(--sb-accent-purple) 100%);
    color: #FFFFFF;
    border: 1px solid var(--sb-border-glow);
    display: none !important;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
}

.sb-chat-bubble.sb-visible {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.sb-chat-bubble:hover {
    transform: scale(1.1);
}

.sb-bubble-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--sb-accent-secondary);
    border: 2px solid var(--sb-bg-dark);
    box-shadow: 0 0 10px var(--sb-accent-secondary);
}

/* Expanded Floating Drawer */
.sb-chat-drawer {
    position: fixed;
    bottom: 5rem;
    right: 2rem;
    width: 440px;
    height: 680px;
    max-width: calc(100vw - 2.5rem);
    max-height: calc(100vh - 6rem);
    z-index: 2100;
    background: rgba(23, 32, 54, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: var(--sb-radius-xl);
    padding: 1.25rem;
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sb-chat-drawer.sb-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.sb-chat-close-btn {
    background: none;
    border: none;
    color: var(--sb-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.sb-chat-close-btn:hover {
    color: var(--sb-text-primary);
}

/* Footer White Label Link */
.sb-chat-footer-brand {
    text-align: center;
    font-size: 0.725rem;
    color: var(--sb-text-muted);
    margin-top: 0.5rem;
}

.sb-chat-footer-brand a {
    color: var(--sb-text-secondary);
    text-decoration: underline;
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .sb-chat-bubble {
        bottom: 1.5rem;
        right: 1.5rem;
    }
    
    .sb-chat-drawer {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        width: auto;
        height: calc(100vh - 2rem);
        max-height: none;
    }
}
