/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

:root {
    /* Light Theme Variables */
    --body-bg: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
    --container-bg: rgba(255, 255, 255, 0.9);
    /* Glassy White */
    --chat-bg: transparent;
    /* Let container bg show */
    --text-color: #333;
    --bot-msg-bg: #ffffff;
    --bot-msg-text: #333;
    --user-msg-bg: #6a11cb;
    --user-msg-text: white;
    --input-area-bg: rgba(255, 255, 255, 0.8);
    --input-bg: white;
    --input-border: #ddd;
    --input-text: #333;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    /* Premium diffused shadow */
}

/* Dark Theme Variables */
body.dark-mode {
    --body-bg: linear-gradient(135deg, #121212 0%, #1e1e2e 100%);
    --container-bg: rgba(30, 30, 46, 0.9);
    /* Glassy Dark */
    --chat-bg: transparent;
    --text-color: #e0e0e0;
    --bot-msg-bg: #2a2a36;
    --bot-msg-text: #e0e0e0;
    --user-msg-bg: #6a11cb;
    --user-msg-text: white;
    --input-area-bg: rgba(30, 30, 46, 0.8);
    --input-bg: #2a2a36;
    --input-border: #444;
    --input-text: #e0e0e0;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body {
    background: var(--body-bg);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s, color 0.3s;
}

/* Chat Container */
/* Chat Container */
.chat-container {
    width: 95%;
    max-width: none;
    /* Full screen per user request */
    height: 95vh;
    background: var(--container-bg);
    backdrop-filter: blur(12px);
    /* Premium Glass Effect */
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s, box-shadow 0.3s;
}

/* Make it full screen on small mobile devices */
@media (max-width: 600px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
}

/* Header */
.chat-header {
    background: #6a11cb;
    background: linear-gradient(to right, #6a11cb, #2575fc);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
    /* For positioning theme toggle */
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.chat-header p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* Chat Box (Message Area) */
.chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: background 0.3s;
}

/* Scrollbar styling for a cleaner look */
.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 75%;
    /* Keep messages readable on wide screens */
    padding: 14px 18px;
    border-radius: 18px;
    /* Softer corners */
    font-size: 1rem;
    /* Slightly larger text */
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Subtle lift */
    animation: fadeIn 0.3s ease;
}

/* List Styles within Messages */
.message ul,
.message ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.message li {
    margin-bottom: 5px;
}

/* Bot Message Styles */
.bot-message {
    align-self: flex-start;
    background: var(--bot-msg-bg);
    color: var(--bot-msg-text);
    border: 1px solid rgba(0, 0, 0, 0.1);
    /* Subtle border */
    border-top-left-radius: 2px;
}

/* User Message Styles */
.user-message {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-top-right-radius: 2px;
    box-shadow: 0 2px 5px rgba(106, 17, 203, 0.2);
}

/* Input Area */
.input-area {
    padding: 20px;
    background: var(--input-area-bg);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    transition: background 0.3s;
}

textarea {
    flex: 1;
    padding: 12px;
    background: var(--input-bg);
    color: var(--input-text);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    outline: none;
    resize: none;
    /* Prevent manual resizing */
    height: 44px;
    /* Default height matching previous input */
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.95rem;
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}

textarea:focus {
    border-color: #6a11cb;
    box-shadow: 0 0 5px rgba(106, 17, 203, 0.1);
}



button {
    padding: 10px 20px;
    background: #6a11cb;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

button:hover {
    background: #2575fc;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading/Typing Animation */
.loading-message {
    width: fit-content;
    padding: 15px !important;
}

.loading-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: #888;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}