/* Widget Container */
.bos-chat-widget {
    position: fixed;
    z-index: 10000;
    font-family: "fkGroteskNeue", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

.bos-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.bos-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
.bos-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    
    /* Fallback background image if no icon configured */
    background-size: 65px 65px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Chat icon image styling */
.bos-chat-icon {
    width: 65px;
    height: 65px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    z-index: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    outline: none;
    background: none;
    transition: none;
}

/* Ensure no hover/active/focus effects on the image */
.bos-chat-icon:hover,
.bos-chat-icon:active,
.bos-chat-icon:focus {
    transform: translate(-50%, -50%);
    filter: none;
    opacity: 1;
    outline: none;
    border: none;
}

/* Hide background image when using icon element */
.bos-chat-button:has(.bos-chat-icon) {
    background-image: none;
}

/* Fallback for browsers that don't support :has() */
.bos-chat-button img.bos-chat-icon {
    position: relative;
    z-index: 2;
}

.bos-chat-button img.bos-chat-icon ~ * {
    background-image: none;
}

.bos-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Chat Window */
.bos-chat-window {
    width: 400px;
    height: 650px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
    
    /* FIXED: Absolute height constraints to prevent layout issues */
    position: relative;
    box-sizing: border-box;
}

/* Chat Header */
/*User Info Section for Authenticated Mode Comes under theme*/
.bos-chat-header {
    /*background: linear-gradient(135deg, #0082AB 0%, #478F40 100%);*/
    background: linear-gradient(135deg, #0157FF 0%, #0F3070 100%);
    color: white;
    padding: 20px;
    position: relative;
    z-index: 10;
    flex: none;
    min-height: 80px;
    box-sizing: border-box;
}

.bos-header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding-right: 20px; /* Reduced padding since buttons are now positioned absolutely */
}

.bos-logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.bos-logo-placeholder {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.bos-logo-img {
    width: 68px;
    height: 68px;
    border-radius: 8px;
    object-fit: cover;
}

.bos-poweredbylogo-img {
    width: 40px;
    height: 10px;
    border-radius: 8px;
    object-fit: cover;
    opacity: 1;
    vertical-align: middle;
    margin-left: 4px;
}


.bos-title-section {
    flex: 1;
}

.bos-title {
    margin: 0;
    font-size: 18px;
    font-weight: 450;
    line-height: 1.2;
}

.bos-subtitle {
    margin: 2px 0 0 0;
    font-size: 17px;
    opacity: 0.9;
    font-weight: 300;
    line-height: 1.3;
}

.bos-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: absolute;
    top: 12px;
    right: 12px;
}

.bos-chat-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Fullscreen Button */
.bos-chat-fullscreen {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    position: absolute;
    top: 12px;
    right: 44px; /* Position to the left of close button with 8px gap */
}

.bos-chat-fullscreen:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.bos-chat-fullscreen svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Fullscreen mode styles */
.bos-chat-widget.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999;
}

.bos-chat-widget.fullscreen .bos-chat-window {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    box-shadow: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex !important;
}

.bos-chat-widget.fullscreen .bos-chat-button {
    display: none;
}

.bos-chat-widget.fullscreen .bos-chat-close {
    display: none;
}

/* Chat Content Container - Enhanced Firefox compatibility */
.bos-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 0; /* Allow flex item to shrink */
    
    /* Firefox-specific flex fixes */
    -moz-box-flex: 1;
    -webkit-box-flex: 1;
}

/* Welcome Screen */
.bos-welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

.bos-welcome-main {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    gap: 20px;
}

.bos-welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 40px;
}

.bos-welcome-icon {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

/* AI Logo styling in welcome screen */
.bos-welcome-icon img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 3px solid #e5e7eb;
    transition: all 0.3s ease;
}

.bos-welcome-icon img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.bos-welcome-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #003DA5;
    line-height: 1.3;
    text-align: center;
}

.bos-welcome-subtext {
    margin: 0 0 0 0;
    font-size: 12px;
    color: #A0A7B4;
    line-height: 1.4;
    text-align: center;
}

.bos-faq-section {
    width: 100%;
    padding: 15px 0 0 0;
    margin: 0;
}

.bos-faq-section h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: #003DA5;
    text-align: left;
    width: 100%;
}

.bos-faq-item {
    background: #0061801A;
    /*BOS GPT Requires border*/
    border:1px solid #003DA5;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 13px;
    /*color: #006180;*/
    color: #003DA5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.bos-faq-item:hover {
    background: #e2e8f0;
    border-color: #667eea;
    color: #667eea;
}

.bos-faq-count {
    background: #667eea;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    flex-shrink: 0;
}

.bos-faq-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
    font-size: 13px;
    width: 100%;
}

.bos-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bos-faq-container {
    display: none;
    width: 100%;
}

.bos-faq-error {
    display: none;
    width: 100%;
}

/* Chat Footer */
.bos-chat-footer {
    background: white;
    /*border-top: 1px solid #e5e7eb;*/
    padding: 6px 6px 6px 6px;
    flex-shrink: 0;
    margin-top: auto; /* Ensure footer stays at bottom */
    position: relative;
    z-index: 10;
    height: 75px !important; /* Fixed height */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Disclaimer text above input */
.bos-disclaimer-text {
    font-size: 10px;
    color: #6b7280;
    text-align: center;
    margin-bottom: 6px;
    padding: 0 8px;
    line-height: 1.3;
    font-weight: 400;
}

.bos-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px; /* Add some space between input and powered by */
    flex: 1; /* Take up available space */
}

.bos-voice-button {
   /* background: #f3f4f6;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    width: 40px;*/
    /*background: #D97A26; /* Orange background */
    background: #0156FC;
    border: none; /* Removed border for cleaner look */
    border-radius: 50%; /* Make it circular */
    width: 40px; /* Slightly larger for better touch target */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.2s ease;
}

.bos-voice-button:hover {
    /*background: #b35c1a; /* Slightly darker orange for hover */
    background: #0131B4;
    transform: translateY(-1px);
    /*box-shadow: 0 4px 8px rgba(217, 122, 38, 0.3);*/
    box-shadow: 0 4px 8px rgba(1, 86, 252, 0.3);

}

