/* General Body and Font Styles */
html, body {
    height: 100%; /* Make html and body take full viewport height */
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent overall body scroll; individual areas will scroll */
    font-family: 'Inter', sans-serif !important; /* Force Inter font with !important */
}

body {
    background-color: #f0f2f5; /* Light grey background */
    color: #333; /* Darker text for readability */
    line-height: 1.6; /* Good line spacing for readability */
    display: flex;
    flex-direction: column; /* Stack header, main content, and footer (input) vertically */
    height: 100vh; /* Explicitly ensure body fills viewport */
}

/* --- Header Styling (for chat page, but kept here) --- */
header {
    background-color: #E0F2F7; /* Very Light Blue (A light shade of cyan-blue) */
    color: #333; /* Changed text color to dark for contrast on light background */
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Prevent header from shrinking */
    z-index: 1000;
}

/* Style for the header logo (for chat page) */
.header-logo {
    height: 40px; /* Adjust height as needed */
    width: auto;
    margin-right: 1rem; /* Space between logo and other elements */
}

header h1 { /* Keep this rule if you still have an H1, otherwise remove. */
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

header nav {
    flex-grow: 1; /* Allows nav to take available space */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Distribute items */
    gap: 1rem; /* Space between nav items */
}

/* Welcome message in header - Centered within the available space */
header nav .welcome-message-header {
    flex-grow: 1; /* Allows it to take all central space */
    text-align: center; /* Centers its own text */
    color: #333; /* Changed text color to dark for contrast on light background */
    font-weight: 600;
    font-size: 1.1rem;
}

/* Header buttons (Logout, API Key) - Grouped on the right */
header nav .header-button-group {
    display: flex;
    gap: 0.5rem; /* Space between buttons */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

header nav a,
header nav button {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem; /* Rounded corners */
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    border: none;
    /* Ensure button text is readable on light background */
    color: white; /* Default to white, will be overridden by specific button colors */
}

header nav a:hover,
header nav button:hover {
    transform: translateY(-1px); /* Slight lift on hover */
    opacity: 0.9;
}

/* Logout button specific styling */
header nav a[href*="logout"] {
    background-color: #dc3545; /* Red for logout */
    color: white;
}
header nav a[href*="logout"]:hover {
    background-color: #c82333;
}
/* Manage API Key button styling on light background */
#manageApiKeyBtn {
    background-color: #007bff; /* Keep blue for consistency or change to another color */
    color: white;
}
#manageApiKeyBtn:hover {
    background-color: #0056b3;
}


/* Flash Messages (for chat page) */
.flashes {
    list-style: none;
    padding: 1rem;
    margin: 0.25rem auto 0.25rem auto; /* Center with minimal vertical margin */
    width: 100%;
    max-width: 800px; /* Limit width */
    border-radius: 0.5rem;
    font-weight: 500;
    text-align: center;
    flex-shrink: 0; /* Prevent flashes from shrinking */
}

.flashes li {
    margin-bottom: 0.5rem;
}

