/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Ensure chat widget is visible */
.chat-widget {
    display: block !important;
}

/* Chat Toggle Button */
.chat-toggle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary, #2563EB);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

/* Chat Container */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: 90vw;
    max-height: 70vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Chat Header */
.chat-header {
    padding: 15px 20px;
    background: var(--primary, #2563EB);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close:hover {
    opacity: 1;
}

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

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
    background: var(--primary, #2563EB);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message-typing {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    border: 1px solid #e9ecef;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out;
}

.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 typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Chat Input */
.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.chat-form .input-group {
    margin-bottom: 10px;
}

.chat-form .form-control {
    border-radius: 20px;
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    font-size: 14px;
}

.chat-form .btn {
    border-radius: 0 20px 20px 0;
    padding: 0 20px;
}

/* Suggestions */
.chat-suggestions {
    margin-top: 10px;
}

.suggestion-btn {
    border-radius: 20px;
    font-size: 12px;
    padding: 4px 12px;
    white-space: nowrap;
    transition: all 0.2s;
}

.suggestion-btn:hover {
    background: var(--primary, #2563EB);
    color: white;
    border-color: var(--primary);
}

/* Responsive Adjustments */
@media (max-width: 576px) {
    .chat-widget {
        right: 15px;
        bottom: 15px;
    }
    
    .chat-container {
        width: 90vw;
        max-height: 80vh;
    }
    
    .message {
        max-width: 90%;
    }
}

/* RTL Support */
[dir="rtl"] .message.user {
    align-self: flex-start;
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 4px;
}

[dir="rtl"] .message.bot {
    align-self: flex-end;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 4px;
}