.bos-voice-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Voice button listening/recording state */
.bos-voice-button.bos-voice-listening {
    /*background: #b35c1a; /* Slightly darker orange for listening state */
    background: #003DA5; /* Match send button blue theme */
    animation: pulse-mic 1.5s infinite;
}
/* Stop icon specific styling */
.bos-voice-button.bos-voice-listening svg rect {
    transition: all 0.2s ease;
}

/* Voice button error state */
.bos-voice-button.bos-voice-error {
    background: #dc2626; /* Red background for error state */
    border-color: #dc2626;
    animation: none; /* Stop any existing animation */
}

.bos-voice-button.bos-voice-error:hover {
    background: #b91c1c; /* Darker red on hover */
    border-color: #b91c1c;
}

/* Stop icon specific styling */
.bos-voice-button.bos-voice-listening svg rect {
    transition: all 0.2s ease;
}

/* Voice button error state */
.bos-voice-button.bos-voice-error {
    background: #dc2626; /* Red background for error state */
    border-color: #dc2626;
    animation: none; /* Stop any existing animation */
}

.bos-voice-button.bos-voice-error:hover {
    background: #b91c1c; /* Darker red on hover */
    border-color: #b91c1c;
}

/*GPT color theme*/
@keyframes pulse-mic {
    0% { 
        box-shadow: 0 0 0 0 rgba(0, 61, 165, 0.7); /* #003DA5 - Blue theme */
    }
    70% { 
        box-shadow: 0 0 0 8px rgba(0, 61, 165, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 61, 165, 0); 
    }
}

/* Input Field Styling */
.bos-chat-input input {
    /*flex: 1;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;*/
    flex: 1;
    padding: 12px 16px; /* Reduced vertical padding */
    border: 1px solid #d1d5db; /* Thinner border */
    border-radius: 25px; /* More rounded */
    font-size: 14px;
    outline: none;
    background: #f8fafc;
    color: #374151;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
    font-weight: 400;
    height: 44px; /* Fixed height to match buttons */
    box-sizing: border-box;
}

.bos-chat-input input:focus {
    /*border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.08);*/
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.bos-chat-input input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

/* Send Button Styling */
.bos-send-button {
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    /*background: #006180;*/
    background: #003DA5;
    border: none;
    /*border-radius: 20px;*/
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.bos-send-button:hover {
    /*background: #00475a;*/ /* Darker shade of #006180 for hover */
    background: 0156FC;
    transform: translateY(-1px);
    /*box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);*/
    box-shadow: 0 4px 8px rgba(8, 145, 178, 0.3);

}

.bos-send-button:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Powered By Footer */
.bos-powered-by {
    text-align: left;
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
    margin: 0;
    padding: 0 12px 6px 12px;
    opacity: 1;
    flex-shrink: 0;
    position: relative;
    background: white;
    z-index: 20;
}

.bos-powered-by strong {
    color: #0891b2; /* Changed to match new theme from 667eea*/
    font-weight: 600;
}

.bos-powered-by-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease;
    opacity: 1;
}

.bos-powered-by-link:hover {
    opacity: 0.8;
}

/* Chat Input Area - Bottom */
.bos-chat-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    position: relative;
    z-index: 10;
}
/* Voice Error Message */
.bos-voice-error-message {
    position: absolute;
    top: -40px;
    right: 0;
    background: #dc2626;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    animation: fadeInError 0.3s ease-out;
    pointer-events: none;
}

.bos-voice-error-message::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 12px;
    border: 4px solid transparent;
    border-top-color: #dc2626;
}

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

/* Messages Container - Enhanced Firefox compatibility */
.bos-chat-messages {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
    flex: 1;
    position: relative;
    min-height: 0; /* Allow flex item to shrink below content size */
    
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    
    /* Better mobile scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    
    /* Ensure proper box model */
    box-sizing: border-box;
    
    /* Firefox-specific scrolling fixes */
    -moz-appearance: none;
    appearance: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) rgba(0, 0, 0, 0.05);
    
    /* Hidden by default - shown when welcome screen is hidden */
    display: none;
}

.bos-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.bos-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.bos-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.bos-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* Message Styling */
.bos-message {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px; /* Increased from 16px for better spacing */
    
    /* CRITICAL: Ensure proper text wrapping - Firefox compatibility */
    word-wrap: break-word;
    overflow-wrap: break-word;
    -moz-hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

.bos-message-user {
    align-self: flex-end;
    align-items: flex-start;
    display: flex;
    flex-direction: row;
    gap: 8px;
    max-width: 75%; /* Reduced from 100% for better chat bubble appearance */
    margin-left: auto; /* Ensure right alignment */
    min-width: 0; /* Allow shrinking */
    overflow: hidden; /* Prevent overflow */
}

.bos-message-assistant {
    align-self: flex-start;
    align-items: flex-start;
    display: flex;
    flex-direction: row;
    gap: 8px;
    max-width: 85%; /* Reduced from 90% to give more space and reduce breaking */
    margin-right: auto; /* Ensure left alignment */
    min-width: 0; /* Allow shrinking */
    overflow: hidden; /* Prevent overflow */
}

.bos-message-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-start;
    order: 2; /* Avatar on the right for user messages */
    margin-top: 3px;
    margin-left: 8px; /* Add space between content and avatar */
}

.bos-message-assistant-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-start;
    order: 1; /* Avatar on the left for assistant messages */
    margin-top: 3px;
    margin-right: 8px; /* Add space between avatar and content */
}

.bos-message-user-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    align-items: flex-end;
    order: 1; /* Content comes before avatar for user messages */
    text-align: right;
    min-width: 0; /* Allow flex item to shrink */
    overflow: hidden; /* Prevent content from breaking out */
}

.bos-message-assistant-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    align-items: flex-start;
    order: 2; /* Content comes after avatar for assistant messages */
    text-align: left;
    min-width: 0; /* Allow flex item to shrink */
    overflow: hidden; /* Prevent content from breaking out */
}

