

/* --- Modern Chatbot Styles --- */

.context-banner {
  position: sticky; top: 0; z-index: 10;
  display: none; align-items: center; gap: 8px;
  padding: 8px 12px; margin-bottom: 8px;
  background: #eef6ff; color: #0b5cab;
  border: 1px solid #b9dcff; border-radius: 8px;
  font-size: 0.9rem; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.context-banner.show { display: flex; animation: fadeSlideIn 180ms ease-out; }
.context-banner .pill {
  background: #d7ebff; border-radius: 999px; font-weight: 600; padding: 2px 8px;
}
.context-banner .close {
  margin-left: auto; border: none; background: transparent; color: inherit;
  cursor: pointer; font-size: 1rem; line-height: 1;
}
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: translateY(0);} }

/* Optional dark mode */
@media (prefers-color-scheme: dark) {
  .context-banner { background: #0f253a; color: #b9dcff; border-color: #275b8f; }
  .context-banner .pill { background: #15304a; }
}


/* It's good practice to add some basic styling for the new button */
.sidebar-nav {
    padding: 10px 20px;
    border-bottom: 4px solid #110606;
    /* Optional: adds a separator */
}

.home-button {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 8px;
    color: #f0f0f0;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.home-button:hover {
    background-color: #e82121;
}

.home-button i {
    margin-right: 12px;
    width: 20px;
    /* To align text with settings labels */
}

/* 1. Root Variables for Easy Theming */
:root {
    --bg-color: #1a1a1d;
    --sidebar-bg: #2c2c31;
    --chat-bg: #212124;
    --message-bg: #4b4b53;
    --user-message-bg: #005fff;
    /* Accent color for user messages and controls */
    --text-color: #e1e1e1;
    --subtle-text-color: #a0a0a0;
    --border-color: #3a3a40;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
}

/* 2. General Body & Layout Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100vh;
    gap: 1rem;
    padding: 1rem;
}

/* 3. Sidebar Styling */
.sidebar {
    background-color: var(--sidebar-bg);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-control label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

/* 4. Chat Area Styling */
.chat-area {
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

#chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Custom Scrollbar for Chat Box */
#chat-box::-webkit-scrollbar {
    width: 6px;
}

#chat-box::-webkit-scrollbar-track {
    background: transparent;
}

#chat-box::-webkit-scrollbar-thumb {
    background-color: var(--message-bg);
    border-radius: 20px;
}

/* 5. Chat Message Styling */
.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
}

.chat-message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--message-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-message .message-content {
    background-color: var(--message-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.user .message-content {
    background-color: var(--user-message-bg);
}

.chat-message.user .avatar {
    background-color: var(--user-message-bg);
}

/* 6. Input Area Styling */
.chat-input-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--sidebar-bg);
    padding: 0.5rem;
    border-radius: var(--border-radius-md);
}

#user-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: none;
    padding: 0.5rem;
    outline: none;
    max-height: 150px;
}

#user-input::placeholder {
    color: var(--subtle-text-color);
}

.chat-input-area button {
    border: none;
    background-color: #3a3a40;
    color: var(--text-color);
    height: 40px;
    width: 40px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    font-size: 1rem;
}

.chat-input-area button:hover,
.chat-input-area button:focus {
    background-color: var(--user-message-bg);
}

.app-info {
    font-size: 0.75rem;
    color: var(--subtle-text-color);
    text-align: center;
    margin-top: 1rem;
}

/* 7. Modern Form Controls (Sliders & Select) */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--chat-bg);
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--user-message-bg);
    cursor: pointer;
    border-radius: 50%;
}

select {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--chat-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 0.9rem;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* 8. Typing Indicator */
#typing-indicator {
    padding: 0 1.5rem;
}

.dot-flashing {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--user-message-bg);
    color: var(--user-message-bg);
    animation: dot-flashing 1s infinite linear alternate;
    animation-delay: .5s;
}

.dot-flashing::before,
.dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
}

.dot-flashing::before {
    left: -15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--user-message-bg);
    color: var(--user-message-bg);
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 0s;
}

.dot-flashing::after {
    left: 15px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--user-message-bg);
    color: var(--user-message-bg);
    animation: dot-flashing 1s infinite alternate;
    animation-delay: 1s;
}

@keyframes dot-flashing {
    0% {
        background-color: var(--user-message-bg);
    }

    50%,
    100% {
        background-color: rgba(0, 95, 255, 0.2);
    }
}

/* Styling for the special AI Chatbot button */
.cta-btn-ai {
    background: linear-gradient(45deg, #007bff, #4e00b3);
    /* Eye-catching gradient */
    color: #fff;
    /* White text for contrast */
    margin-left: 15px;
    /* Adds space between the buttons */
    border: none;
    box-shadow: 0 0 8px rgba(78, 0, 179, 0.7);
    /* Adds a subtle glow */
    animation: pulse-animation 2s infinite;
    /* Applies the pulsing animation */
}

/* Keeps the hover effect consistent */
.cta-btn-ai:hover {
    background: linear-gradient(45deg, #0056b3, #3a008a);
    /* Darker gradient on hover */
    color: #fff !important;
    /* Ensures text stays white */
    border: none;
}

/* Keyframe animation for the pulse effect */
@keyframes pulse-animation {
    0% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(78, 0, 179, 0.7);
    }

    50% {
        transform: scale(1.05);
        /* Button grows slightly */
        box-shadow: 0 0 16px rgba(78, 0, 179, 1);
        /* Glow intensifies */
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(78, 0, 179, 0.7);
    }
}

/* Aligns the icon and text nicely */
.cta-btn-ai i {
    margin-right: 8px;
}

/* --- Mobile Menu & Overlay --- */
.menu-toggle-btn {
    display: none; /* Hidden on desktop */
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    z-index: 1001;
    background: var(--sidebar-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
}

.overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 998;
}

/* Show overlay when sidebar is active */
body.sidebar-visible .overlay {
    display: block;
}


/* --- Responsive Styles for Mobile Devices --- */
@media (max-width: 800px) {
    .app-container {
        /* Switch to a single column layout */
        grid-template-columns: 1fr;
        padding: 0;
        gap: 0;
    }

    /* Make the menu button visible */
    .menu-toggle-btn {
        display: block;
    }

    .sidebar {
        /* Position the sidebar off-screen by default */
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 300px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        border-radius: 0;
    }
    
    /* Show the sidebar when the body has the .sidebar-visible class */
    body.sidebar-visible .sidebar {
        transform: translateX(0);
        box-shadow: 5px 0px 15px rgba(0,0,0,0.2);
    }
    
    .chat-area {
        border-radius: 0;
        height: 100vh; /* Full screen height */
    }

    #chat-box {
        padding: 1.5rem 1rem;
        /* Add padding-top to avoid content hiding behind the menu button */
        padding-top: 5rem;
    }

    .chat-message {
        /* Allow messages to take up more width on smaller screens */
        max-width: 90%;
    }

    .chat-input-container {
        padding: 0.75rem;
    }
    
    /* Make the context banner responsive */
    .context-banner {
        margin: 0.5rem;
        /* Position it below the menu button */
        top: 60px; 
    }
}