/* ============ AI Chat Styles ============ */

/* Floating Chat Button */
.ai-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-glow 2s infinite;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.7);
}

.ai-chat-button.active {
    animation: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.ai-chat-button-icon {
    font-size: 28px;
    transition: transform 0.3s ease;
}

.ai-chat-button.active .ai-chat-button-icon {
    transform: rotate(180deg);
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.8);
    }
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.ai-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.ai-chat-title-group {
    flex: 1;
}

.ai-chat-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.ai-chat-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 2px 0 0;
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

/* Message Bubbles */
.ai-chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: message-slide 0.3s ease;
}

.ai-chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-chat-message.ai {
    align-self: flex-start;
}

@keyframes message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.ai-chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-chat-message.ai .ai-chat-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ai-chat-message.user .ai-chat-message-avatar {
    background: #e2e8f0;
}

.ai-chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-chat-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}

.ai-chat-message.ai .ai-chat-message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-chat-message.user .ai-chat-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

/* Voice Button for AI Messages */
.ai-chat-speak-btn {
    position: absolute;
    bottom: -8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #667eea;
    border: 2px solid white;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0;
}

.ai-chat-message.ai:hover .ai-chat-speak-btn {
    opacity: 1;
}

.ai-chat-speak-btn:hover {
    transform: scale(1.1);
    background: #5a6fd6;
}

.ai-chat-speak-btn.speaking {
    animation: speaking-pulse 0.5s infinite;
}

@keyframes speaking-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* Typing Indicator */
.ai-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    width: fit-content;
}

.ai-chat-typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite;
}

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

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

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

/* Quick Actions */
.ai-chat-quick-actions {
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.ai-chat-quick-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    font-size: 0.8rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.ai-chat-quick-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Chat Input Area */
.ai-chat-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: #667eea;
}

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

.ai-chat-voice-btn,
.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.ai-chat-voice-btn {
    background: #f1f5f9;
    color: #64748b;
}

.ai-chat-voice-btn:hover {
    background: #e2e8f0;
}

.ai-chat-voice-btn.recording {
    background: #ef4444;
    color: white;
    animation: recording-pulse 1s infinite;
}

@keyframes recording-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.ai-chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .ai-chat-button {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .ai-chat-button-icon {
        font-size: 24px;
    }

    .ai-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 60px);
        max-height: none;
        border-radius: 20px 20px 0 0;
    }

    .ai-chat-window.open {
        transform: translateY(0);
    }

    .ai-chat-quick-actions {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}