.bos-message-content {
    padding: 20px 24px; /* Increased padding for ChatGPT-like spacing */
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.7; /* Increased line height for better readability */
    
    /* UPDATED: Disable hyphenation and use normal word breaking */
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;
    
    white-space: pre-wrap; /* IMPORTANT: Preserve whitespace and line breaks */
    max-width: 100%;
    min-width: 0; /* Allow flex item to shrink below content size */
    box-sizing: border-box;
    text-align: left; /* Default left alignment for content */
    
    /* Prevent horizontal scrolling */
    overflow-x: hidden;
    overflow-y: visible;
    
    /* Firefox-specific text rendering fixes */
    -moz-text-size-adjust: none;
    text-rendering: optimizeLegibility;
    
    /* Better text spacing */
    letter-spacing: 0.01em; /* Slight letter spacing for readability */
    word-spacing: 0.05em; /* Slight word spacing */
    
    /* ENHANCED: Better handling of HTML content mixed with whitespace */
    white-space: normal; /* Override pre-wrap for HTML content */
    
    /* ChatGPT-like styling */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.bos-message-user .bos-message-content {
    background: #3170dc;
    /*background: #006180;*/
    color: white;
    text-align: left; /* Keep text left-aligned within the bubble */
}

.bos-message-assistant .bos-message-content {
    background: #ffffff; /* Clean white background like ChatGPT */
    border: 1px solid #e5e7eb; /* Subtle border */
    color: #374151; /* Darker text for better readability */
    text-align: left; /* Keep text left-aligned within the bubble */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Handle specific content types that commonly cause overflow */
.bos-message-content a,
.bos-message-content a:visited {
    color: inherit;
    text-decoration: underline;
    word-break: break-all; /* Force break on URLs */
    overflow-wrap: break-word;
}

.bos-message-content code,
.bos-message-content pre {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.08); /* Lighter background for better readability */
    padding: 3px 8px; /* Increased padding */
    border-radius: 6px; /* More rounded corners */
    font-size: 13px; /* Slightly larger font */
    white-space: nowrap; /* Prevent wrapping for inline code */
    overflow-x: auto; /* Enable horizontal scroll */
    display: inline-block;
    max-width: 300px; /* Limit width to prevent layout breaking */
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.15); /* Slightly more visible border */
    color: #d63384; /* Better color for code */
}

/* Specific styling for code blocks (pre tags) */
.bos-message-content pre {
    display: block;
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre; /* Preserve formatting for code blocks */
    line-height: 1.4;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for code elements */
.bos-message-content code::-webkit-scrollbar,
.bos-message-content pre::-webkit-scrollbar {
    height: 4px;
    width: 4px;
}

.bos-message-content code::-webkit-scrollbar-track,
.bos-message-content pre::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.bos-message-content code::-webkit-scrollbar-thumb,
.bos-message-content pre::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.bos-message-content code::-webkit-scrollbar-thumb:hover,
.bos-message-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Handle long tokens, IDs, hashes automatically */
.bos-message-content .bos-long-token {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    overflow-x: auto;
    display: inline-block;
    max-width: 200px; /* Limit width to prevent layout breaking */
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for long tokens */
.bos-message-content .bos-long-token::-webkit-scrollbar {
    height: 4px;
}

.bos-message-content .bos-long-token::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.bos-message-content .bos-long-token::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.bos-message-content .bos-long-token::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}


/* Handle tables if they appear in content */
.bos-message-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

/* Handle images in content */
.bos-message-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 4px 0;
    border-radius: 4px;
}

/* Handle blockquotes */
.bos-message-content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 12px;
    margin: 8px 0;
    font-style: italic;
    color: #666;
}

/* Handle lists and structured content */
.bos-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.bos-message-content li {
    margin: 4px 0;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.bos-message-content p {
    margin: 0.75em 0; /* Increased spacing between paragraphs */
    line-height: 1.7; /* Better line height for readability */
    color: inherit;
}

.bos-message-content p:first-child {
    margin-top: 0;
}

.bos-message-content p:last-child {
    margin-bottom: 0;
}

/* ChatGPT-like list styling */
.bos-message-content ul,
.bos-message-content ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
    line-height: 1.7;
}

.bos-message-content li {
    margin: 0.4em 0; /* Better spacing between list items */
    line-height: 1.6;
}

.bos-message-content ul li {
    list-style-type: disc;
}

.bos-message-content ol li {
    list-style-type: decimal;
}

/* Better spacing for nested lists */
.bos-message-content ul ul,
.bos-message-content ol ol,
.bos-message-content ul ol,
.bos-message-content ol ul {
    margin: 0.3em 0;
}

/* Headings styling */
.bos-message-content h1,
.bos-message-content h2,
.bos-message-content h3,
.bos-message-content h4,
.bos-message-content h5,
.bos-message-content h6 {
    margin: 1em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.4;
}

.bos-message-content h1:first-child,
.bos-message-content h2:first-child,
.bos-message-content h3:first-child,
.bos-message-content h4:first-child,
.bos-message-content h5:first-child,
.bos-message-content h6:first-child {
    margin-top: 0;
}

.bos-message-time {
    font-size: 11px;
    color: #666;
    margin: 0 8px;
}

.bos-message-user .bos-message-time {
    text-align: right;
    margin: 0;
}

.bos-message-assistant .bos-message-time {
    text-align: left;
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bos-chat-window {
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        border-radius: 0;
        z-index: 10000;
    }
    
    .bos-chat-messages {
        /* FIXED: Recalculate for mobile viewport */
        height: calc(100vh - 56px - 72px);
        /* CRITICAL: Better mobile scrolling */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    .bos-chat-widget.bottom-right,
    .bos-chat-widget.bottom-left {
        bottom: 20px;
        right: 20px;
    }
    
    /* Mobile-specific overflow handling */
    .bos-message-user,
    .bos-message-assistant {
        max-width: 95%; /* Increase max width on mobile for better space utilization */
        margin-left: 5px;
        margin-right: 5px;
    }
    
    .bos-message-content {
        font-size: 13px; /* Slightly smaller text on mobile */
        padding: 10px 12px; /* Reduced padding for mobile */
        /* Enhanced word breaking for mobile */
        word-break: break-word;
        overflow-wrap: anywhere; /* More aggressive wrapping on mobile */
    }
    
    /* Handle very long content on mobile */
    .bos-message-content pre,
    .bos-message-content code,
    .bos-message-content .bos-long-token {
        font-size: 11px; /* Smaller code text on mobile */
        max-width: 250px; /* Reduce max width on mobile */
        overflow-x: auto;
        white-space: nowrap; /* Ensure horizontal scroll works */
    }
    
    .bos-message-content pre {
        max-width: 100%; /* Full width for code blocks on mobile */
        white-space: pre; /* Preserve formatting */
    }
    
    /* Mobile-specific powered by footer */
    .bos-powered-by {
        padding: 0 8px 4px 8px;
        font-size: 9px;
        text-align: right;
    }
    
    /* Mobile voice error message positioning */
    .bos-voice-error-message {
        top: -35px;
        right: 8px;
        max-width: 150px;
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Dancing dots animation - Wave motion */
.bos-dancing-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 60px;
    height: 30px;
    margin: 0 auto;
    position: relative;
    overflow: visible;
}

.bos-dancing-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #667eea;
    animation: wave-dance 3s infinite cubic-bezier(0.4, 0, 0.6, 1) both;
    flex-shrink: 0;
    position: relative;
}

.bos-dancing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.bos-dancing-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.bos-dancing-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave-dance {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-10px) scale(1.1);
        opacity: 1;
    }
    50% {
        transform: translateY(0) scale(1.2);
        opacity: 1;
    }
    75% {
        transform: translateY(10px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(0.8);
        opacity: 0.6;
    }
}

