/* AI Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-color, #06adcc), var(--primary-color, #0056b3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s 
ease;
    position: relative;
    display: none;
}

.ai-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.ai-chat-button i {
    color: white;
    font-size: 24px;
}

.ai-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* Chat Window */
.ai-chat-window {
    display: none;
    flex-direction: column;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, var(--accent-color, #06adcc), var(--primary-color, #0056b3));
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-header-info i {
    font-size: 20px;
}

.ai-chat-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.ai-chat-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.ai-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.ai-chat-message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* AI Messages */
.ai-message-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-color, #06adcc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-message-content {
    flex: 1;
    background: white;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: relative;
}

.ai-message-text {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

.ai-message-text a {
    color: var(--accent-color, #06adcc);
    text-decoration: none;
}

.ai-message-text a:hover {
    text-decoration: underline;
}

.ai-message-fallback {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* User Messages */
.user-message-content {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.user-message-text {
    background: var(--accent-color, #06adcc);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Input Area */
.ai-chat-input-area {
    border-top: 1px solid #e9ecef;
    background: white;
    padding: 16px;
}

.ai-chat-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: var(--accent-color, #06adcc);
    box-shadow: 0 0 0 2px rgba(6, 173, 204, 0.25);
}

.ai-chat-send {
    width: 36px;
    height: 36px;
    background: var(--accent-color, #06adcc);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-send:hover {
    background: var(--primary-color, #0056b3);
}

.ai-chat-send i {
    font-size: 14px;
}

/* Typing Indicator */
.ai-chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: #666;
    font-size: 12px;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-typing-dots span {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .ai-chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 75px;
        right: -15px;
    }

    .ai-chat-messages {
        padding: 12px;
    }

    .ai-chat-input-area {
        padding: 12px;
    }
}

/* RTL Support */
[dir="rtl"] .ai-chat-header-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .ai-message-content {
    border-radius: 18px 4px 18px 18px;
}

[dir="rtl"] .user-message-text {
    border-radius: 18px 18px 18px 4px;
}

[dir="rtl"] .ai-chat-input-container {
    flex-direction: row-reverse;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .ai-chat-window {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .ai-chat-messages {
        background: #2d2d2d;
    }

    .ai-message-content {
        background: #3d3d3d;
        color: #e9ecef;
    }

    .ai-chat-input {
        background: #2d2d2d;
        border-color: #495057;
        color: #e9ecef;
    }

    .ai-chat-input:focus {
        border-color: var(--accent-color, #06adcc);
    }
}

/* Animation for opening/closing */
.ai-chat-window {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}