#bobiai-chat-container {
    position: fixed;
    bottom: 160px;
    left: 20px;
    right: auto;
    width: 340px;
    height: 480px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(224, 224, 224, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}

#bobiai-chat-container.bobiai-visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

#bobiai-launcher {
    position: fixed;
    bottom: 90px;
    left: 20px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0073aa 0%, #005a9c 100%);
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

#bobiai-launcher:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 115, 170, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
}

#bobiai-launcher img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

#bobiai-launcher svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Notification Badge */
#bobiai-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
    animation: bobiai-pulse 2s infinite;
}

@keyframes bobiai-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

#bobiai-chat-container.bobiai-minimized {
    display: none; /* Handled by visibility class now */
}


#bobiai-chat-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a9c 100%);
    color: #fff;
    padding: 12px 16px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#bobiai-chat-header h3 {
    margin: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
}

#bobiai-chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8f9fa 0%, #f0f2f5 100%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

#bobiai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#bobiai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#bobiai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 115, 170, 0.3);
    border-radius: 3px;
}

#bobiai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 115, 170, 0.5);
}

.bobiai-message {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 13px;
    word-wrap: break-word;
    animation: bobiai-message-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bobiai-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bobiai-user-message {
    background: linear-gradient(135deg, #0073aa 0%, #005a9c 100%);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.bobiai-bot-message {
    background-color: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.bobiai-bot-message.error {
    background-color: #ffebee;
    color: #c62828;
}

/* System message style */
.bobiai-bot-message.system {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
    font-style: italic;
    text-align: center;
    border: 1px solid rgba(21, 101, 192, 0.2);
}

/* Markdown Styles within Bot Message */
.bobiai-bot-message p { margin: 0 0 8px 0; }
.bobiai-bot-message p:last-child { margin: 0; }
.bobiai-bot-message ul, .bobiai-bot-message ol { margin: 5px 0 5px 20px; padding: 0; }
.bobiai-bot-message code { background: #f0f0f0; padding: 2px 4px; border-radius: 3px; font-family: monospace; }
.bobiai-bot-message pre { background: #2d2d2d; color: #ccc; padding: 10px; border-radius: 5px; overflow-x: auto; }
.bobiai-bot-message pre code { background: none; color: inherit; padding: 0; }

.bobiai-message-time {
    font-size: 9px;
    opacity: 0.6;
    margin-top: 3px;
    display: block;
}

#bobiai-chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background-color: #fff;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#bobiai-user-input {
    flex: 1;
    padding: 8px 14px;
    border: 2px solid #e8eaed;
    border-radius: 20px;
    outline: none;
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#bobiai-user-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

#bobiai-send-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a9c 100%);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

#bobiai-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
}

#bobiai-send-btn:active {
    transform: translateY(0);
}

.bobiai-upload-btn {
    cursor: pointer;
    font-size: 20px;
    color: #666;
    padding: 0 5px;
}

.bobiai-upload-btn:hover {
    color: #0073aa;
}

#bobiai-image-preview {
    padding: 0 10px 10px 10px;
    background: #fff;
}

.bobiai-preview-item {
    position: relative;
    display: inline-block;
}

.bobiai-preview-item img {
    max-height: 60px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.bobiai-remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    text-align: center;
    line-height: 16px;
    font-size: 12px;
    cursor: pointer;
}

.bobiai-msg-img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
    display: block;
}

/* Typing Indicator */
.bobiai-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.bobiai-typing .dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bobiai-bounce 1.4s infinite ease-in-out both;
}

.bobiai-typing .dot:nth-child(1) { animation-delay: -0.32s; }
.bobiai-typing .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bobiai-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.bobiai-bot-message {
    background-color: #fff;
    border: 1px solid #eee;
    align-self: flex-start;
}

#bobiai-chat-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
}

#bobiai-user-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 5px;
}

#bobiai-send-btn {
    padding: 8px 12px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.bobiai-upload-btn {
    cursor: pointer;
    font-size: 20px;
    margin-right: 5px;
}

#bobiai-image-preview img {
    max-width: 50px;
    max-height: 50px;
    margin: 5px;
    border: 1px solid #ccc;
}

.bobiai-minimized {
    height: 40px !important;
    overflow: hidden;
}