/* Dark mode dancing dots */
.bos-chat-widget.dark .bos-dancing-dots .dot {
    background-color: #60a5fa;
}

/* Alternative Layout Support for older browsers */
@supports not (height: calc(500px - 56px - 72px)) {
    .bos-chat-messages {
        height: 372px; /* Fallback: 500 - 56 - 72 */
    }
    
    @media (max-width: 768px) {
        .bos-chat-messages {
            height: calc(100vh - 128px); /* Fallback for mobile */
        }
    }
}

/* Ensure no content gets clipped */
.bos-chat-window * {
    box-sizing: border-box;
}

/* Additional safety measures */
.bos-chat-header,
.bos-chat-input {
    min-height: fit-content;
    position: relative;
}

.bos-chat-messages {
    min-height: 200px; /* Minimum usable height */
}

/* Dark theme support */
.bos-chat-widget.dark .bos-chat-window {
    background: #2d3748;
    border-color: #4a5568;
}

.bos-chat-widget.dark .bos-message-assistant .bos-message-content {
    background: #2d3748; /* Dark card background like ChatGPT dark mode */
    border: 1px solid #4a5568; /* Subtle border */
    color: #e2e8f0; /* Light text */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bos-chat-widget.dark .bos-disclaimer-text {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-chat-input {
    background: #2d3748;
    border-color: #4a5568;
}

