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

/* Chat Button */
.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-button.active .chat-icon-open {
    display: none;
}

.chat-button .chat-icon-close {
    display: none;
}

.chat-button.active .chat-icon-close {
    display: block;
}

.chat-button.active .chat-icon-open {
    display: none;
}

/* Notification Badge */
.chat-notification {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    animation: pulse-notification 2s ease-in-out infinite;
}

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

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: #1e293b;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    padding: 20px;
    color: white;
    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;
    font-size: 20px;
}

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

.chat-header-info p {
    font-size: 12px;
    margin: 2px 0 0 0;
    opacity: 0.9;
}

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

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

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.7);
}

/* Message Bubble */
.chat-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: slideIn 0.3s ease;
}

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    color: #cbd5e1;
}

.chat-message.bot .message-bubble {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

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

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

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

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

/* Chat Input */
.chat-input-container {
    padding: 16px;
    background: #1e293b;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    background: #0f172a;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #6366f1;
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    padding: 8px;
    outline: none;
    font-family: inherit;
}

.chat-input::placeholder {
    color: #64748b;
}

.chat-send-button {
    background: linear-gradient(135deg, #6366f1 0%, #0ea5e9 100%);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send-button:hover:not(:disabled) {
    transform: scale(1.05);
}

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

.chat-send-button svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Powered By */
.chat-powered {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #64748b;
    background: #1e293b;
}

.chat-powered a {
    color: #6366f1;
    text-decoration: none;
}

.chat-powered a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 16px;
        right: 16px;
    }

    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: -8px;
    }

    .chat-button {
        width: 56px;
        height: 56px;
    }
}

.welcome-message {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.error-message {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #fca5a5 !important;
    
}