/* ============================================================
   AI CHAT WIDGET STYLES
   ============================================================ */

/* Chat Floating Button */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
    z-index: 999;
    font-size: 24px;
    border: none;
}

.chat-fab:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.5);
}

.chat-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    animation: pulse-badge 2s infinite;
}

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

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px;
    max-width: 92vw;
    height: 580px;
    max-height: 80vh;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-widget.open {
    display: flex;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

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

.chat-header-info i {
    font-size: 24px;
    color: #7c3aed;
}

.chat-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    display: block;
}

.chat-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.chat-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 90%;
    animation: messageIn 0.3s ease;
}

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

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

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

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
}

.chat-message.user .message-avatar {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    word-wrap: break-word;
    max-width: 100%;
}

.chat-message.bot .message-bubble {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-bubble p {
    margin: 0 0 4px 0;
}

.message-bubble ul {
    margin: 6px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin-bottom: 2px;
}

.message-bubble code {
    background: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    display: inline-block;
}

.message-bubble pre {
    background: var(--bg-dark);
    padding: 10px 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
    margin: 6px 0;
    border: 1px solid var(--border-color);
}

.message-bubble pre code {
    background: none;
    padding: 0;
}

.message-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: block;
}

/* Quick Actions */
.chat-quick-actions {
    padding: 8px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-dark);
}

.quick-btn {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 16px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--text-primary);
}

/* Chat Input */
.chat-input-area {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-dark);
}

.chat-typing {
    display: none;
    align-items: center;
    padding: 4px 8px 8px 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.chat-typing.active {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
    animation: typingDot 1.4s infinite both;
    margin: 0 2px;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.chat-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.chat-input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

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

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 80px;
        right: 8px;
        width: calc(100vw - 16px);
        height: 70vh;
        max-height: 70vh;
        border-radius: 12px;
    }
    
    .chat-fab {
        width: 52px;
        height: 52px;
        font-size: 20px;
        bottom: 16px;
        right: 16px;
    }
    
    .message-bubble {
        font-size: 12px;
    }
    
    .chat-quick-actions {
        gap: 4px;
    }
    
    .quick-btn {
        font-size: 10px;
        padding: 3px 10px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 70px;
        height: 75vh;
        max-height: 75vh;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-messages {
        padding: 12px 14px;
    }
    
    .chat-input-area {
        padding: 8px 12px 12px;
    }
}