/* Modern Floating Chat Widget Styles (Local Preview) */

:root {
    --chat-primary: #007aff;
    --chat-bg: #ffffff;
    --chat-text: #333333;
    --chat-bg-dark: #1a1a1a;
    --chat-text-dark: #f0f0f0;
    --chat-bubble-system: #f0f2f5;
    --chat-bubble-user: #007aff;
}

/* Container for positioning */
#bruno-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Toggle Button */
.chat-toggle-btn {
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.toggle-icon {
    font-size: 20px;
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 70px;
    /* Above the button */
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.85);
    /* Glassmorphism base */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);

    /* Hidden State */
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
    visibility: hidden;
}

.chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
    visibility: visible;
}

/* Dark Mode Support via media query or class */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: rgba(30, 30, 30, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Header */
.chat-header {
    background: var(--chat-primary);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-emoji {
    font-size: 20px;
}

.header-text {
    display: flex;
    flex-direction: column;
}

.bot-name {
    font-weight: 700;
    font-size: 16px;
}

.bot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bot-status::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: #00ff00;
    /* Green dot */
    border-radius: 50%;
}

.close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* Body */
.chat-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar styling */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.message.system {
    background: var(--chat-bubble-system);
    color: #333;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

.message.user {
    background: var(--chat-bubble-user);
    color: white;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
}

#userInput {
    flex-grow: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#userInput:focus {
    border-color: var(--chat-primary);
}

.btn-send {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-send:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .message.system {
        background: #333;
        color: #f0f0f0;
    }

    .chat-input-area {
        background: rgba(0, 0, 0, 0.2);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    #userInput {
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: white;
    }
}