/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.4);
}

.chat-toggle:active {
    transform: scale(0.95);
}

.chat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: all 0.3s ease;
}

.chat-toggle .close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.chat-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

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

.status {
    font-size: 12px;
    opacity: 0.9;
}

.status.online::before {
    content: '●';
    color: #4ade80;
    margin-right: 4px;
}

.minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.minimize-btn svg {
    width: 20px;
    height: 20px;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.bot-message .message-content {
    background: #ffffff;
    color: #374151;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: #10b981;
    color: #ffffff;
    border-bottom-right-radius: 6px;
    font-weight: 500;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    padding: 0 4px;
}

.user-message .message-time {
    text-align: right;
}

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

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 24px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    background: #e5e7eb;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

#chat-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    resize: none;
}

#chat-input::placeholder {
    color: #9ca3af;
}

.send-button {
    width: 36px;
    height: 36px;
    background: #10b981;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.send-button:hover {
    background: #059669;
    transform: scale(1.05);
}

.send-button.active {
    opacity: 1;
}

.send-button svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    margin-top: 8px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }
    
    .chat-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chat-toggle svg {
        width: 24px;
        height: 24px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #1f2937;
    }
    
    .chat-messages {
        background: #111827;
    }
    
    .bot-message .message-content {
        background: #99e4b4;
        color: #f3f4f6;
    }
    
    .user-message .message-content {
        background: #10b981;
        color: #ffffff;
    }
    
    .message-time {
        color: #9ca3af;
    }
    
    .chat-input-container {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .chat-input-wrapper {
        background: #374151;
    }
    
    .chat-input-wrapper:focus-within {
        background: #4b5563;
    }
    
    #chat-input {
        color: #f3f4f6;
    }
    
    #chat-input::placeholder {
        color: #9ca3af;
    }
}