/* AI Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* Position variations */
.ai-chat-widget[data-position="bottom-right"] {
    bottom: 20px;
    right: 20px;
}

.ai-chat-widget[data-position="bottom-left"] {
    bottom: 20px;
    left: 20px;
}

.ai-chat-widget[data-position="top-right"] {
    top: 20px;
    right: 20px;
}

.ai-chat-widget[data-position="top-left"] {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.ai-chat-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-toggle-btn {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.ai-chat-toggle:hover .ai-chat-toggle-btn {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

.ai-chat-toggle.active .ai-chat-toggle-btn {
    border-radius: 16px;
    transform: scale(0.9);
}

/* Notification Dot */
.ai-chat-notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-dot 2s infinite;
    display: none;
}

@keyframes pulse-dot {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Chat Container */
.ai-chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-chat-container.active {
    display: flex;
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Position adjustments for chat container */
.ai-chat-widget[data-position="bottom-left"] .ai-chat-container,
.ai-chat-widget[data-position="top-left"] .ai-chat-container {
    right: auto;
    left: 0;
}

.ai-chat-widget[data-position="top-right"] .ai-chat-container,
.ai-chat-widget[data-position="top-left"] .ai-chat-container {
    bottom: auto;
    top: 80px;
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
    color: white;
}

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

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.ai-chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-status 2s infinite;
}

@keyframes pulse-status {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.ai-chat-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ai-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

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

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

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}

.ai-chat-message {
    display: flex;
    gap: 10px;
    animation: slideInMessage 0.4s ease-out;
}

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

.ai-chat-message.ai-user-message {
    flex-direction: row-reverse;
}

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

.ai-bot-message .ai-chat-message-avatar {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.ai-user-message .ai-chat-message-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.ai-chat-message-content {
    flex: 1;
    max-width: 80%;
}

.ai-chat-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    position: relative;
}

.ai-bot-message .ai-chat-message-bubble {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1e293b;
    margin-left: 0;
    border-bottom-left-radius: 6px;
}

.ai-user-message .ai-chat-message-bubble {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    margin-right: 0;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ai-chat-message-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    text-align: left;
}

.ai-user-message .ai-chat-message-time {
    text-align: right;
    color: rgba(100, 116, 139, 0.8);
}

/* Typing Indicator */
.ai-chat-typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    animation: slideInMessage 0.4s ease-out;
}

.ai-chat-typing-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-typing-content {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 12px 16px;
    border-radius: 18px 18px 18px 6px;
}

.ai-chat-typing-dots {
    display: flex;
    gap: 3px;
}

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

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

@keyframes typing-dots {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Input Container */
.ai-chat-input-container {
    padding: 20px;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.ai-chat-input-wrapper {
    position: relative;
    display: flex;
    align-items: end;
    gap: 12px;
    background: white;
    border-radius: 24px;
    padding: 12px 16px;
    border: 2px solid rgba(59, 130, 246, 0.1);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ai-chat-input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background: transparent;
    max-height: 100px;
    min-height: 20px;
}

.ai-chat-input::placeholder {
    color: #94a3b8;
}

.ai-chat-send-btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.ai-chat-send-btn:not(:disabled):hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.ai-chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: scale(0.9);
    opacity: 0.6;
}

.ai-chat-send-btn:active {
    transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-chat-widget {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
        top: auto !important;
    }
    
    .ai-chat-container {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 80px;
        right: 0;
        left: 0;
        margin: 0 auto;
        max-width: 400px;
    }
    
    .ai-chat-toggle {
        width: 56px;
        height: 56px;
    }
    
    .ai-chat-messages {
        padding: 15px;
    }
    
    .ai-chat-input-container {
        padding: 15px;
    }
}

/* Animation Classes */
.ai-chat-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.ai-chat-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

/* Custom scrollbar for webkit browsers */
.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Loading state */
.ai-chat-loading .ai-chat-send-btn {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}