/* AI Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Button */
.ai-chat-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003366 0%, #0066cc 100%);
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    user-select: none;
    border: none;
    padding: 0;
    position: relative;
}

.ai-chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 51, 102, 0.5);
}

.ai-chat-fab.dragging {
    transition: none;
    cursor: grabbing;
    transform: scale(1.05);
}

.ai-chat-fab svg {
    width: 30px;
    height: 30px;
    fill: #fff;
    transition: transform 0.3s ease;
}

.ai-chat-fab.active svg {
    transform: rotate(90deg);
}

.ai-chat-fab-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.ai-chat-fab-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 102, 204, 0.3);
    animation: ai-pulse 2s infinite;
    pointer-events: none;
}

@keyframes ai-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ai-chat-window.open {
    display: flex;
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #003366 0%, #0066cc 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

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

.ai-chat-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.ai-chat-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
}

.ai-chat-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-close svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
    scroll-behavior: smooth;
}

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

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Message Bubbles */
.ai-chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: ai-msg-appear 0.3s ease;
}

@keyframes ai-msg-appear {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-chat-message.user {
    justify-content: flex-end;
}

.ai-chat-message-bot .ai-chat-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e8eaed;
    border-radius: 18px 18px 18px 4px;
}

.ai-chat-message.user .ai-chat-bubble {
    background: linear-gradient(135deg, #003366 0%, #0066cc 100%);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.ai-chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ai-chat-bubble a {
    color: #0066cc;
    text-decoration: underline;
}

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

.ai-chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    animation: ai-typing 1.4s infinite ease-in-out;
}

.ai-chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ai-typing {
    0%, 60%, 100% { transform: scale(0.7); opacity: 0.5; }
    30% { transform: scale(1); opacity: 1; }
}

/* Quick Suggestions */
.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px;
    background: #f5f7fa;
}

.ai-chat-suggestion {
    background: #fff;
    border: 1px solid #0066cc;
    color: #0066cc;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-chat-suggestion:hover {
    background: #0066cc;
    color: #fff;
}

/* Chat Input */
.ai-chat-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e8eaed;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 40px;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.ai-chat-input:focus {
    border-color: #0066cc;
}

.ai-chat-input::placeholder {
    color: #aaa;
}

.ai-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #003366 0%, #0066cc 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

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

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

.ai-chat-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* Clear History Button */
.ai-chat-clear {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ai-chat-clear:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-chat-fab {
        width: 52px;
        height: 52px;
    }

    .ai-chat-fab svg {
        width: 26px;
        height: 26px;
    }

    .ai-chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        max-height: 600px;
    }

    .ai-chat-bubble {
        max-width: 85%;
        font-size: 13px;
    }

    .ai-chat-suggestion {
        font-size: 12px;
        padding: 5px 12px;
    }
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        border-radius: 12px;
    }

    .ai-chat-header {
        padding: 12px 16px;
    }

    .ai-chat-messages {
        padding: 16px;
    }

    .ai-chat-input-area {
        padding: 10px 12px;
    }
}

/* Position variants */
.ai-chat-widget.bottom-right {
    bottom: 24px;
    right: 24px;
}

.ai-chat-widget.bottom-right .ai-chat-window {
    bottom: 76px;
    right: 0;
}

.ai-chat-widget.bottom-left {
    bottom: 24px;
    left: 24px;
}

.ai-chat-widget.bottom-left .ai-chat-window {
    bottom: 76px;
    left: 0;
}

.ai-chat-widget.top-right {
    top: 90px;
    right: 24px;
}

.ai-chat-widget.top-right .ai-chat-window {
    top: 76px;
    right: 0;
}

.ai-chat-widget.top-left {
    top: 90px;
    left: 24px;
}

.ai-chat-widget.top-left .ai-chat-window {
    top: 76px;
    left: 0;
}
