:root {
    /* Colors */
    --primary-color: #008549;
    /* Slate Blue */
    --accent-color: #1ABC9C;
    /* Teal */
    --bg-color: #F4F7F6;
    /* Off-White */
    --bot-bubble-bg: #FFFFFF;
    --user-bubble-bg: var(--primary-color);
    --bot-text: #2C3E50;
    --user-text: #FFFFFF;
    --error-color: #E74C3C;
    --input-bg: #FFFFFF;
    --border-color: #E0E0E0;

    /* Fonts */
    --font-heading: 'Montserrat', sans-serif;
    --font-heading2: 'Times New Roman', serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--primary-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 420px;
    /* Floating widget standard width */
    height: 100%;
    max-height: 700px;
    background: rgba(255, 255, 255, 0.85);
    /* Glassmorphism base */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    /* Softer, deeper shadow */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #34495E, var(--primary-color));
    /* background-color: var(--primary-color); */
    /* Gradient for premium feel */
    color: white;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.chat-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    /* Just in case, though SVG is shaped */
    background: white;
    /* Optional contrast */
    padding: 2px;
}

.header-info h1 {
    font-family: var(--font-heading2);
    font-size: 1.5rem;
    font-weight: 600;
    
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin-right: 4px;
}

.status-text {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* Chat Area */
.chat-area {
    flex: 1;
    background: #F9F9F9;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: slideUp 0.3s ease-out;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.bot-message .bubble {
    background: var(--bot-bubble-bg);
    color: var(--bot-text);
    border-bottom-left-radius: 2px;
}

.user-message .bubble {
    background: var(--user-bubble-bg);
    color: var(--user-text);
    border-bottom-right-radius: 2px;
}

/* Input Area */
.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#user-input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

#send-btn:hover {
    background: #34495E;
    transform: scale(1.05);
}

/* Animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Specific smoother entry for typing indicator when toggled */
#typing-indicator {
    animation: fadeInFadeOut 0.5s ease-out;
}

@keyframes fadeInFadeOut {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 5px;
    padding: 6px 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    display: block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Full Screen Override */
@media (max-width: 480px) {
    #app {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    body {
        background: #fff;
        /* Blend with app */
    }
}