/* Premium Chat Widget Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --chat-primary: #0f172a;
    /* Slate 900 */
    --chat-primary-gradient: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    --chat-accent: #3b82f6;
    /* Blue 500 */
    --chat-bg: rgba(255, 255, 255, 0.95);
    --chat-text: #1e293b;
    --chat-text-secondary: #64748b;
    --chat-user-bg: #3b82f6;
    --chat-user-text: #ffffff;
    --chat-bot-bg: #f1f5f9;
    --chat-bot-text: #1e293b;
    --chat-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --chat-radius: 20px;
    --chat-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Floating Button */
#chat-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--chat-primary-gradient);
    color: white;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

#chat-toggle-btn:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.5);
}

/* Chat Window */
#chat-widget {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 400px;
    max-width: 90vw;
    height: 650px;
    max-height: 80vh;
    background: var(--chat-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: var(--chat-font);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-widget.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chat-widget {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
    }

    #chat-toggle-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* Header */
#chat-header {
    padding: 24px;
    background: var(--chat-primary-gradient);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-header h3::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 10px #4ade80;
}

#chat-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
#chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
}

/* Scrollbar */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    animation: messageSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: var(--chat-user-bg);
    color: var(--chat-user-text);
    border-bottom-right-radius: 4px;
    background-image: linear-gradient(135deg, #3b82f6, #2563eb);
}

.message.bot {
    align-self: flex-start;
    background: var(--chat-bot-bg);
    color: var(--chat-bot-text);
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

/* Input Area */
#chat-input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 12px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #f1f5f9;
    border-radius: 30px;
    font-family: var(--chat-font);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

#chat-input:focus {
    border-color: var(--chat-accent);
    background: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#chat-send-btn {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

#chat-send-btn:hover {
    transform: scale(1.05);
    background: #1e293b;
}

#chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    background: var(--chat-bot-bg);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
    border: 1px solid #e2e8f0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}