.bos-chat-widget.dark .bos-chat-input input {
    background: #374151;
    border-color: #4b5563;
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-chat-input input:focus {
    background: #4b5563;
    border-color: #0891b2;/*#667eea;*/
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.bos-chat-widget.dark .bos-chat-input input::placeholder {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-powered-by {
    color: #9ca3af;
    background: #1f2937;
    text-align: right;
}

.bos-chat-widget.dark .bos-powered-by strong {
    color: #34d399;
}

/* Web Sources and Fallback Indicators */
.bos-fallback-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    font-size: 12px;
    color: #0066cc;
}

.bos-fallback-indicator svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Unified Sources Container */
.bos-sources,
.bos-web-sources {
    margin-top: 8px;
    padding: 8px 0;
    border-top: 1px solid #e1e5e9;
}

.bos-sources-title {
    font-size: 11px;
    font-weight: 600;
    color: #003DA5;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Web Source Links (clickable) */
.bos-source-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #003DA5;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s ease;
}

.bos-source-link:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    color: #1f2937;
}

.bos-source-link svg {
    width: 12px;
    height: 12px;
    opacity: 0.6;
}

/* Web-specific styling */
.bos-web-source {
    border-left: 3px solid #3b82f6;
}

.bos-web-source:hover {
    border-left-color: #1d4ed8;
}

/* Document Source Items */
.bos-document-source {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #10b981;
    color: #003DA5;
    font-size: 12px;
}

/* Clickable document sources (with S3 URLs) */
.bos-document-source.bos-source-link {
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.bos-document-source.bos-source-link:hover {
    background: #f3f4f6;
    border-color: #10b981;
    transform: translateX(2px);
}

/* Unavailable documents */
.bos-document-unavailable {
    opacity: 0.6;
    border-left-color: #9ca3af;
}

.bos-unavailable-text {
    font-style: italic;
    color: #6b7280;
}

/* Dark theme support for new elements */
.bos-chat-widget.dark .bos-fallback-indicator {
    background: #2d3748;
    border-color: #4a5568;
    color: #81c5ff;
}

/* Dark theme support for long tokens */
.bos-chat-widget.dark .bos-message-content .bos-long-token {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-message-content .bos-long-token::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.bos-chat-widget.dark .bos-message-content .bos-long-token::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.bos-chat-widget.dark .bos-message-content .bos-long-token::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.bos-chat-widget.dark .bos-sources,
.bos-chat-widget.dark .bos-web-sources {
    border-top-color: #4a5568;
}

.bos-chat-widget.dark .bos-sources-title {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-source-link {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.bos-chat-widget.dark .bos-source-link:hover {
    background: #4b5563;
    border-color: #6b7280;
    color: #f9fafb;
}

.bos-chat-widget.dark .bos-web-source {
    border-left-color: #60a5fa;
}

.bos-chat-widget.dark .bos-web-source:hover {
    border-left-color: #93c5fd;
}

.bos-chat-widget.dark .bos-document-source {
    background: #374151;
    border-color: #4b5563;
    border-left-color: #34d399;
    color: #e5e7eb;
}

.bos-chat-widget.dark .bos-document-source.bos-source-link:hover {
    background: #4b5563;
    border-color: #34d399;
}

.bos-chat-widget.dark .bos-document-unavailable {
    opacity: 0.5;
    border-left-color: #6b7280;
}

.bos-chat-widget.dark .bos-unavailable-text {
    color: #9ca3af;
}

/* Dark theme voice error message */
.bos-chat-widget.dark .bos-voice-error-message {
    background: #dc2626;
    color: white;
}

.bos-chat-widget.dark .bos-voice-error-message::after {
    border-top-color: #dc2626;
}

.bos-chat-widget.dark .bos-web-sources {
    border-color: #4a5568;
}

.bos-chat-widget.dark .bos-sources-title {
    color: #a0aec0;
}

.bos-chat-widget.dark .bos-source-link {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-source-link:hover {
    background: #4a5568;
    border-color: #718096;
    color: #f7fafc;
}

/* Follow-up Questions */
.bos-follow-up-questions {
    margin-top: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #0157FF;
}

.bos-follow-up-title {
    font-size: 12px;
    font-weight: 600;
    color: #0F3070;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bos-follow-up-question {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    padding: 8px 12px;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    line-height: 1.4;
}

.bos-follow-up-question:hover {
    background: linear-gradient(135deg, #0157FF 0%, #0F3070 100%);
    color: white;
    border-color: #0157FF;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(1, 87, 255, 0.2);
}

.bos-follow-up-question:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(1, 87, 255, 0.3);
}

.bos-follow-up-question:last-child {
    margin-bottom: 0;
}

/* Dark theme support for follow-up questions */
.bos-chat-widget.dark .bos-follow-up-questions {
    background-color: #374151;
    border-left-color: #0157FF;
}

.bos-chat-widget.dark .bos-follow-up-title {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-follow-up-question {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-follow-up-question:hover {
    background: linear-gradient(135deg, #0157FF 0%, #0F3070 100%);
    color: white;
    border-color: #0157FF;
}

/* Enhanced dark theme support for new content elements */
.bos-chat-widget.dark .bos-message-content code,
.bos-chat-widget.dark .bos-message-content pre {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

.bos-chat-widget.dark .bos-message-content pre {
    background: rgba(255, 255, 255, 0.05);
}

.bos-chat-widget.dark .bos-message-content code::-webkit-scrollbar-track,
.bos-chat-widget.dark .bos-message-content pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.bos-chat-widget.dark .bos-message-content code::-webkit-scrollbar-thumb,
.bos-chat-widget.dark .bos-message-content pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.bos-chat-widget.dark .bos-message-content code::-webkit-scrollbar-thumb:hover,
.bos-chat-widget.dark .bos-message-content pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.bos-chat-widget.dark .bos-message-content blockquote {
    border-left-color: #4a5568;
    color: #cbd5e0;
}

.bos-chat-widget.dark .bos-message-content a {
    color: #63b3ed;
}

/* Dark mode list styles */
.bos-chat-widget.dark .bos-message-content ul {
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-message-content li {
    color: #e2e8f0;
}

/* Performance optimization: reduce reflows */
.bos-message-content * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Handle extremely long words (like very long URLs or strings) */
.bos-message-content {
    /* CSS property for extremely long content - less aggressive */
    overflow-wrap: break-word; /* Only break when absolutely necessary */
    /* Fallback for older browsers */
    word-wrap: break-word;
    word-break: normal; /* Don't break words aggressively */
    
    /* Enhanced hyphenation for better text flow */
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    
    /* Hyphenation control */
    hyphenate-limit-chars: 6 3 3;
}

/* Ensure no horizontal scrolling in the chat window */
.bos-chat-window,
.bos-chat-messages,
.bos-message-user,
.bos-message-assistant,
.bos-message-user-content-wrapper,
.bos-message-assistant-content-wrapper {
    overflow-x: hidden;
}

/* Special handling for emoji and special characters */
.bos-message-content {
    /* Prevent emoji from breaking layout */
    font-variant-emoji: text;
    /* Ensure proper line breaking with mixed content */
    line-break: anywhere;
}

/* Accessibility improvements */
.bos-message-content:focus-visible {
    outline: 2px solid #0157FF;
    outline-offset: 2px;
}

/* Skip link styles */
.bos-skip-link:focus {
    position: absolute !important;
    left: 10px !important;
    top: 10px !important;
    width: auto !important;
    height: auto !important;
    padding: 8px !important;
    background: #000 !important;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    z-index: 99999 !important;
}

/* Enhanced focus styles for interactive elements */
.bos-chat-button:focus-visible,
.bos-chat-close:focus-visible,
.bos-chat-fullscreen:focus-visible,
.bos-send-button:focus-visible,
.bos-voice-button:focus-visible {
    outline: 3px solid #0157FF;
    outline-offset: 2px;
}

.bos-chat-input input:focus-visible {
    outline: 3px solid #0157FF;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(1, 87, 255, 0.1);
}

/* FAQ item focus styles */
.bos-faq-item:focus-visible {
    outline: 2px solid #0157FF;
    outline-offset: 2px;
    background: #e2e8f0;
}

/* Feedback button focus styles */
.bos-feedback-btn:focus-visible {
    outline: 2px solid #0157FF;
    outline-offset: 2px;
}

/* High contrast mode support - enhanced */
@media (prefers-contrast: high) {
    .bos-message-content {
        border-width: 2px;
    }
    
    .bos-message-user .bos-message-content {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .bos-message-assistant .bos-message-content {
        background: #fff;
        color: #000;
        border: 2px solid #000;
    }
    
    .bos-chat-button,
    .bos-send-button,
    .bos-voice-button {
        border: 2px solid currentColor;
    }
    
    .bos-faq-item {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bos-chat-button,
    .bos-send-button,
    .bos-voice-button,
    .bos-feedback-btn,
    .bos-faq-item {
        transition: none;
    }
    
    .bos-loading-spinner {
        animation: none;
    }
    
    .bos-voice-button.bos-voice-listening {
        animation: none;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(0deg); }
    }
    
    @keyframes pulse-mic {
        0%, 100% { 
            box-shadow: 0 0 0 0 rgba(0, 61, 165, 0.7);
        }
    }
}

/* Screen reader only content */
.bos-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Ensure sufficient color contrast */
.bos-chat-widget {
    color-scheme: light dark;
}

/* Enhanced keyboard navigation indicators */
.bos-chat-widget *:focus-visible {
    outline: 2px solid #0157FF;
    outline-offset: 2px;
}

/* Ensure interactive elements have minimum touch target size */
@media (pointer: coarse) {
    .bos-chat-button,
    .bos-send-button,
    .bos-voice-button,
    .bos-chat-close,
    .bos-chat-fullscreen,
    .bos-feedback-btn,
    .bos-faq-item {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    .bos-message-content {
        /* Fix Firefox text rendering issues */
        -moz-osx-font-smoothing: grayscale;
        -moz-font-smoothing: antialiased;
        
        /* UPDATED: Disable hyphenation in Firefox */
        word-break: normal !important;
        overflow-wrap: normal !important;
        word-wrap: normal !important;
        
        /* Disable hyphenation completely */
        -moz-hyphens: none !important;
        hyphens: none !important;
        
        /* Use better line breaking algorithm */
        line-break: auto;
        -moz-text-size-adjust: 100%;
        
        /* Fix Firefox flex item sizing */
        min-width: 0;
        max-width: 100%;
        
        /* Better line height for readability */
        line-height: 1.6;
        
        /* Improved spacing */
        padding: 16px 20px;
        letter-spacing: 0.01em;
        word-spacing: 0.05em;
        
        /* Fix white-space handling in Firefox */
        white-space: pre-wrap;
        white-space: -moz-pre-wrap;
        
        /* Better text rendering */
        text-rendering: optimizeLegibility;
        -moz-font-feature-settings: "kern" 1, "liga" 1;
        font-feature-settings: "kern" 1, "liga" 1;
        
        /* Force Firefox to respect word boundaries without hyphens */
        text-align: left;
        text-align-last: left;
        text-justify: none;
    }
    
    .bos-message-user,
    .bos-message-assistant {
        /* Fix Firefox flex layout issues */
        min-width: 0;
        flex-shrink: 1;
    }
    
    .bos-message-user-content-wrapper,
    .bos-message-assistant-content-wrapper {
        /* Ensure proper text wrapping in Firefox */
        min-width: 0;
        word-wrap: normal;
        overflow-wrap: normal;
        word-break: keep-all;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bos-message-content {
        border-width: 2px;
    }
    
    .bos-message-user .bos-message-content {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .bos-message-assistant .bos-message-content {
        background: #fff;
        color: #000;
        border: 2px solid #000;
    }
}

/* Additional safety measures for extreme content */
.bos-message-content table {
    table-layout: fixed;
    width: 100%;
}

.bos-message-content td,
.bos-message-content th {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 0;
}

/* Handle very wide content in iframes or embedded content */
.bos-message-content iframe,
.bos-message-content embed,
.bos-message-content object {
    max-width: 100%;
    height: auto;
}

/* Better text flow with proper hyphenation */
.bos-message-content {
    /* Prefer hyphenation over aggressive word breaking */
    word-break: normal;
    overflow-wrap: break-word;
    /* Use hyphens when breaking words */
    hyphens: auto;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
}

/* Additional Firefox-specific text handling */
@supports (-moz-appearance: none) {
    .bos-message-content {
        /* UPDATED: Disable hyphenation in Firefox */
        word-break: normal;
        overflow-wrap: normal;
        line-break: auto;
        /* Disable hyphenation completely */
        -moz-hyphens: none;
        hyphens: none;
        /* Better text spacing for Firefox */
        text-align: left;
        text-align-last: left;
        text-justify: none;
    }
}

/* Final fallback for any remaining overflow issues */
.bos-chat-widget * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Specific handling for content that might still overflow */
.bos-message-content span,
.bos-message-content div,
.bos-message-content p {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Ensure proper behavior in all browsers - Enhanced Firefox compatibility */
.bos-message-content {
    /* UPDATED: Disable hyphenation across all browsers */
    overflow-wrap: normal; /* Only break when necessary */
    word-break: normal; /* Don't break words aggressively */
    
    /* Safari fallback */
    -webkit-line-break: after-white-space;
    line-break: after-white-space;
    -webkit-hyphens: none; /* Disable hyphenation in Safari */
    
    /* Firefox fallback */
    -moz-word-wrap: normal;
    -moz-hyphens: none; /* Disable hyphenation in Firefox */
    
    /* IE fallback */
    word-wrap: normal;
    -ms-hyphens: none; /* Disable hyphenation in IE */
    
    /* Standard hyphenation - disabled */
    hyphens: none;
    
    /* Ultimate fallback for text wrapping */
    white-space: pre-wrap;
    
    /* Firefox-specific fixes for text rendering */
    -moz-font-feature-settings: "kern" 1;
    font-feature-settings: "kern" 1;
    -moz-font-kerning: normal;
    font-kerning: normal;
    
    /* Prevent Firefox from adding extra spacing */
    -moz-tab-size: 4;
    tab-size: 4;
    
    /* Better text justification */
    text-align: left;
    text-justify: none;
}

/* Event Display Styles */
.bos-event-container {
    background: #f5f5f5;
    border: 1px solid #C1CADC;
    border-radius: 18px;
    padding: 16px;
    margin: 0;
    font-family: inherit;
}

.bos-event-greeting {
    font-size: 14px;
    font-weight: 500;
    color: #151B26;
    margin-bottom: 12px;
    line-height: 1.4;
}

.bos-event-reference {
    margin-bottom: 12px;
    font-size: 12px;
    color: #666;
}

.bos-event-reference-label {
    font-weight: 500;
    margin-right: 8px;
}

.bos-event-reference-link {
    color: #666;
    text-decoration: none;
    word-break: break-all;
    overflow-wrap: break-word;
}

.bos-event-reference-link:hover {
    color: #003DA5;
    text-decoration: underline;
}

.bos-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bos-event-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #e1e5e9;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.bos-event-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.bos-event-date {
    font-size: 13px;
    font-weight: 500;
    color: #151B26;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: normal;
    line-height: 1.4;
}

.bos-event-status-icon {
    font-size: 12px;
    opacity: 0.7;
    flex-shrink: 0;
}

.bos-event-upcoming {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.05) 0%, transparent 100%);
    border-left: 3px solid #22c55e;
}

.bos-event-past {
    background: linear-gradient(90deg, rgba(107, 114, 128, 0.05) 0%, transparent 100%);
    border-left: 3px solid #6b7280;
    opacity: 0.8;
}

.bos-event-name {
    font-size: 14px;
    font-weight: 600;
    color: #151B26;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    white-space: normal;
}

.bos-event-details {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    padding-left: 20px;
    line-height: 1.2;
}

/* Dark theme support for events */
.bos-chat-widget.dark .bos-event-container {
    background: #4a5568;
    border-color: #6b7280;
}

.bos-chat-widget.dark .bos-event-greeting,
.bos-chat-widget.dark .bos-event-date,
.bos-chat-widget.dark .bos-event-name {
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-event-details {
    color: #a0aec0;
}

.bos-chat-widget.dark .bos-event-reference {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-event-reference-link {
    color: #9ca3af;
}

.bos-chat-widget.dark .bos-event-reference-link:hover {
    color: #63b3ed;
}

.bos-chat-widget.dark .bos-event-item {
    border-bottom-color: #6b7280;
}

.bos-chat-widget.dark .bos-event-upcoming {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.1) 0%, transparent 100%);
    border-left-color: #22c55e;
}

.bos-chat-widget.dark .bos-event-past {
    background: linear-gradient(90deg, rgba(107, 114, 128, 0.1) 0%, transparent 100%);
    border-left-color: #6b7280;
}

/* Mobile responsive for events */
@media (max-width: 768px) {
    .bos-event-container {
        padding: 12px;
        margin: 0 4px;
    }
    
    .bos-event-item {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    
    .bos-event-date {
        min-width: auto;
        font-size: 12px;
    }
    
    .bos-event-name {
        text-align: left;
        font-size: 12px;
    }
}

/* Debug helper (can be removed in production) */
/*
.bos-message-content {
    border: 1px dashed red;
    overflow: visible;
}
*/

/* Message Feedback Styles */
.bos-message-feedback {
    margin-top: 12px;
    margin-bottom: 20px; /* Add bottom margin for better spacing with next message */
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align feedback to the right */
    text-align: right;
    margin-left: auto; /* Push the entire feedback section to the right */
    margin-right: 0; /* Override any right margin */
    width: fit-content; /* Only take up necessary width */
    align-self: flex-end; /* Align within the parent container to the right */
}

/* Override parent container alignment for feedback */
.bos-message-assistant-content-wrapper .bos-message-feedback {
    align-self: flex-end !important; /* Force right alignment within assistant content wrapper */
}

.bos-feedback-separator {
    border: none;
    border-top: 1px solid #e1e8ed;
    margin: 8px 0;
    width: 200px; /* Fixed width instead of 100% to maintain right alignment */
    align-self: flex-end; /* Align separator to the right as well */
}

.bos-feedback-question {
    font-size: 13px;
    color: #657786;
    margin-bottom: 8px;
    font-weight: 500;
}

.bos-feedback-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end; /* Align buttons to the right */
}

.bos-feedback-btn {
    background: none;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    outline: none;
    color: #657786;
}

.bos-feedback-btn:hover {
    /*background-color: #f7f9fa;
    border-color: #c1c9d0;*/
    transform: translateY(-1px);
}

.bos-feedback-btn:active {
    transform: translateY(0);
}

.bos-feedback-btn.selected {
    cursor: default;
    transform: none;
    border-color: #c1c9d0;
    background-color: #f7f9fa;
}

.bos-feedback-btn.selected:hover {
    transform: none;
    /*background-color: #f7f9fa;
    border-color: #c1c9d0;*/
}

.bos-feedback-btn:disabled {
    cursor: not-allowed;
}

/* Fullscreen mode mobile enhancements */
@media (max-width: 768px) {
    .bos-chat-widget.fullscreen .bos-chat-header {
        padding: 15px 20px;
        min-height: 70px;
    }
    
    .bos-chat-widget.fullscreen .bos-header-content {
        padding-right: 70px; /* Adjust for smaller buttons on mobile */
    }
    
    .bos-chat-widget.fullscreen .bos-chat-fullscreen,
    .bos-chat-widget.fullscreen .bos-chat-close {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
    
    .bos-chat-widget.fullscreen .bos-chat-fullscreen {
        right: 28px;
    }
    
    .bos-chat-widget.fullscreen .bos-chat-fullscreen svg {
        width: 16px;
        height: 16px;
    }
}

.bos-feedback-thumbs-up.selected {
    background: #0056fc99;
    color: #ffffff;
}

.bos-feedback-thumbs-down.selected {
    background: #0056fc99;
    color: #ffffff;
}

.bos-feedback-icon {
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.bos-feedback-label {
    font-weight: 500;
}

.bos-feedback-message {
    font-size: 12px;
    color: #27ae60;
    font-style: italic;
    margin-top: 8px;
    padding: 4px 8px;
    background-color: #f0f8f0;
    border-radius: 4px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure feedback buttons work well on mobile */
@media (max-width: 480px) {
    .bos-feedback-btn {
        padding: 8px 14px;
        font-size: 14px;
        gap: 8px;
    }
    
    .bos-feedback-buttons {
        gap: 12px;
    }
    
    .bos-feedback-question {
        font-size: 14px;
        margin-bottom: 10px;
    }
}

/* Microphone Help Dialog */
.bos-microphone-help-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    animation: slideInDialog 0.3s ease-out;
}

.bos-mic-help-content {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    /* Add bottom padding to prevent content from being cut off */
    padding-bottom: 12px;
}

.bos-mic-help-icon {
    font-size: 40px;
    text-align: center;
    margin-bottom: 12px;
}

.bos-mic-help-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    text-align: center;
}

.bos-mic-help-description {
    margin: 0 0 12px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #4a5568;
    text-align: center;
}

.bos-mic-suggestions {
    background: #f7fafc;
    border-left: 3px solid #4299e1;
    padding: 10px 12px;
    margin: 12px 0;
    border-radius: 6px;
}

.bos-mic-suggestions strong {
    display: block;
    margin-bottom: 6px;
    color: #2d3748;
    font-size: 13px;
}

.bos-mic-suggestions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bos-mic-suggestions li {
    padding: 3px 0;
    color: #2d3748;
    font-size: 12px;
}

.bos-mic-help-steps {
    background: #fff5f5;
    border-left: 3px solid #f56565;
    padding: 10px 12px;
    margin: 12px 0;
    border-radius: 6px;
}

.bos-mic-help-steps strong {
    display: block;
    margin-bottom: 6px;
    color: #c53030;
    font-size: 13px;
}

.bos-mic-help-steps ol {
    margin: 0;
    padding-left: 18px;
}

.bos-mic-help-steps li {
    padding: 3px 0;
    color: #2d3748;
    font-size: 12px;
    line-height: 1.4;
}

.bos-mic-help-actions {
    text-align: center;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    background: white;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.bos-mic-help-close {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bos-mic-help-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.bos-mic-help-close:active {
    transform: translateY(0);
}

@keyframes slideInDialog {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Dark theme support for microphone help dialog */
.bos-chat-widget.dark .bos-microphone-help-dialog {
    background: #2d3748;
}

.bos-chat-widget.dark .bos-mic-help-title {
    color: #f7fafc;
}

.bos-chat-widget.dark .bos-mic-help-description {
    color: #cbd5e0;
}

.bos-chat-widget.dark .bos-mic-suggestions {
    background: #1a202c;
    border-left-color: #63b3ed;
}

.bos-chat-widget.dark .bos-mic-suggestions strong,
.bos-chat-widget.dark .bos-mic-suggestions li {
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-mic-help-steps {
    background: #2d1b1b;
    border-left-color: #fc8181;
}

.bos-chat-widget.dark .bos-mic-help-steps strong {
    color: #fc8181;
}

.bos-chat-widget.dark .bos-mic-help-steps li {
    color: #e2e8f0;
}

.bos-chat-widget.dark .bos-mic-help-actions {
    background: #2d3748;
    border-top-color: #4a5568;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .bos-microphone-help-dialog {
        width: 95%;
        max-width: none;
        max-height: 75vh;
    }
    
    .bos-mic-help-content {
        padding: 16px;
        padding-bottom: 12px;
    }
    
    .bos-mic-help-actions {
        padding: 12px 16px;
    }
    
    .bos-mic-help-icon {
        font-size: 36px;
    }
    
    .bos-mic-help-title {
        font-size: 18px;
    }
    
    .bos-mic-help-description,
    .bos-mic-suggestions strong,
    .bos-mic-help-steps strong {
        font-size: 13px;
    }
    
    .bos-mic-suggestions li,
    .bos-mic-help-steps li {
        font-size: 12px;
    }
}

/* ===================================================================
   HIGH-DPI & WINDOWS ZOOM SCALING FIX
   Handles Windows display scaling (125%, 150%, 175%, 200%)
   =================================================================== */

/* Detect high-DPI displays and apply appropriate scaling */
@media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
    .bos-chat-widget {
        /* Use transform-origin to scale from bottom-right corner */
        transform-origin: bottom right;
    }
    
    .bos-chat-widget.bottom-left {
        transform-origin: bottom left;
    }
}

/* Windows 125% scaling (1.25x) */
@media (-webkit-min-device-pixel-ratio: 1.25) and (-webkit-max-device-pixel-ratio: 1.49),
       (min-resolution: 120dpi) and (max-resolution: 143dpi) {
    .bos-chat-widget {
        zoom: 0.85;
        -moz-transform: scale(0.85);
        -moz-transform-origin: bottom right;
    }
    
    .bos-chat-widget.bottom-left {
        -moz-transform-origin: bottom left;
    }
}

/* Windows 150% scaling (1.5x) - Most Common Issue */
@media (-webkit-min-device-pixel-ratio: 1.5) and (-webkit-max-device-pixel-ratio: 1.74),
       (min-resolution: 144dpi) and (max-resolution: 167dpi) {
    .bos-chat-widget {
        zoom: 0.72;
        -moz-transform: scale(0.72);
        -moz-transform-origin: bottom right;
    }
    
    .bos-chat-widget.bottom-left {
        -moz-transform-origin: bottom left;
    }
    
    /* Adjust font rendering for better clarity */
    .bos-chat-widget * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Windows 175% scaling (1.75x) */
@media (-webkit-min-device-pixel-ratio: 1.75) and (-webkit-max-device-pixel-ratio: 1.99),
       (min-resolution: 168dpi) and (max-resolution: 191dpi) {
    .bos-chat-widget {
        zoom: 0.62;
        -moz-transform: scale(0.62);
        -moz-transform-origin: bottom right;
    }
    
    .bos-chat-widget.bottom-left {
        -moz-transform-origin: bottom left;
    }
}

/* Windows 200% scaling (2x) */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    .bos-chat-widget {
        zoom: 0.55;
        -moz-transform: scale(0.55);
        -moz-transform-origin: bottom right;
    }
    
    .bos-chat-widget.bottom-left {
        -moz-transform-origin: bottom left;
    }
}

/* Ensure widget doesn't overflow on small screens with high DPI */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1.5),
       (max-width: 768px) and (min-resolution: 144dpi) {
    .bos-chat-widget {
        /* On mobile with high DPI, use slightly less aggressive scaling */
        zoom: 0.8 !important;
        -moz-transform: scale(0.8) !important;
    }
    
    .bos-chat-window {
        max-width: 95vw;
        max-height: 90vh;
    }
}

/* Alternative approach for browsers that don't support zoom properly */
@supports not (zoom: 0.72) {
    @media (-webkit-min-device-pixel-ratio: 1.5),
           (min-resolution: 144dpi) {
        .bos-chat-widget {
            transform: scale(0.72);
            transform-origin: bottom right;
        }
        
        .bos-chat-widget.bottom-left {
            transform-origin: bottom left;
        }
        
        /* Adjust positioning to account for scale */
        .bos-chat-widget.bottom-right {
            right: calc(20px - (400px * 0.28 / 2));
            bottom: calc(20px - (650px * 0.28 / 2));
        }
        
        .bos-chat-widget.bottom-left {
            left: calc(20px - (400px * 0.28 / 2));
            bottom: calc(20px - (650px * 0.28 / 2));
        }
    }
}

/* Improve text rendering at different zoom levels */
@media (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
    .bos-message-content,
    .bos-chat-input input,
    .bos-disclaimer-text,
    .bos-powered-by {
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Ensure icons remain crisp */
    .bos-chat-button img,
    .bos-voice-button svg,
    .bos-send-button img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Fix for fullscreen mode with high DPI */
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
    .bos-chat-widget.fullscreen {
        /* Fullscreen should not be scaled */
        zoom: 1 !important;
        transform: none !important;
    }
    
    .bos-chat-widget.fullscreen .bos-chat-window {
        /* Ensure proper sizing in fullscreen */
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
    }
}