.flashes li.success { background-color: #4CAF50; color: white; } /* Green */
.flashes li.danger { background-color: #f44336; color: white; } /* Red */
.flashes li.warning { background-color: #ff9800; color: white; } /* Orange */
.flashes li.info { background-color: #2196F3; color: white; } /* Blue */

/* --- Main Chat Layout (for chat page) --- */
.chat-layout {
    display: flex;
    flex: 1; /* Allows this main section to grow and fill remaining vertical space */
    padding: 1.5rem; /* Internal padding */
    gap: 1.5rem; /* Space between columns (sidebars, chat-main) */
    max-width: 1400px;
    margin: 0.5rem auto 1.5rem auto; /* Center, with space above prompt bar */
    align-items: stretch; /* Make children stretch to fill container height */
    overflow: hidden; /* Prevents outer scrollbar on this container */
}

/* Sidebars */
.sidebar {
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0; /* Prevents sidebars from shrinking initially */
    display: flex;
    flex-direction: column;
    height: 100%; /* Take full height of parent .chat-layout */
    overflow-y: hidden; /* Hide scrollbar for the whole sidebar itself */
}

.left-sidebar {
    width: 250px; /* Fixed width for left sidebar */
}

.right-sidebar {
    width: 200px; /* Fixed width for right sidebar */
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Stack sections vertically */
    justify-content: flex-start; /* Align content to the top */
    overflow-y: auto; /* Allow scrolling for content if needed */
}

.sidebar h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4a00e0;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0; /* Prevent heading from shrinking */
}

/* New: Sidebar section styling */
.sidebar-section {
    margin-bottom: 1.5rem; /* Space between sections in the right sidebar */
}

/* New: Styling for Tools and Quick Clicks lists */
#tools-list, #quick-clicks-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Use flexbox for button layout */
    flex-direction: column; /* Stack buttons vertically */
    gap: 0.75rem; /* Space between buttons */
}

.tool-btn, .quick-click-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none; /* For tool links */
    display: block; /* Ensure full width for anchors and buttons */
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid #d4c4f7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tool-btn {
    background-color: #4a00e0; /* Blue-purple for tools */
    color: white;
}
.tool-btn:hover {
    background-color: #3b00c0;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.quick-click-btn {
    background-color: #e6e6fa; /* Light lavender for quick clicks */
    color: #4a00e0;
}
.quick-click-btn:hover {
    background-color: #d0c0f0;
    border-color: #4a00e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


/* Chat History List (Left Sidebar) - THIS IS THE SCROLLABLE PART OF THE SIDEBAR */
#chat-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1; /* Allows history list to take available space and push button down */
    overflow-y: auto; /* Only history list content scrolls */
    padding-right: 5px; /* Space for scrollbar */
}

.history-date-group {
    margin-bottom: 1rem;
}

.history-date-header {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #eee;
    padding-bottom: 0.25rem;
}

.history-item {
    font-size: 0.9rem;
    padding: 0.5rem 0;
    cursor: pointer;
    color: #555;
    transition: background-color 0.2s ease;
    border-radius: 0.375rem;
}

.history-item:hover {
    background-color: #f0f2f5;
}

.no-history-message {
    font-style: italic;
    color: #888;
    text-align: center;
    padding: 1rem;
}

/* Clear Chat History Button */
#clearChatHistoryBtn {
    background-color: #dc3545; /* Red */
    color: white;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    width: 100%; /* Make it full width in sidebar */
    margin-top: 1rem; /* Space from history list */
    font-size: 0.95rem;
    flex-shrink: 0; /* Prevent button from shrinking */
}

#clearChatHistoryBtn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

#clearChatHistoryBtn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}


/* Main Chat Area */
.chat-main {
    flex-grow: 1; /* Takes up remaining space in .chat-layout */
    display: flex;
    flex-direction: column; /* Stack chat history and welcome message vertically */
    background-color: #ffffff;
    padding: 1.5rem; /* Padding for the entire chat main area */
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 100%; /* Crucial: Make it fill the parent's height */
}


/* Add this to your existing <style> block */
.summarizer-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    min-height: calc(100vh - 4rem); /* Ensure it's at least the height of the viewport */
    display: flex;
    flex-direction: column;
}


/* Add these styles to your existing <style> block */
.custom-audio-player {
    background-color: #f3f4f6;
    border-radius: 5px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: none; /* Initially hidden, shown when audio is ready */
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.play-pause-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.play-pause-btn:hover {
    background-color: #2563eb;
}

.progress-bar-container {
    flex-grow: 1;
    background-color: #d1d5db;
    height: 8px;
    border-radius: 4px;
    cursor: pointer;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #3b82f6;
    border-radius: 4px;
}

.time-display {
    font-size: 0.9rem;
    color: #4b5563;
    min-width: 35px;
}


/* Prominent Welcome Message */
.prominent-welcome {
    text-align: center;
    font-size: 2.2rem; /* Larger font size */
    font-weight: 700;
    color: #4a00e0; /* A distinct color */
    margin-bottom: 2rem; /* More space below */
    padding: 1.5rem;
    background-color: #e6e6fa; /* Light lavender */
    border-radius: 0.75rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transition: opacity 1s ease-out; /* Smooth fade-out */
    opacity: 1; /* Start visible */
    flex-shrink: 0; /* Prevent shrinking */
}

.prominent-welcome.hidden-fade {
    opacity: 0;
    pointer-events: none; /* Make it unclickable when hidden */
}

.welcome-username {
    color: #007bff; /* Bright blue for username */
    font-weight: 800; /* Extra bold */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1); /* Subtle shadow */
}

/* Chat History Display Area - THIS IS THE PRIMARY SCROLLABLE CONTENT AREA */
.chat-history {
    flex-grow: 1; /* Allows chat messages to take up available space */
    overflow-y: auto; /* THIS IS WHERE THE SCROLLBAR FOR MESSAGES WILL APPEAR */
    padding-right: 10px; /* Space for scrollbar */
    padding-bottom: 0; /* No padding-bottom here, parent .chat-main handles it */
}

