/* === FUTURISTIC "AURORA UI" CHATBOT STYLES === */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --aurora-gradient: linear-gradient(-45deg, #0d003b, #4d005f, #87005f, #0d1a4f);
    --glass-background: rgba(15, 12, 41, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #d1d1d1;
    --user-message-bg: #6a5af9;
    --glow-effect: 0 0 20px rgba(106, 90, 249, 0.6);
    --border-radius-main: 24px;
    --border-radius-msg: 18px;
}

/* --- Animated Gradient Background for the entire page --- */
body.chat-open::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 998;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

/* --- Keyframe Animations --- */
@keyframes animated-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes message-in {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Base Chat Elements --- */
#chat-container, #chat-launcher {
    font-family: 'Inter', sans-serif;
}

/* --- Glowing Launcher Orb --- */
#chat-launcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--aurora-gradient);
    background-size: 400% 400%;
    animation: animated-gradient 10s ease infinite;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: var(--glow-effect);
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 1000;
}

#chat-launcher:hover {
    transform: scale(1.15) rotate(15deg);
    box-shadow: 0 0 30px rgba(106, 90, 249, 0.8);
}

#chat-launcher.hidden {
    transform: scale(0);
}

/* --- Glassmorphism Chat Container --- */
#chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 65vh;
    min-height: 500px;
    z-index: 1000;
    
    /* THE GLASS EFFECT */
    background: var(--glass-background);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px); /* For Safari */
    
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-main);
    
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

#chat-container.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* --- Chat Header --- */
#chat-header {
    padding: 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

#close-chat {
    background: none; border: none; color: var(--text-secondary);
    font-size: 24px; cursor: pointer; transition: color 0.2s;
}
#close-chat:hover { color: var(--text-primary); }

/* --- Messages Area --- */
#chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 20px;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    line-height: 1.6;
    padding: 12px 18px;
    animation: message-in 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    transform-origin: bottom left;
}

.bot-message {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border-radius: var(--border-radius-msg) var(--border-radius-msg) var(--border-radius-msg) 5px;
    align-self: flex-start;
}

.user-message {
    background: var(--user-message-bg);
    color: var(--text-primary);
    border-radius: var(--border-radius-msg) var(--border-radius-msg) 5px var(--border-radius-msg);
    align-self: flex-end;
    margin-left: auto;
    box-shadow: var(--glow-effect);
}

/* --- Typing Indicator --- */
.typing-indicator { display: none; } /* We will use the old JS, this is just to prevent errors if it exists in HTML */

/* --- Glowing Input Form --- */
#chat-form {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-top: 1px solid var(--glass-border);
}

#user-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    transition: border-color 0.3s;
}

#user-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#user-input:focus {
    outline: none;
    border-bottom: 1px solid var(--user-message-bg);
}

#chat-form button {
    background: var(--user-message-bg);
    border: none; width: 45px; height: 45px; border-radius: 50%;
    margin-left: 15px; cursor: pointer; display: flex;
    justify-content: center; align-items: center;
    transition: all 0.3s ease;
    box-shadow: var(--glow-effect);
}
#chat-form button:hover {
    transform: scale(1.1) rotate(-15deg);
    box-shadow: 0 0 25px rgba(106, 90, 249, 0.8);
}