/* === AI Chatbot Widget === */

/* Chat Bubble - Floating Button */
.chat-bubble {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: chatPulse 3s ease-in-out infinite;
}

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

.chat-bubble svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}

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

@keyframes chatPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(102, 126, 234, 0.7), 0 0 60px rgba(102, 126, 234, 0.2); }
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 175px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(102, 126, 234, 0.1);
}

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

/* Chat Header */
.chat-header {
    padding: 16px 20px;
    background: rgba(15, 20, 40, 0.9);
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chat-header-text h4 {
    margin: 0;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.chat-header-text span {
    font-size: 11px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-header-text span::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.chat-header-actions button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: color 0.2s;
    line-height: 1;
}

.chat-header-actions button:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

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

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

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

/* Message Bubbles */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msgFadeIn 0.3s ease;
}

.chat-msg.bot {
    align-self: flex-start;
    background: rgba(30, 40, 70, 0.8);
    border: 1px solid rgba(102, 126, 234, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 4px;
}

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

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    padding: 12px 16px;
    background: rgba(30, 40, 70, 0.8);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.6);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    background: rgba(10, 15, 30, 0.6);
}

.chat-input {
    flex: 1;
    background: rgba(20, 30, 60, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    padding: 10px 14px;
    color: white;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    min-height: 20px;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.chat-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

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

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 20px);
        height: calc(100vh - 160px);
        right: 10px;
        bottom: 90px;
        border-radius: 16px;
    }

    .chat-bubble {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
}