/* Individual Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 1rem; /* Space between messages */
    align-items: flex-start; /* Align bubbles to the top of the line for clearer flow */
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.ai {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 0.8rem 1.2rem;
    border-radius: 1.2rem; /* More rounded bubbles */
    /* IMPORTANT: Force Inter font for all text inside the bubble that isn't MathJax-generated math */
    font-family: 'Inter', sans-serif !important; 
    font-size: 1rem; /* Standard text size for chat bubbles */
    line-height: 1.5; /* Good line spacing for readability */
    word-wrap: break-word; /* Ensure long words break */
    white-space: pre-wrap; /* Preserves whitespace and line breaks */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user .message-bubble {
    background-color: #4a00e0; /* User message color */
    color: white;
    border-bottom-right-radius: 0.2rem; /* Pointy corner for user */
}

.chat-message.ai .message-bubble {
    background-color: #e0e0e0; /* AI message color */
    color: #333;
    border-bottom-left-radius: 0.2rem; /* Pointy corner for AI */
}

/* Loading Indicator */
.loading-dots {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    animation: loading-dots 1s steps(3, end) infinite;
    font-weight: bold;
}

@keyframes loading-dots {
    0% { width: 0%; }
    33% { width: .5em; } /* one dot */
    66% { width: 1em; } /* two dots */
    100% { width: 1.5em; } /* three dots */
}

/* Chat Input Area (Mimicking Gemini's Prompt Bar) */
.chat-input-area-container {
    flex-shrink: 0; /* Prevent container from shrinking */
    padding: 0 1.5rem 1.5rem 1.5rem; /* Padding around the bar to create space from viewport bottom/sides */
}

.chat-input-area {
    display: flex;
    align-items: center; /* Vertically center items (buttons, textarea) */
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background-color: #E0F2F7; /* Matched light blue header color */
    border-radius: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    border: 1px solid #B0E0E6; /* Lighter border to match light background */
}

#user-message-input {
    flex-grow: 1;
    min-height: 48px;
    max-height: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 1.5rem;
    resize: none;
    font-size: 1rem;
    line-height: 1.5;
    overflow-y: auto;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: white;
}

#user-message-input:focus {
    outline: none;
    border-color: #4a00e0;
    box-shadow: 0 0 0 3px rgba(74, 0, 224, 0.2);
}

#send-message-btn,
#uploadFileBtn {
    background-color: #4a00e0;
    color: white;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#send-message-btn:hover,
#uploadFileBtn:hover {
    background-color: #3b00c0;
    transform: translateY(-1px);
}

#send-message-btn:disabled,
#uploadFileBtn:disabled {
    background-color: #b0b0b0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Styling for button logos */
.button-icon-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#uploadFileBtn {
    background-color: #6c757d;
}
#uploadFileBtn:hover {
    background-color: #5a6268;
}

/* Ensure the hidden file input remains hidden */
.hidden {
    display: none !important;
}


/* API Key Modal */
#apiKeyModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#apiKeyModal.flex {
    display: flex;
}

#apiKeyModal .bg-white {
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

/* Quiz Topic Modal (NEW) */
#quizTopicModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

#quizTopicModal.flex {
    display: flex;
}

#quizTopicModal .bg-white {
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

/* Quiz Topic Input */
#quizTopicInput {
    padding: 0.75rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#quizTopicInput:focus {
    outline: none;
    border-color: #4a00e0;
    box-shadow: 0 0 0 3px rgba(74, 0, 224, 0.2);
}

/* Quiz Modal Buttons */
#cancelQuizTopicBtn, #generateQuizBtn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: none;
    cursor: pointer;
}

#cancelQuizTopicBtn {
    background-color: #6c757d;
    color: white;
}
#cancelQuizTopicBtn:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
}

#generateQuizBtn {
    background-color: #4a00e0; /* Match primary brand color */
    color: white;
}
#generateQuizBtn:hover {
    background-color: #3b00c0;
    transform: translateY(-1px);
}


/* MathJax Specific Overrides for Font and Spacing */

/* Increase base font size for all MathJax output, relative to parent font size */
mjx-container {
    font-size: 1.15em !important; /* Make equations slightly larger */
    display: inline-block; /* Keep inline math, but allow margins */
    vertical-align: middle; /* Better alignment for inline math */
    margin-top: 0.4em !important; /* Add space above inline and display math */
    margin-bottom: 0.4em !important; /* Add space below inline and display math */
}

