/* Fixed AI Chat Widget for entire website */
.floating-chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body .floating-chat-widget,
html .floating-chat-widget,
* .floating-chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
}

.chat-toggle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chat-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.3s ease;
}

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

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.chat-toggle-btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 8px 24px rgba(102, 126, 234, 0.7), 0 0 0 10px rgba(102, 126, 234, 0.1); }
    100% { box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4); }
}

.floating-chat-box {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99998 !important;
}

.floating-chat-box.active {
    display: flex;
    opacity: 1;
}

.floating-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.floating-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerShine 3s ease-in-out infinite;
}

@keyframes headerShine {
    0%, 100% { transform: translateX(-100%) translateY(-100%); }
    50% { transform: translateX(0) translateY(0); }
}

.floating-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.close-chat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.floating-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.floating-chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

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

.floating-chat-input {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.floating-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    outline: none;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.floating-chat-input input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.floating-chat-input button {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 60px;
}

.floating-chat-input button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.floating-chat-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.floating-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
    position: relative;
}

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

.floating-ai-message {
    background: white;
    color: #2c3e50;
    align-self: flex-start;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: 40px;
    position: relative;
}

.floating-ai-message::before {
    content: '🤖';
    position: absolute;
    left: -35px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.floating-user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    margin-right: 40px;
    position: relative;
}

.floating-user-message::after {
    content: '👤';
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: #28a745;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 18px;
    align-self: flex-start;
    margin-left: 40px;
    color: #6c757d;
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

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

@keyframes typingDots {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.welcome-message {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
    border-bottom: 1px solid #e9ecef;
}

.welcome-message h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 16px;
}

@media (max-width: 768px) {
    .floating-chat-box {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 120px) !important;
        right: 20px !important;
        bottom: 100px !important;
        position: fixed !important;
    }
    
    .floating-chat-widget {
        right: 20px !important;
        bottom: 20px !important;
        position: fixed !important;
    }
}