/* Import a clean modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* Color Variables */
:root {
    --bg-gradient: linear-gradient(135deg, #09090b, #18181b, #27272a);
    --glass-bg: rgba(24, 24, 27, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-glow: #00f2fe;
    --primary-color: #4facfe;
    --bot-msg-bg: rgba(39, 39, 42, 0.8);
    --user-msg-bg: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-main);
}

/* The Main Glass Container */
#chat-container {
    width: 100%;
    max-width: 450px;
    height: 85vh;
    max-height: 750px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Ambient glowing orb effect behind the chat */
#chat-container::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: var(--primary-glow);
    filter: blur(100px);
    opacity: 0.2;
    z-index: -1;
}

/* Header & Status Dot */
#chat-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: -webkit-linear-gradient(45deg, var(--primary-glow), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-dot {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Chat Area & Custom Scrollbar */
#chat-box {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#chat-box::-webkit-scrollbar { width: 6px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.1); 
    border-radius: 10px; 
}
#chat-box::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Message Bubbles */
.message {
    padding: 14px 20px;
    border-radius: 20px;
    max-width: 85%;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    opacity: 0;
    animation: fadeInSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.user {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 8px 20px rgba(0, 114, 255, 0.2);
}

.bot {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Animated Typing Indicator (Bouncing Dots) */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 16px 20px;
    align-items: center;
    width: fit-content;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
#input-area {
    display: flex;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
    gap: 12px;
    align-items: center;
}

#user-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 14px 22px;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

#user-input::placeholder { color: var(--text-muted); }

#user-input:focus {
    border-color: rgba(0, 198, 255, 0.5);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 15px rgba(0, 198, 255, 0.15);
}

/* Send Button */
#send-btn {
    background: var(--user-msg-bg);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.3);
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 198, 255, 0.5);
}

#send-btn:active { transform: scale(0.95); }

#send-btn svg { width: 20px; height: 20px; fill: white; margin-left: 2px; }

/* Make it responsive for Mobile */
@media (max-width: 500px) {
    #chat-container { height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
    body { padding: 0; }
}