/* For block-level equations (display math) */
mjx-container[display="true"] {
    display: block !important; /* Force block display */
    text-align: center; /* Center block equations */
    margin-top: 1em !important; /* More generous spacing for block equations */
    margin-bottom: 1em !important; /* More generous spacing for block equations */
    padding: 0.5em 0; /* Internal padding */
}

/* For inline equations */
mjx-container[display="false"] {
    vertical-align: -0.15em !important; /* Slightly more aggressive vertical adjustment for inline math */
    padding: 0 0.15em; /* Small horizontal padding around inline math */
}

/* IMPORTANT: Target MathJax's internal text elements very specifically to force Inter font */
/* This is crucial for parts of MathJax output that are treated as plain text, like numbers,
   or text within \text{} commands, ensuring they don't inherit a math font. */
mjx-text, /* Text inside \text{} */
mjx-n, /* Numbers */
mjx-v, /* Variables (if they are text-like) */
mjx-char[class*="TEX-I"], /* Italic math font characters, might need reset */
mjx-char[class*="TEX-S"], /* Sans-serif math font characters */
mjx-char[class*="TEX-M"] { /* Other math font characters (be careful here, this might affect actual math symbols) */
    font-family: 'Inter', sans-serif !important;
}


/* --- Login Page Specific Styles --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: url('https://www.asi.it/wp-content/uploads/2020/05/space-economy-563x353-2.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.login-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1;
}

.login-container {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2rem 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    z-index: 2;
    width: 90%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    min-height: auto;
    overflow-y: auto;
    max-height: 95vh;
}

.login-logo {
    width: 180px;
    height: auto;
    margin-bottom: 1.5rem;
    object-fit: contain;
    background-color: #ffffff;
    padding: 10px;
    border-radius: 0.75rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
}

.login-welcome-heading {
    font-size: 2.2rem;
    font-weight: 700;
    color: #4a00e0;
    margin-top: 0;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.login-form-card {
    width: 100%;
}

.login-form-card .flashes li.success { background-color: #4CAF50; color: white; }
.login-form-card .flashes li.danger { background-color: #f44336; color: white; }
.login-form-card .flashes li.warning { background-color: #ff9800; color: white; }
.login-form-card .flashes li.info { background-color: #2196F3; color: white; }

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    line-height: 1.5;
    font-size: 1rem;
    width: 100%;
    height: auto;
}

.form-input:focus {
    outline: none;
    border-color: #6d28d9;
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.25);
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #fff;
    background-image: none;
    cursor: pointer;
    padding-right: 2.5rem;
}

.custom-arrow {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #6b7280;
    pointer-events: none;
}


.btn-primary {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1.1rem;
    font-weight: 700;
    background-color: #4a00e0;
    color: white;
    box-shadow: 0 4px 10px rgba(74, 0, 224, 0.2);
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    margin-top: 1.5rem;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #3b00c0;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 0, 224, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.login-form-card p.text-center {
    margin-top: 1.5rem;
}

.login-form-card p.text-center a {
    font-weight: 600;
    color: #6d28d9;
    transition: color 0.2s ease;
}

.login-form-card p.text-center a:hover {
    color: #4a00e0;
    text-decoration: underline;
}

.login-form-card a[href*="console.groq.com/keys"] {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border-radius: 0.3rem;
    background-color: #f0f8ff;
    border: 1px solid #cfe2ff;
    text-decoration: none;
    color: #4a00e0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.login-form-card a[href*="console.groq.com/keys"]:hover {
    background-color: #e6f2ff;
    border-color: #a0c4ff;
    text-decoration: underline;
}

.login-form-card a[href*="console.groq.com/keys"] svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.3rem;
    vertical-align: middle;
    color: #4a00e0;
}


/* Responsive Adjustments */
@media (max-width: 1024px) {
    .chat-layout {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        margin: 0.5rem auto 1rem auto;
    }

    .left-sidebar, .right-sidebar {
        width: 100%; height: auto;
    }
    .chat-main .chat-history {
        height: 300px; flex-grow: 0;
    }

    header {
        padding: 1rem; flex-wrap: wrap; justify-content: center;
    }
    .header-logo {
        height: 30px; margin-right: 0.5rem;
    }
    header h1 {
        width: 100%; text-align: center; margin-bottom: 0.5rem;
    }
    header nav {
        width: 100%; justify-content: center; margin-top: 0.5rem;
    }
    header nav a, header nav button {
        padding: 0.4rem 0.8rem; font-size: 0.8rem; margin: 0 0.25rem;
    }

    .chat-input-area-container {
        padding: 0 1rem 1rem 1rem;
    }
    .chat-input-area {
        width: 100%; padding: 0.8rem 1rem; border-radius: 1rem;
    }
    #send-message-btn, #uploadFileBtn {
        width: 40px; height: 40px;
    }
    .button-icon-logo {
        width: 20px; height: 20px;
    }
    #user-message-input {
        min-height: 40px;
    }

    .login-container {
        padding: 1.5rem 1.25rem;
        max-width: 400px;
        max-height: 90vh;
    }
    .login-logo {
        width: 150px;
        padding: 8px;
    }
    .login-welcome-heading {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }
    .form-input {
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
    }
    .btn-primary {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
        margin-top: 1.25rem;
    }
    .login-form-card p.text-center {
        margin-top: 1.25rem;
    }
    .login-form-card a[href*="console.groq.com/keys"] {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    .login-form-card a[href*="console.groq.com/keys"] svg {
        width: 0.9rem;
        height: 0.9rem;
    }
}

