/* Bubblibot Frontend Styles */

.bubblibot-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Position-specific styles */
.bubblibot-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.bubblibot-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.bubblibot-widget.position-bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.bubblibot-widget.position-right-center {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.bubblibot-widget.position-left-center {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.bubblibot-toggle {
    width: 60px;
    height: 60px;
    background: #0073aa;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bubblibot-toggle:hover {
    transform: scale(1.1);
}

.bubblibot-toggle svg {
    width: 30px;
    height: 30px;
    color: white;
}

.bubblibot-window {
    position: absolute;
    width: clamp(350px, 25vw, 450px); /* Dynamic width: min 350px, max 25% of viewport width, max 450px */
    height: clamp(400px, 95vh, 95vh); /* Dynamic height: min 400px, max 95% of viewport height */
    background: var(--bubblibot-window-bg, #ffffff);
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Window positioning based on widget position - beside toggle for more vertical space */
.position-bottom-right .bubblibot-window {
    bottom: 1vh; /* Small margin from bottom - 1% of viewport */
    right: 80px;
    max-height: 95vh; /* Use 95% of viewport height */
}

.position-bottom-left .bubblibot-window {
    bottom: 1vh; /* Small margin from bottom - 1% of viewport */
    left: 80px;
    max-height: 95vh; /* Use 95% of viewport height */
}

.position-bottom-center .bubblibot-window {
    bottom: 1vh; /* Small margin from bottom - 1% of viewport */
    left: 50%;
    transform: translateX(-50%) translateX(-175px); /* Offset to position beside centered toggle */
    max-height: 95vh; /* Use 95% of viewport height */
}

.position-right-center .bubblibot-window {
    top: 50%;
    right: 80px;
    transform: translateY(-50%);
    max-height: 95vh; /* Use 95% of viewport height */
}

.position-left-center .bubblibot-window {
    top: 50%;
    left: 80px;
    transform: translateY(-50%);
    max-height: 95vh; /* Use 95% of viewport height */
}

.bubblibot-header {
    background: #0073aa;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bubblibot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.bubblibot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.bubblibot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bubblibot-window-bg, #ffffff);
}

.bubblibot-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.bubblibot-message-content {
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    line-height: 1.4;
}

.bubblibot-message-content a {
    color: #0073aa;
    text-decoration: underline;
    word-break: break-word;
    position: relative;
    display: inline-block;
    padding: 0 2px;
}

.bubblibot-user {
    align-items: flex-end;
}

.bubblibot-user .bubblibot-message-content {
    background: #0073aa;
    color: white;
}

.bubblibot-user .bubblibot-message-content a {
    color: #ffffff;
    text-decoration: underline;
}

.bubblibot-bot {
    align-items: flex-start;
    display: flex;
    gap: 8px;
}

.bubblibot-bot .bubblibot-message-content {
    background: #f0f0f0;
    color: #333;
}

.bubblibot-bot .bubblibot-message-content a {
    font-weight: 500;
}

.bubblibot-bot .bubblibot-message-content a:hover {
    text-decoration: none;
    background-color: rgba(0, 115, 170, 0.1);
    border-radius: 2px;
}

.bubblibot-error .bubblibot-message-content {
    background: #ff6b6b;
    color: white;
}

.bubblibot-input-container {
    padding: 15px 15px 6px 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: white;
}

.bubblibot-powered-by {
    padding: 2px 15px 6px 15px !important;
    text-align: center;
    background: white;
    border-top: 1px solid #f0f0f0;
}

.bubblibot-powered-by span {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.bubblibot-powered-by a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.bubblibot-powered-by a:hover {
    color: #0073aa;
    text-decoration: none;
}

.bubblibot-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.bubblibot-input:focus {
    border-color: #0073aa;
}

.bubblibot-send {
    background: var(--bubblibot-primary-color, #0073aa);
    color: var(--bubblibot-text-color, white);
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.bubblibot-send:hover {
    background: var(--bubblibot-secondary-color, #006291);
}

.bubblibot-typing {
    padding: 10px 15px;
    display: flex;
    gap: 5px;
}

.bubblibot-typing span {
    width: 8px;
    height: 8px;
    background: var(--bubblibot-primary-color, #0073aa) !important;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1s infinite ease-in-out;
}

.bubblibot-typing span:nth-child(1) { animation-delay: 0.1s; }
.bubblibot-typing span:nth-child(2) { animation-delay: 0.2s; }
.bubblibot-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Bot message avatar styling (basic free version support) */
.bubblibot-bot.has-avatar {
    position: relative;
}

.bubblibot-bot.has-avatar .bubblibot-message-content {
    margin-left: 35px; /* Make room for avatar */
    position: relative;
}

.bubblibot-bot-message-avatar {
    position: absolute;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: #e3f2fd;
    z-index: 1;
    margin-top: 2px;
}

/* Default bot avatar when no image is available but avatar is enabled */
.bubblibot-bot-message-avatar.default-avatar {
    background: #2196f3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Mobile responsiveness - FULL SCREEN EXPERIENCE */
@media (max-width: 480px) {
    /* Override all positions on mobile to use bottom-right with safe area support */
    .bubblibot-widget {
        bottom: max(15px, env(safe-area-inset-bottom, 15px)) !important;
        right: 15px !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        z-index: 999998 !important;
    }
    
    /* MOBILE ONLY: Full screen chat window - MOVED INSIDE MOBILE BLOCK ONLY! */
    .bubblibot-widget.chat-open .bubblibot-window {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for better mobile support */
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        z-index: 999999 !important;
        transform: translateY(0) !important;
        margin: 0 !important;
        /* Smooth transition when opening */
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
        /* Ensure it's always on top */
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    
    /* Hide the widget toggle when chat is open */
    .bubblibot-widget.chat-open .bubblibot-toggle {
        display: none !important;
    }
    
    /* Mobile-optimized header - simplified */
    .bubblibot-window .bubblibot-header {
        padding: 20px !important;
        padding-right: 70px !important; /* Space for close button */
        background: var(--bubblibot-primary-color, #0073aa) !important;
        color: white !important;
        position: relative !important;
        min-height: 60px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    .bubblibot-window .bubblibot-header h3 {
        margin: 0 !important;
        font-size: 18px !important;
        font-weight: 600 !important;
    }
    
    /* Mobile-specific close button positioning (vertically centered) */
    .bubblibot-window .bubblibot-close {
        position: absolute !important;
        top: 50% !important;
        right: 12px !important;
        font-size: 32px !important;
        padding: 0 8px !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .bubblibot-window .bubblibot-close:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    /* Full height messages area */
    .bubblibot-window .bubblibot-messages {
        flex: 1 !important;
        padding: 20px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        /* Account for input area */
        margin-bottom: 0 !important;
        /* Better spacing for mobile */
        padding-bottom: 20px !important;
    }
    
    /* Mobile-optimized message bubbles */
    .bubblibot-message {
        margin-bottom: 16px !important;
    }
    
    .bubblibot-message-content {
        padding: 12px 16px !important;
        border-radius: 18px !important;
        max-width: 85% !important;
        line-height: 1.4 !important;
        font-size: 16px !important; /* Better readability on mobile */
    }
    
    /* User messages - right aligned */
    .bubblibot-user .bubblibot-message-content {
        background: var(--bubblibot-primary-color, #0073aa) !important;
        color: white !important;
        margin-left: auto !important;
    }
    
    /* Bot messages - left aligned */
    .bubblibot-bot .bubblibot-message-content {
        background: #f0f0f0 !important;
        color: #333 !important;
        margin-right: auto !important;
    }
    
    /* Fixed input area at bottom with better keyboard handling */
    .bubblibot-window .bubblibot-input-container {
        position: sticky !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        padding: 15px 20px !important;
        /* Add safe area padding for all sides */
        padding-left: max(20px, env(safe-area-inset-left, 20px)) !important;
        padding-right: max(20px, env(safe-area-inset-right, 20px)) !important;
        border-top: 1px solid #eee !important;
        display: flex !important;
        gap: 12px !important;
        align-items: center !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
        /* Ensure it stays above keyboard */
        z-index: 1001 !important;
        min-height: 70px !important;
    }
    
    /* Mobile powered-by section with better safe area handling */
    .bubblibot-window .bubblibot-powered-by {
        position: sticky !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        padding: 6px 20px !important;
        /* Better safe area padding for home indicator and sides */
        padding-left: max(20px, env(safe-area-inset-left, 20px)) !important;
        padding-right: max(20px, env(safe-area-inset-right, 20px)) !important;
        padding-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 6px)) !important;
        border-top: 1px solid #f0f0f0 !important;
        text-align: center !important;
        z-index: 1000 !important;
    }
    
    .bubblibot-window .bubblibot-powered-by span {
        font-size: 10px !important;
        color: #aaa !important;
    }
    
    .bubblibot-window .bubblibot-powered-by a {
        color: #777 !important;
    }
    
    .bubblibot-window .bubblibot-input {
        flex: 1 !important;
        padding: 12px 16px !important;
        border: 1px solid #ddd !important;
        border-radius: 25px !important;
        outline: none !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        background: #f8f9fa !important;
        transition: border-color 0.2s ease !important;
    }
    
    .bubblibot-window .bubblibot-input:focus {
        border-color: var(--bubblibot-primary-color, #0073aa) !important;
        background: white !important;
    }
    
    .bubblibot-window .bubblibot-send {
        background: var(--bubblibot-primary-color, #0073aa) !important;
        color: white !important;
        border: none !important;
        padding: 14px !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        transition: background-color 0.2s ease !important;
        width: 48px !important;
        height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    
    .bubblibot-window .bubblibot-send:hover {
        background: var(--bubblibot-secondary-color, #006291) !important;
    }
    
    /* Typing indicator adjustments */
    .bubblibot-window .bubblibot-typing {
        padding: 12px 16px !important;
        margin: 0 20px 16px 20px !important;
        background: #f0f0f0 !important;
        border-radius: 18px !important;
        width: fit-content !important;
    }
    
    /* Bot avatar mobile styles */
    .bubblibot-bot.has-avatar .bubblibot-message-content {
        margin-left: 30px !important;
    }
    
    .bubblibot-bot-message-avatar {
        width: 24px !important;
        height: 24px !important;
    }
    
    .bubblibot-bot-message-avatar.default-avatar {
        font-size: 10px !important;
    }
    
    /* Enhanced toggle button for mobile with better touch interactions */
    .bubblibot-toggle {
        width: 60px !important;
        height: 60px !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        /* Better touch target */
        min-width: 44px !important;
        min-height: 44px !important;
        /* Improve touch responsiveness */
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }
    
    .bubblibot-toggle:hover {
        transform: scale(1.05) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    }
    
    .bubblibot-toggle:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }
    
    .bubblibot-toggle svg {
        width: 28px !important;
        height: 28px !important;
        pointer-events: none !important;
    }
    
    /* Enhanced close button for mobile */
    .bubblibot-window .bubblibot-close {
        /* Better touch target */
        min-width: 44px !important;
        min-height: 44px !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }
    
    .bubblibot-window .bubblibot-close:active {
        background-color: rgba(255, 255, 255, 0.2) !important;
        transform: scale(0.95) !important;
    }
    
    /* Enhanced send button for mobile */
    .bubblibot-window .bubblibot-send {
        /* Better touch interactions */
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    .bubblibot-window .bubblibot-send:active {
        transform: scale(0.9) !important;
        transition: transform 0.1s ease !important;
    }
    
    /* Enhanced input field for mobile */
    .bubblibot-window .bubblibot-input {
        /* Better touch interactions */
        -webkit-tap-highlight-color: transparent !important;
        /* Improved iOS appearance */
        -webkit-appearance: none !important;
        appearance: none !important;
        /* Better keyboard type */
        -webkit-user-select: text !important;
        user-select: text !important;
    }
}


/* Dynamic scaling for large screens */
@media (min-width: 1200px) {
    .bubblibot-window {
        width: clamp(380px, 28vw, 500px); /* Larger on big screens */
        height: 95vh; /* Use 95% of viewport height */
        max-height: 95vh; /* Consistent with height */
    }
}

@media (min-width: 1600px) {
    .bubblibot-window {
        width: clamp(420px, 30vw, 550px); /* Even larger on very big screens */
        height: 95vh; /* Use 95% of viewport height */
        max-height: 95vh; /* Consistent with height */
    }
}

/* Cap height only for truly large screens (2560×1440 and above) */
@media (min-width: 2560px) {
    .bubblibot-window {
        height: clamp(400px, 60vh, 900px); /* Cap at 900px for very large displays */
        max-height: 900px; /* Fixed maximum for ultra-wide/large displays */
    }
}

/* Ensure minimum size on smaller desktops */
@media (max-width: 1024px) and (min-width: 481px) {
    .bubblibot-window {
        width: 350px; /* Fixed width on smaller desktops */
        height: clamp(400px, 95vh, 95vh); /* Use 95% of viewport height with minimum */
        max-height: 95vh; /* Consistent with height */
    }
}

/* Scrollbar styling */
.bubblibot-messages::-webkit-scrollbar {
    width: 6px;
}

.bubblibot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.bubblibot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.bubblibot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Markdown formatting styles for chat messages */
.bubblibot-message-content h1,
.bubblibot-message-content h2,
.bubblibot-message-content h3 {
    line-height: 1.3;
    margin-top: 8px;
    margin-bottom: 4px;
}

.bubblibot-message-content h1:first-child,
.bubblibot-message-content h2:first-child,
.bubblibot-message-content h3:first-child {
    margin-top: 0;
}

.bubblibot-message-content h1:last-child,
.bubblibot-message-content h2:last-child,
.bubblibot-message-content h3:last-child {
    margin-bottom: 0;
}

/* Ensure numbered list items have proper spacing */
.bubblibot-message-content div[style*="margin: 4px 0"] {
    line-height: 1.4;
}

/* Mobile adjustments for headers */
@media (max-width: 480px) {
    .bubblibot-message-content h1 {
        font-size: 16px !important;
        margin: 6px 0 4px 0 !important;
    }
    
    .bubblibot-message-content h2 {
        font-size: 15px !important;
        margin: 6px 0 3px 0 !important;
    }
    
    .bubblibot-message-content h3 {
        font-size: 14px !important;
        margin: 6px 0 3px 0 !important;
    }
}

/* Enhanced mobile experience features */
@media (max-width: 480px) {
    /* Improved iOS safe area support for all devices */
    @supports (padding: max(0px)) {
        .bubblibot-widget {
            /* Better safe area handling for widget toggle */
            bottom: max(15px, calc(env(safe-area-inset-bottom, 0px) + 10px)) !important;
            right: max(15px, env(safe-area-inset-right, 15px)) !important;
        }
        
        .bubblibot-widget .bubblibot-window {
            /* Full screen with proper safe area */
            padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        }
    }
    
    /* Enhanced webkit support for iOS */
    @supports (-webkit-touch-callout: none) {
        .bubblibot-widget .bubblibot-window {
            /* Better iOS integration */
            -webkit-overflow-scrolling: touch !important;
            -webkit-appearance: none !important;
        }
        
        .bubblibot-window .bubblibot-messages {
            -webkit-overflow-scrolling: touch !important;
        }
        
        .bubblibot-window .bubblibot-input {
            -webkit-appearance: none !important;
            border-radius: 25px !important;
        }
    }
}

/* Debug styles for mobile (remove in production) */
@media (max-width: 480px) {
    .bubblibot-toggle {
        /* Ensure button is always clickable */
        z-index: 10000;
        /* Add subtle shadow to make it more visible */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

/* Prevent background scrolling when mobile chat is open - Enhanced */
body.bubblibot-mobile-open {
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    -webkit-overflow-scrolling: none !important;
}

/* Additional mobile viewport fixes and performance enhancements */
@media (max-width: 480px) {
    /* Ensure proper viewport behavior */
    .bubblibot-widget .bubblibot-window {
        /* Better mobile viewport handling */
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        /* Prevent content overflow */
        overflow: hidden !important;
        /* Performance optimizations */
        -webkit-transform: translate3d(0,0,0) !important;
        transform: translate3d(0,0,0) !important;
        will-change: transform !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
    }
    
    /* Ensure messages area fills available space with performance optimizations */
    .bubblibot-window .bubblibot-messages {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        /* Better mobile scrolling */
        overscroll-behavior: contain !important;
        scroll-behavior: smooth !important;
        /* Performance optimizations */
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        will-change: scroll-position !important;
    }
    
    /* Mobile performance optimizations for all interactive elements */
    .bubblibot-toggle,
    .bubblibot-window .bubblibot-close,
    .bubblibot-window .bubblibot-send {
        /* Hardware acceleration for smooth animations */
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        will-change: transform !important;
    }
    
    /* Smooth scrolling for message content */
    .bubblibot-message-content {
        /* Optimize text rendering */
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        text-rendering: optimizeLegibility !important;
    }
    
    /* Accessibility improvements for mobile */
    .bubblibot-toggle,
    .bubblibot-window .bubblibot-close,
    .bubblibot-window .bubblibot-send {
        /* Ensure proper touch target size for accessibility */
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    /* Focus indicators for accessibility */
    .bubblibot-window .bubblibot-input:focus {
        outline: 2px solid var(--bubblibot-primary-color, #0073aa) !important;
        outline-offset: 2px !important;
    }
}

/* Speech bubble tails */
.bubblibot-user .bubblibot-message-content,
.bubblibot-bot .bubblibot-message-content {
    position: relative;
}

/* User (right aligned) bubble tail */
.bubblibot-user .bubblibot-message-content::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-left: 6px solid var(--bubblibot-primary-color, #0073aa);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Bot (left aligned) bubble tail */
.bubblibot-bot .bubblibot-message-content::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 10px;
    width: 0;
    height: 0;
    border-right: 6px solid #f0f0f0; /* Matches bot message background */
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Adjust tail when avatar is present to align nicely */
.bubblibot-bot.has-avatar .bubblibot-message-content::before {
    left: -12px; /* shift tail slightly left to clear avatar area */
}

/* =====================================================================
   BubbliBot Powered-by line – high specificity overrides (v2)
   Ensures consistent look even when host theme has aggressive global a{} or span{} rules.
   ===================================================================== */

/* Font size override using CSS variable for universal compatibility */
#bubblibot-widget,
#bubblibot-widget * {
    font-size: var(--bubblibot-font-size, 14px) !important;
}

/* Larger close (X) button */
#bubblibot-widget .bubblibot-close {
    font-size: calc(var(--bubblibot-font-size, 14px) * 1.7) !important;
    line-height: 1 !important;
}

/* Mobile-only vertical centering fix for the close (X) button.
   Placed after generic mobile transform rules to ensure it wins in cascade. */
@media (max-width: 480px) {
    #bubblibot-widget .bubblibot-header .bubblibot-close {
        top: 50% !important;
        -webkit-transform: translateY(-50%) translateZ(0) !important;
        transform: translateY(-50%) translateZ(0) !important;
    }
}