@media (max-width: 768px) {
    .chat-main {
        padding: 1rem;
    }
    .message-bubble {
        max-width: 85%;
    }
    .chat-input-area {
        flex-wrap: nowrap;
    }
    .login-container {
        padding: 1.25rem 1rem;
        max-width: 350px;
        max-height: 95vh;
    }
    .login-logo {
        width: 130px;
    }
    .login-welcome-heading {
        font-size: 1.6rem;
        margin-bottom: 1.25rem;
    }
    .form-group {
        margin-bottom: 1rem;
    }
    .btn-primary {
        margin-top: 1rem;
    }
    .login-form-card p.text-center {
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }
    .chat-layout {
        padding: 0.5rem;
    }
    .sidebar, .chat-main, .container {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    .message-bubble {
        max-width: 95%;
    }
    header nav a, header nav button {
        padding: 0.3rem 0.6rem; font-size: 0.7rem;
    }
    h1 {
        font-size: 1.5rem;
    }
    .sidebar h2 {
        font-size: 1.1rem;
    }
    .login-container {
        margin: 0.5rem;
        padding: 1rem;
        border-radius: 0.75rem;
        max-width: 300px;
        max-height: 98vh;
    }
    .login-logo {
        width: 100px;
        margin-bottom: 0.8rem;
        padding: 5px;
    }
    .login-welcome-heading {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    .login-form-card h2 {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    .form-group {
        margin-bottom: 0.75rem;
    }
    .form-input {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    .btn-primary {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        margin-top: 0.8rem;
    }
    .login-form-card p.text-center {
        margin-top: 0.8rem;
    }
    .login-form-card a[href*="console.groq.com/keys"] {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
    .login-form-card a[href*="console.groq.com/keys"] svg {
        width: 0.8rem;
        height: 0.8rem;
    }
}



/* --- Styles for the 'Update Lesson Plan' Feature --- */
.container-3-panel {
    display: grid;
    grid-template-columns: 1fr; /* Default to one column for mobile */
    gap: 20px;
    padding: 20px;
}

@media (min-width: 768px) {
    .container-3-panel {
        grid-template-columns: 1fr 1fr 1fr; /* Three columns for larger screens */
    }
}

.panel {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.panel-heading {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #3b82f6;
    text-align: center;
    font-weight: 700;
}

.file-input-container, .range-slider-container {
    width: 100%;
    margin-bottom: 20px;
}

.file-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    background-color: #fff;
    color: #1f2937;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.file-input:hover {
    border-color: #3b82f6;
}

.range-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.range-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: #d1d5db;
    border-radius: 5px;
    height: 8px;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.range-value {
    margin-top: 15px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.action-button {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 20px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.action-button:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
}

.action-button:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

.download-link {
    display: none;
    text-align: center;
    margin-top: 20px;
}

/* Add these rules to the end of your static/style.css file */

body {
    /* Ensures the body is a flex container for the main content and footer */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


.panel-card {
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    background-color: #fff;
}

.panel-header {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.video-thumb {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
}

.reference-link {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}

.reference-link i {
    margin-right: 8px;
}

#chat-panel {
    border: 1px solid #0d6efd;
    border-radius: 10px;
    padding: 15px;
    background: #f8f9fa;
}



main {
    /* Allows the main content to grow and take up remaining space */
    flex-grow: 1;
    /* Enables vertical scrolling for the main content area if it overflows */
    overflow-y: auto;
}

/* Optional: a clean scrollbar for webkit browsers */
main::-webkit-scrollbar {
    width: 8px;
}

main::-webkit-scrollbar-track {
    background: #f1f1f1;
}

main::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}


