/* --- Global Styles & Dark Theme --- */
/* Import Poppins font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-bg: #12151c; /* Even darker blueish grey */
    --secondary-bg: #1c202a; /* Slightly lighter dark */
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-primary: #1b7bfa; /* Darker blue */
    --accent-secondary: #0056b3; /* Even darker blue for hover */
    --glass-bg: rgba(28, 32, 42, 0.6); /* Semi-transparent for glass effect */
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    --font-family: 'Poppins', sans-serif;
    --header-height: 70px;

    /* Existing variables that need to be kept or adjusted */
    --primary-color: var(--accent-primary); /* Map old primary to new accent */
    --primary-dark: var(--accent-secondary); /* Map old primary-dark to new accent-secondary */
    --background-dark: var(--primary-bg); /* Map old background-dark to new primary-bg */
    --surface-dark: var(--secondary-bg); /* Map old surface-dark to new secondary-bg */
    --surface-darker: rgba(28, 32, 42, 0.8); /* A darker surface for hover/active states, derived from glass-bg */
    --text-light: var(--text-primary); /* Map old text-light to new text-primary */
    --text-white: #ffffff; /* Keep white */
    --text-blue-heading: var(--accent-primary); /* Use accent for headings */
    --text-light-green: #32cd32; /* Keep lime green */
    --error-color: #f44336; /* Keep red */
    --success-color: #0feb16; /* Keep green */
    --border-color: var(--glass-border); /* Use glass border for general borders */
    --shadow-color: rgba(0, 0, 0, 0.4); /* Keep shadow color */
    --gradient-start: #0a141a; /* From index.html background gradient */
    --gradient-end: #1a3a4a; /* From index.html background gradient */

    --border-radius: 12px; /* Adjusted to match glassmorphism elements */
    --box-shadow: var(--card-shadow); /* Use card-shadow for general box-shadow */

    /* Accordion specific colors */
    --prompt-menu-bg: #0a0c10; /* Slightly darker for prompt menus */
    --accordion-header-bg: var(--prompt-menu-bg); /* Darker, matching primary-bg */
    --accordion-header-hover-bg: #050608; /* Even darker on hover */
    --accordion-content-bg: #1c202a; /* Secondary background for content */
    --accordion-border: rgba(255, 255, 255, 0.1); /* Light border */
    --accordion-text-color: #e0e0e0; /* Primary text color */
    --accordion-icon-color: #5FFDE5; /* Accent cyan for icons */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif; /* Use Poppins */
    line-height: 1.6;
    color: var(--text-light);
    background-color: var(--background-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.dark-theme {
    background-color: var(--background-dark);
    color: var(--text-light);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    color: var(--text-blue-heading); /* Changed from --text-white to --text-blue-heading */
    font-weight: 500;
}

/* Apply light green to bold text in normal content */
strong, b {
    color: var(--text-light-green);
}

/* Ensure bold text in headings stays light blue */
h1 strong, h1 b,
h2 strong, h2 b,
h3 strong, h3 b,
h4 strong, h4 b,
h5 strong, h5 b,
h6 strong, h6 b {
    color: var(--text-blue-heading);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

ul {
    list-style: none;
}

button, input[type="submit"], .cta-button {
    cursor: pointer;
    padding: 10px 20px; /* Slightly more padding */
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: var(--text-white);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase; /* Material style */
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:hover, input[type="submit"]:hover, .cta-button:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-light);
    padding: 8px; /* Slightly larger touch target */
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: background-color 0.2s ease;
}
.icon-button:hover {
    background-color: var(--surface-darker);
}
.icon-button .material-icons-outlined {
    font-size: 24px; /* Standard icon size */
}
/* Ensure consistent padding for all icon buttons in chat input */
.chat-input-area .icon-button {
    padding: 8px; /* Consistent padding */
}


input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px 15px; /* More padding */
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--surface-dark);
    color: var(--text-light);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(41, 121, 255, 0.3); /* Focus ring */
}

textarea {
    /* Keep general textarea styles */
    resize: vertical;
    min-height: 40px; /* Default min-height for other textareas */
}

/* Styles for the specific textareas in the initial form */
#initial-form #context,
#initial-form #requirement {
    height: calc(1.6em + 24px); /* Initial height: 1 line + padding */
    min-height: calc(1.6em + 24px); /* Match initial height */
    overflow-y: hidden; /* Hide scrollbar initially */
    resize: none; /* Disable manual resize */
    transition: height 0.2s ease-out; /* Smooth transition for height */
}

/* Style for when the textareas are expanded */
#initial-form #context.expanded,
#initial-form #requirement.expanded {
     height: calc(1.6em * 5 + 24px + 4px); /* Expanded height: 5 lines + padding + buffer */
     min-height: calc(1.6em * 5 + 24px + 4px); /* Ensure min-height matches expanded height */
     overflow-y: auto; /* Show scrollbar if needed when expanded */
}


label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 1.5rem;
}

.error-message {
    color: var(--error-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.success-message {
    color: var(--success-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* --- Card Component --- */
.card {
    background-color: var(--surface-dark);
    padding: 1.5rem; /* Consistent padding */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    /* margin-bottom: 2rem; /* Add margin if sections are stacked directly in main */
    /* For grid/flex children, parent container should handle spacing (gap) */
}


/* --- Layout --- */
/* --- Header & Navigation --- */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0; /* Adjusted padding to match index.html */
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px; /* Adjusted padding to match index.html */
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-radius: 12px; /* Adjusted border-radius to match index.html */
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); /* Adjusted box-shadow to match index.html */
    max-width: 1200px; /* Keep max-width */
    margin: 0 auto; /* Center the nav */
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-white);
}

nav ul {
    display: flex;
    align-items: center;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a, nav ul li button {
    color: var(--text-light);
    font-weight: 500;
    padding: 8px 12px; /* Increased padding */
    position: relative;
    border-radius: 4px; /* Subtle rounded corners */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}
nav ul li button { /* Style logout button like links */
    background: none;
    border: none;
    font-size: inherit;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
    padding: 8px 12px; /* Increased padding */
}


nav ul li a:hover, nav ul li button:hover, nav ul li a.active {
    background-color: #0000ba; /* Dark blue background on hover/active */
    color: var(--text-white); /* Lighter text on hover */
    text-decoration: none; /* Remove underline on hover */
}

/* Remove the underline effect */
nav ul li a::after, nav ul li button::after {
    display: none;
}

.burger-menu {
    display: none; /* Hidden by default, shown in media query */
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem; /* Larger icon */
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}
.burger-menu .material-icons-outlined {
    font-size: 32px; /* Ensure icon size */
}

.close-menu-button {
    display: none; /* Hidden by default, shown when mobile menu is active */
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    position: absolute; /* Positioned within the mobile menu */
    top: 1rem;
    right: 1.5rem; /* Align with typical padding */
    z-index: 1002; /* Above mobile menu content */
}
.close-menu-button .material-icons-outlined {
    font-size: 32px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2.5rem; /* Add horizontal padding to the container */
}

main {
    flex-grow: 1;
    padding: 2rem 0; /* Adjust padding, horizontal padding is now on container */
    width: 100%;
    /* max-width: 1200px; Removed max-width, handled by container */
    /* margin: 2rem auto; Removed margin, handled by container */
}

footer {
    background-color: var(--surface-dark);
    color: var(--secondary-color);
    text-align: right;
    padding: 1rem;
    /* margin-top: auto; Removed margin-top, handled by container */
    font-size: 0.9rem;
}

/* --- Home Page Specific --- */
.home-main .hero {
    text-align: center;
    padding: 4rem 1rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
    box-shadow: var(--box-shadow);
}

/* --- Auth Pages (Login/Signup) Specific --- */
.auth-main {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 150px); /* Adjust based on header/footer height */
    padding: 2rem 1rem; /* Add some padding */
    background: linear-gradient(135deg, rgba(41, 121, 255, 0.1), rgba(28, 84, 178, 0.1));
}

.auth-container {
    width: 100%;
    max-width: 420px; /* Slightly wider auth box */
    padding: 2.5rem; /* More padding */
    text-align: center;
    border: 1px solid rgba(100, 181, 246, 0.2); /* Subtle border */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(41, 121, 255, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(41, 121, 255, 0.2);
}

.auth-container h2 {
    margin-bottom: 0.5rem; /* Reduced margin below heading */
    color: var(--text-white); /* White color for main headings in auth */
    font-size: 2rem; /* Larger heading */
    letter-spacing: 0.5px;
}

.auth-container .subtitle {
    font-size: 1rem;
    color: var(--secondary-color);
    margin-bottom: 2.5rem; /* More space below subtitle */
}

.auth-container .form-group {
    margin-bottom: 1.5rem; /* More space between form groups */
    text-align: left; /* Align labels and inputs to the left */
    position: relative; /* For positioning icons */
}

.auth-container label {
    font-size: 0.95rem;
    margin-bottom: 0.5rem; /* More space below label */
    color: var(--text-light);
    display: block;
    font-weight: 500;
}

.auth-container .input-with-icon {
    position: relative;
}

.auth-container .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-color);
    pointer-events: none; /* Don't block clicks on the input */
    transition: color 0.2s ease;
}

.auth-container .password-toggle {
    position: absolute;
    right: 12px; /* Position from the right edge */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--secondary-color);
    transition: color 0.2s ease;
}

.auth-container input[type="text"] {
    padding: 12px 12px 12px 42px; /* Left padding for icon */
    font-size: 1rem;
}

.auth-container input[type="password"] {
    padding: 12px 42px 12px 42px; /* Left and right padding for icons */
    font-size: 1rem;
    border-radius: 8px; /* Slightly more rounded */
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    background-color: rgba(30, 30, 30, 0.6); /* Slightly transparent */
}

.auth-container input[type="text"]:focus,
.auth-container input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(41, 121, 255, 0.25);
    background-color: rgba(30, 30, 30, 0.9); /* Darker when focused */
}

.auth-container input[type="text"]:focus + .input-icon,
.auth-container input[type="password"]:focus + .input-icon {
    color: var(--primary-color); /* Icon changes color on input focus */
}

.auth-container .auth-button {
    width: 100%; /* Full width button */
    padding: 14px 20px; /* Taller button */
    margin-top: 1.5rem; /* More space above the button */
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 8px; /* Match input radius */
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.auth-container .auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 121, 255, 0.4);
    background: linear-gradient(135deg, #3d8aff, #1a4da6); /* Slightly different gradient on hover */
}

.auth-container .auth-button:active {
    transform: translateY(0);
}

.auth-container .error-message,
.auth-container .success-message {
    text-align: center; /* Center messages below the form */
    margin-top: 1.2rem;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.auth-container .error-message {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.auth-container .success-message {
    background-color: rgba(15, 235, 22, 0.1);
    border: 1px solid rgba(15, 235, 22, 0.3);
}

.auth-container .switch-auth {
    margin-top: 2rem; /* More space above the switch link */
    font-size: 0.95rem;
    color: var(--text-light);
    padding-top: 1.5rem;
    border-top: 1px solid rgba(100, 181, 246, 0.1);
}

.auth-container .switch-auth a {
    font-weight: 600;
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.auth-container .switch-auth a:hover {
    color: #64b5f6; /* Lighter blue on hover */
}

.requirement {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #f44336; /* Red color for unmet requirements */
}

.requirement.met {
    color: #0feb16; /* Green color for met requirements */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* --- Features Section --- */
.features {
    text-align: center;
    margin-bottom: 3rem;
}

.home-main .hero h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    color: var(--text-white);
}

.home-main .hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.cta-button {
    display: inline-block;
    padding: 12px 30px;
    font-size: 1.1rem;
    background-color: var(--text-white);
    color: var(--primary-color);
    font-weight: bold;
}
.cta-button:hover {
    background-color: var(--text-light);
    text-decoration: none;
}


.features {
    text-align: center;
    margin-bottom: 3rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two columns */
    gap: 2rem;
    margin-top: 2rem;
}

/* Responsive adjustment for smaller screens */
@media (max-width: 768px) {
    #nav-links {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(30, 30, 30, 0.98);
        backdrop-filter: blur(5px);
        justify-content: center;
        align-items: center;
        z-index: 1000;
        padding: 0;
        margin: 0;
        overflow-y: auto;
    }

    #nav-links.active {
        display: flex;
    }

    #nav-links.active .close-menu-button {
        display: block;
    }

    #nav-links li {
        margin: 1.5rem 0;
        text-align: center;
    }

    #nav-links li a, #nav-links li button {
        font-size: 1.5rem;
        padding: 1rem;
        color: var(--text-white);
        display: block;
    }

    #nav-links li a:hover, #nav-links li button:hover {
        background-color: var(--primary-color);
    }

    .burger-menu {
        display: block;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .chat-main {
        display: flex;
        height: calc(100vh - 150px); /* Ensure spaces around operators in calc() */
        padding: 0;
        margin: 0 auto;
        max-width: none;
        overflow-y: auto;
        background-color: var(--background-dark);
    }

    .chat-container {
        display: flex;
        flex-grow: 1;
        background-color: var(--surface-dark);
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
        margin: 1rem;
    }

    .chat-area {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        position: relative;
        overflow: hidden;
        width: 100%; /* Chat area takes full width of container */
    }
    /* ... other rules ... */
}

/* End of max-width: 768px media query */

.initial-form {
        background-color: var(--surface-dark);
        padding: 1.5rem;
        border-radius: var(--border-radius);
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        position: relative;
    }
    .chat-input-area {
        padding: 0.5rem;
    }
    #chat-input {
        margin: 0 0.3rem;
    }
    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }
.inline-form button {
    width: 100%;
    margin-top: 0.5rem;
}

/* Desktop styles */
@media (min-width: 1024px) {
    .chat-area {
        width: 61.8% !important;
        margin: 0 auto !important; /* Center the chat area */
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }
    nav .logo {
        font-size: 1.5rem;
    }
    main {
        padding: 1rem;
        margin: 1rem auto;
    }
    .home-main .hero {
        padding: 2rem 1rem;
    }
    .home-main .hero h1 {
        font-size: 2rem;
    }
    .home-main .hero p {
        font-size: 1rem;
    }
    .auth-container {
        padding: 1.5rem;
    }
    .chat-input-area .icon-button {
        padding: 5px;
    }
    .chat-input-area .send-button {
        padding: 5px;
        min-width: 35px;
    }
    #chat-input {
        padding: 8px 10px;
        min-height: 35px;
    }
}

/* --- Thinking Animation --- */
/* Removed .thinking-indicator styles */

.thinking-text {
    /* Ensure it doesn't inherit message bubble padding if placed inside */
    padding: 0;
    font-size: 1.8rem; /* Heading-like size (similar to h2 in auth) */
    font-weight: 500; /* Match h1, h2, h3 weight */
    color: transparent; /* Make text transparent to show background */
    /* Use a gradient similar to the example, adjusted for dark theme */
    background: linear-gradient(90deg, #0a0c12 0%, #0a0c12 32.00%, #00ff08 47.00%, #00ff08 53.00%, #0a0c12 68.00%, #0a0c12 100%);
    background-size: 300% 100%; /* Increased size for wider sweep */
    -webkit-background-clip: text; /* Clip background to text shape */
    background-clip: text;
    /* Animation for back and forth movement */
    animation: knight-rider-animation 4s linear infinite; /* Adjusted duration */
}

/* Keyframes for Knight Rider effect (same as example) */
@keyframes knight-rider-animation {
    0% {
        background-position: 50% 50%; /* Start position (left) */
    }
    50% {
        background-position: 100% 50%; /* Move to the right */
    }
    100% {
        background-position: 50% 50%; /* Move back to the left */
    }
}

/* --- Enhanced History Page Styles --- */

.history-main {
    max-width: 900px; /* Slightly wider max-width for history */
    margin: 2rem auto;
}

.history-actions-header {
    display: flex;
    justify-content: space-between; /* Align items to the left and right */
    align-items: center; /* Vertically align items */
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem; /* Add space between search input and button */
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

#delete-all-history-button.button-danger { /* Specificity for the delete all button */
    background-color: var(--error-color);
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
    text-transform: none; /* Less shouting */
    font-weight: 500;
}

#delete-all-history-button.button-danger:hover {
    background-color: #d32f2f; /* Darker red */
    box-shadow: 0 4strap 8px rgba(244, 67, 54, 0.4);
}

.chat-history-list {
    max-width: none; /* Remove max-width from list itself */
    margin: 0;
}

.history-item {
    background-color: var(--surface-dark);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: 0 3px 8px var(--shadow-color);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex; /* Changed to row layout */
    flex-direction: row;
    justify-content: space-between; /* Pushes content left, actions right */
    align-items: flex-start; /* Align items to the top of the row */
    gap: 1rem; /* Space between content block and actions block */
    text-align: left;
}

.history-item-content {
    display: flex;
    flex-direction: column; /* Stack header and preview vertically */
    gap: 0.8rem; /* Space between header and preview */
    flex-grow: 1; /* Allow content to take available space */
    min-width: 0; /* Prevent content from overflowing when title is long */
}

.history-item:hover {
    background-color: var(--surface-darker);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px var(--shadow-color);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.history-title-display {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-white);
    flex-grow: 1;
    line-height: 1.4;
    word-break: break-word; /* Allow long titles to wrap */
}

.history-title-edit {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-white);
    background-color: var(--surface-darker);
    flex-grow: 1;
    margin-bottom: 0;
    padding: 8px 10px;
    height: auto;
    line-height: 1.4;
    /* Ensure input also wraps if needed, though less common */
}

.history-date {
    color: var(--secondary-color);
    font-size: 0.85rem;
    white-space: nowrap;
    /* margin-top: 0; Align with top of title due to header's align-items: flex-start */
    flex-shrink: 0;
}

.history-preview {
    font-size: 0.95rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
    word-break: break-word; /* Allow preview to wrap */
}

.history-item-actions {
    display: flex;
    /* justify-content: flex-end; No longer needed here, parent .history-item handles spacing */
    align-items: flex-start; /* Align buttons to their top */
    gap: 0.6rem;
    /* margin-top: 0.5rem; No longer needed, part of flex row */
    flex-shrink: 0; /* Prevent action buttons from shrinking */
}

/* Hide the original edit button */
.history-item-actions .edit-title-button {
    display: none;
}

.history-item-actions button {
    /* Make buttons square */
    background: none;
    border: 1px solid var(--border-color); /* Add subtle border */
    color: var(--secondary-color); /* Default subtle color */
    padding: 6px;
    border-radius: 4px; /* Square corners */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    width: 32px; /* Fixed width */
    height: 32px; /* Fixed height */
}

.history-item-actions button:hover {
    background-color: var(--surface-darker);
    color: var(--text-light); /* Lighten on hover */
    border-color: var(--secondary-color); /* Highlight border on hover */
}

/* Specific button colors on hover */
.history-item-actions .save-title-button:hover {
    color: var(--success-color);
}
.history-item-actions .delete-thread-button:hover {
    color: var(--error-color);
}
.history-item-actions .cancel-edit-button:hover {
    color: #ffc107; /* Amber/Warning color */
}

/* Remove default delete button styles */
.delete-history-button {
    /* These styles are now handled by .history-item-actions button */
    /* and specifically .delete-thread-button */
}

/* --- Token Usage Page Styles --- */

#token-usage-container {
    margin-top: 20px;
    background-color: var(--surface-dark); /* Use standard surface color */
    padding: 25px; /* More padding */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

#token-usage-table {
    width: 100%;
    border-collapse: collapse; /* Remove default spacing */
    margin-top: 15px;
    color: var(--text-light); /* Ensure text color matches theme */
    border: 1px solid var(--border-color); /* Add outer border */
    border-radius: var(--border-radius); /* Rounded corners for the table */
    overflow: hidden; /* Clip content to rounded corners */
}

#token-usage-table th,
#token-usage-table td {
    padding: 12px 18px; /* Adjust padding */
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color); /* Horizontal lines between rows */
}

#token-usage-table td:not(:last-child),
#token-usage-table th:not(:last-child) {
     border-right: 1px solid var(--border-color); /* Vertical lines between columns */
}


#token-usage-table thead th {
    background-color: var(--surface-darker); /* Header background */
    color: var(--text-white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom-width: 2px; /* Thicker line below header */
}

#token-usage-table tbody tr {
    transition: background-color 0.2s ease;
}

#token-usage-table tbody tr:nth-child(even) {
    background-color: var(--surface-darker); /* Subtle alternating row color */
}

#token-usage-table tbody tr:hover {
    background-color: var(--primary-dark); /* Highlight row on hover */
    color: var(--text-white);
}

#token-usage-table tbody tr:last-child td {
    border-bottom: none; /* Remove border from last row */
}

/* Style loading/error messages within the container */
#token-usage-container #loading-token-usage,
#token-usage-container #token-usage-error {
    text-align: center;
    padding: 20px;
    margin-top: 15px;
    font-style: italic;
}

#token-usage-container #token-usage-error {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1); /* Light red background */
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius);
}

/* Styles for Sortable Table Headers */
#token-usage-table th.sortable-header {
    cursor: pointer;
    position: relative; /* For positioning the indicator */
    user-select: none; /* Prevent text selection on click */
    transition: background-color 0.2s ease;
}

#token-usage-table th.sortable-header:hover {
    background-color: var(--primary-dark); /* Darker background on hover */
}

#token-usage-table th.sortable-header .sort-indicator {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0.5; /* Default dim indicator */
    transition: opacity 0.2s ease;
}

#token-usage-table th.sortable-header.sort-asc .sort-indicator {
    border-bottom: 5px solid currentColor; /* Pointing up */
    border-top: 0;
    opacity: 1;
}

#token-usage-table th.sortable-header.sort-desc .sort-indicator {
    border-top: 5px solid currentColor; /* Pointing down */
    border-bottom: 0;
    opacity: 1;
}

/* --- Chat Page Specific Styles --- */
.chat-main {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    padding: 0;
    background-color: var(--background-dark);
    width: 100%; /* Ensure main takes full width */
    max-width: 1200px; /* Limit max width of the overall chat container */
    margin: 0 auto; /* Center the container */
}

.chat-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    width: 100%; /* Ensure container takes full width */
    background-color: var(--background-dark); /* Match chat canvas background */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-top: 1rem; /* Add some space from header */
    margin-bottom: 1rem; /* Add some space from footer */
}

.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    width: 100%; /* Chat area takes full width of container */
    max-width: none; /* Remove max-width here */
    margin: 0; /* Remove margin here */
}

#chat-canvas { /* Changed from .chat-canvas to #chat-canvas */
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto; /* Allow scrolling for messages */
    background-color: var(--background-dark); /* Match body background */
    display: flex;
    flex-direction: column; /* Messages should appear in the order they are added */
    width: 100%;
    max-width: 768px; /* Match the max-width of chat-input-wrapper */
    margin: 0 auto; /* Center the chat canvas */
    padding-bottom: 200px; /* Increase padding at the bottom to ensure last message is visible above input area */
    scroll-behavior: smooth; /* Add smooth scrolling */
    /* Improve scrolling performance */
    -webkit-overflow-scrolling: touch;
}

/* Initial Dialog Styles */
.initial-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000; /* Ensure it's above other content */
    backdrop-filter: blur(5px);
}

.initial-dialog-box {
    background-color: var(--surface-dark);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 700px; /* Max width for the dialog */
    max-height: 90vh; /* Max height */
    overflow-y: auto; /* Scroll if content exceeds max height */
    position: relative; /* For positioning the close button */
}

.initial-dialog-box .initial-form {
    /* The form itself doesn't need extra styling if it's the only content */
}

.initial-dialog-box .close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--text-light);
}
.initial-dialog-box .close-button:hover {
    color: var(--text-white);
}


/* ChatGPT-style Input Area */
.chat-input-area.chatgpt-style {
    padding: 1rem 1.5rem 18px 1.5rem; /* Reduced padding-bottom by another 20px */
    background-color: var(--background-dark); /* Match chat canvas background */
    border-top: 1px solid var(--background-dark); /* Changed border color to match background */
    display: flex; /* Use flex to center the wrapper */
    justify-content: center; /* Center the wrapper horizontally */
    position: fixed; /* Fix the input area at the bottom */
    bottom: 3px; /* Keep fixed position */
    left: 0;
    right: 0;
    z-index: 100; /* Ensure it's above other content */
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); /* Subtle shadow pointing upwards */
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end; /* Align items to the bottom (for multi-line textarea) */
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: 24px; /* More rounded like ChatGPT */
    padding: 8px 12px; /* Inner padding */
    width: 100%;
    max-width: 768px; /* Max width similar to ChatGPT's input */
    /* box-shadow: 0 2px 10px rgba(0,0,0,0.1); Removed, added to parent */
}

.chat-input-area.chatgpt-style #chat-input {
    flex-grow: 1;
    border: none;
    background-color: transparent;
    color: var(--text-light);
    padding: 10px; /* Adjust padding for textarea */
    margin: 0 8px; /* Margin between buttons and textarea */
    resize: none; /* Disable manual resize */
    outline: none; /* Remove focus outline */
    font-size: 1rem;
    line-height: 1.5;
    max-height: 150px; /* Max height before scrolling */
    overflow-y: auto; /* Allow scrolling within textarea */
    border-radius: 0; /* Remove individual border-radius */
    box-shadow: none; /* Remove individual box-shadow */
    min-height: calc(1.5em + 20px); /* Initial height for one line + padding */
}

.chat-input-area.chatgpt-style .icon-button {
    color: var(--secondary-color);
    padding: 8px; /* Consistent padding */
    margin: 0 4px; /* Spacing between icon buttons */
    transition: color 0.2s ease, background-color 0.2s ease; /* Add transition */
}
.chat-input-area.chatgpt-style .icon-button:hover {
    color: var(--text-light-green); /* Green color on hover */
    background-color: var(--surface-darker);
}

.chat-input-area.chatgpt-style .send-button {
    background-color: var(--primary-color);
    color: var(--text-white);
    border-radius: 50%; /* Make send button circular */
    width: 40px; /* Fixed size */
    height: 40px; /* Fixed size */
    padding: 0; /* Remove padding, icon will center */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px; /* Ensure min-width matches width for perfect circle */
    box-shadow: none;
    transition: background-color 0.2s ease; /* Add transition */
}
.chat-input-area.chatgpt-style .send-button:hover {
    background-color: var(--primary-dark);
}
.chat-input-area.chatgpt-style .send-button .material-icons-outlined {
    font-size: 20px; /* Adjust icon size if needed */
}

/* --- Prompt Menu Styles (Accordion) --- */
.prompt-menu {
    position: absolute;
    bottom: calc(100% + 12px); /* Position slightly higher above its related button/input area */
    background-color: var(--prompt-menu-bg); /* Make non-transparent */
    border: 1px solid var(--accordion-border);
    border-radius: var(--border-radius);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.25); /* Shadow upwards */
    z-index: 1500;
    padding: 0; /* No padding for overall menu, items will have their own */
    min-width: 300px; /* Slightly wider minimum width */
    max-width: 450px; /* Increased maximum width */
    max-height: 300px; /* Increased max height before scrolling */
    overflow-y: auto;
    display: flex;
    flex-direction: column;

    /* Animation properties - Removed */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.prompt-menu.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    /* Add transition for smooth height change */
    transition: max-height 0.3s ease-out;
}

/* Style for expanded prompt menu */
.prompt-menu.expanded {
    max-height: 375px; /* 300px (original max-height) + 25% (75px) */
}

.accordion-item {
    border-bottom: 1px solid var(--accordion-border);
}

.accordion-item:last-child {
    border-bottom: none; /* No border after the last item */
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--accordion-text-color);
    background-color: var(--accordion-header-bg);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.accordion-header:hover {
    background-color: var(--accordion-header-hover-bg);
}

.accordion-header .material-icons-outlined {
    font-size: 20px;
    color: var(--accordion-icon-color);
    transition: transform 0.3s ease;
}

.accordion-header.active .material-icons-outlined {
    transform: rotate(180deg); /* Rotate icon when active */
}

.accordion-content {
    background-color: var(--accordion-content-bg);
    overflow: hidden;
    max-height: 0; /* Hidden by default */
    transition: max-height 0.3s ease-out;
}

.accordion-content.active {
    max-height: 200px; /* Adjust as needed for content, will be overridden by JS */
}

.accordion-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.accordion-content ul li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--accordion-text-color);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Lighter border for list items */
    transition: background-color 0.2s ease;
}

.accordion-content ul li:last-child {
    border-bottom: none;
}

.accordion-content ul li:hover {
    background-color: var(--primary-color); /* Use primary color for hover */
    color: var(--text-white);
}

/* Specific positioning for the main chat input's prompt menu */
.chat-input-area > .prompt-menu { /* Direct child of chat-input-area (ID: prompt-menu) */
    left: 1.5rem; /* Align with the start of the input area padding */
    /* bottom is already set by the common .prompt-menu style */
    transform-origin: bottom left;
}

/* Specific positioning for the form's prompt menu */
.requirement-group { /* Parent of the form's prompt menu button and menu */
    position: relative; /* Needed for absolute positioning of the menu */
}

.input-with-button { /* New container for textarea and button */
    position: relative;
    display: flex; /* Use flex to align textarea and button */
    align-items: flex-end; /* Align items to the bottom */
    width: 100%; /* Take full width of parent */
}

.input-with-button textarea {
    flex-grow: 1; /* Allow textarea to take available space */
    padding-right: 40px; /* Add padding to the right for the button */
    margin-bottom: 0; /* Remove default margin-bottom */
}

.icon-button.form-prompt-button {
    position: absolute;
    right: 8px; /* Position from the right edge of the container */
    bottom: 8px; /* Position from the bottom edge of the container */
    transform: none; /* Remove translateY transform */
    margin-top: 0; /* Remove margin-top */
    z-index: 10; /* Ensure button is above textarea */
    padding: 4px; /* Adjust padding for smaller button */
}

.icon-button.form-prompt-button:hover {
    color: var(--text-light-green); /* Green color on hover */
}

.form-prompt-menu { /* The prompt menu inside the form (ID: form-prompt-menu) */
    right: 0; /* Align to the right of the requirement group */
    /* bottom is already set by the common .prompt-menu style */
    transform-origin: bottom right;
}


/* Adjustments for file upload status below the new input */
#chat-upload-status {
    padding: 0.5rem 1.5rem; /* Match horizontal padding of input area */
    text-align: center; /* Center the status text */
    font-size: 0.9rem;
    color: var(--secondary-color);
    background-color: var(--background-dark); /* Match chat canvas background */
}

/* Style for the Send Initial Query button in the initial form */
#initial-form .send-button {
    width: auto; /* Allow button to size based on content */
    padding: 12px 24px; /* Adjust padding */
    text-transform: none; /* Remove uppercase */
    letter-spacing: normal; /* Remove letter spacing */
    display: inline-flex; /* Use flex to align icon and text */
    align-items: center; /* Vertically align icon and text */
    gap: 8px; /* Space between icon and text */
}

/* Align form actions to the right */
.form-actions-right {
    text-align: right;
}

#initial-form .send-button .material-icons-outlined {
    font-size: 20px; /* Adjust icon size if needed */
}

/* --- Chat Message Styling --- */
.chat-canvas .message {
    margin-bottom: 1rem; /* Standard margin for better spacing */
    max-width: 85%; /* Max width of messages */
    display: flex;
    flex-direction: column;
}

/* Make assistant no-bubble messages full width of chat canvas */
.chat-canvas .message.assistant.no-bubble {
    max-width: 100% !important; /* Full width of chat canvas */
    width: 100% !important; /* Ensure it takes the full width */
}

/* Ensure all assistant messages have the correct styling */
.chat-canvas .message.assistant {
    max-width: 100% !important; /* Full width of chat canvas */
    width: 100% !important; /* Ensure it takes the full width */
    position: relative; /* Allow positioning of children */
    padding-right: 40px; /* Make space for the copy button */
}

.copy-button-container {
    position: absolute;
    bottom: 0.5rem; /* Adjust as needed */
    right: 0.5rem; /* Adjust as needed */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

.message.assistant:hover .copy-button-container {
    opacity: 1; /* Show on hover */
}

.copy-button {
    background: none;
    border: none;
    color: var(--secondary-color); /* Or a specific color for the icon */
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.copy-button:hover {
    background-color: var(--surface-darker);
    color: var(--text-light);
}

.copy-button .material-icons-outlined {
    font-size: 18px; /* Smaller icon for the copy button */
}

.chat-canvas .message.outgoing {
    align-self: flex-end; /* Align to the right */
    align-items: flex-end;
}

.chat-canvas .message.incoming {
    align-self: flex-start; /* Align to the left */
    align-items: flex-start;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    line-height: 1.5;
    word-wrap: break-word;
}

/* Outgoing message bubble style */
.message.outgoing .message-content {
    background-color: var(--text-blue-heading); /* Changed from --primary-color to --text-blue-heading for light blue bubbles */
    color: var(--text-white); /* White text should be readable on light blue #64b5f6 */
    border-bottom-right-radius: 4px; /* Slightly different corner for bubble tail illusion */
}

/* Incoming LLM message style (no bubble, direct on canvas) */
.message.assistant .message-content {
    background-color: transparent; /* No background for incoming */
    color: var(--text-white); /* Default text color */
    padding: 0; /* No padding for direct display */
}

.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3,
.message.assistant .message-content h4,
.message.assistant .message-content h5,
.message.assistant .message-content h6 {
    color: var(--text-blue-heading) !important; /* Light blue for all headings */
    margin-top: 1.5em; /* Increased from 0.8em to create more space above */
    margin-bottom: 0.2em; /* Decreased from 0.4em to be closer to its own paragraph */
}
.message.assistant .message-content p {
    color: var(--text-white); /* Ensure paragraph text is white */
    margin-top: 0; /* Ensure no extra top margin for paragraphs themselves */
    margin-bottom: 0.8em; /* Increased from 0.5em to create space before a following heading */
}
.message.assistant .message-content ul,
.message.assistant .message-content ol {
    list-style: disc; /* Ensure bullet points are visible */
    margin-left: 1.5rem;
    margin-bottom: 0.5em;
}
.message.assistant .message-content li {
    margin-bottom: 0.25em;
}
.message.assistant .message-content li strong,
.message.assistant .message-content li b {
    color: inherit; /* Ensure bold text in list items inherits color from global strong/b rule */
}
.message.assistant .message-content code {
    background-color: var(--surface-darker);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
}
.message.assistant .message-content pre {
    background-color: var(--surface-darker);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 0.5em;
}
.message.assistant .message-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Table styles for LLM output */
.message.assistant .message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0; /* Space above and below table */
    border: 1px solid var(--border-color); /* Outer border for the table */
    border-radius: var(--border-radius); /* Rounded corners for the table */
    overflow: hidden; /* Ensures content respects border-radius */
}

.message.assistant .message-content th,
.message.assistant .message-content td {
    padding: 0.8em 1.2em; /* Padding inside cells */
    border: 1px solid var(--border-color); /* Cell borders */
    text-align: left;
    vertical-align: top;
    color: var(--text-light); /* Default text color for cells */
}

.message.assistant .message-content thead th {
    background-color: var(--surface-darker); /* Header background */
    color: var(--text-white); /* Header text color */
    font-weight: 600;
    border-bottom: 2px solid var(--border-color); /* Thicker border below header */
}

.message.assistant .message-content tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.1); /* Subtle stripe for even rows */
}

.message.assistant .message-content tbody tr:hover {
    background-color: var(--surface-darker); /* Highlight row on hover */
}

.message.assistant .message-content table code {
    background-color: var(--secondary-bg); /* Code within tables */
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-meta {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 0.3rem;
}
.message.outgoing .message-meta {
    text-align: right;
}
.message.incoming .message-meta {
    text-align: left;
}

/* File name display in chat */
.file-in-chat {
    display: inline-flex;
    align-items: center;
    background-color: var(--surface-darker);
    color: var(--text-light);
    padding: 0.4rem 0.8rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    margin-top: 0.5rem; /* Add some space if it's part of a message block */
}
.file-in-chat .material-icons-outlined {
    font-size: 18px;
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

/* --- Scrollbar Styling (for Webkit browsers) --- */
/* Target the scrollbar itself */
::-webkit-scrollbar {
  width: 8px; /* Make the scrollbar thinner */
}

/* Target the track (the area the thumb scrolls along) */
::-webkit-scrollbar-track {
  background: var(--primary-bg); /* Match primary background */
  border-radius: 10px; /* Match border radius */
}

/* Target the thumb (the draggable part of the scrollbar) */
::-webkit-scrollbar-thumb {
  background: var(--text-secondary); /* Use text-secondary for better visibility */
  border-radius: 10px; /* Match border radius */
}

/* On hover, make the thumb slightly lighter */
::-webkit-scrollbar-thumb:hover {
  background: var(--text-primary); /* Even lighter on hover */
}

/* Optional: Style for Firefox */
/* Note: Firefox styling is less customizable than Webkit */
* {
  scrollbar-width: thin; /* Make the scrollbar thinner */
  scrollbar-color: var(--text-secondary) var(--primary-bg); /* Thumb color and track color */
}

/* --- File Upload Styling --- */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  text-align: center;
  background-color: var(--surface-darker);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}

.drop-zone:hover {
  border-color: var(--primary-color);
  background-color: rgba(41, 121, 255, 0.1);
}

.drop-zone.dragover {
  border-color: var(--primary-color);
  background-color: rgba(41, 121, 255, 0.15);
  box-shadow: 0 0 10px rgba(41, 121, 255, 0.3);
}

.drop-zone p {
  margin: 0;
  font-size: 1rem;
}

.file-browse {
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
}

.file-list {
  margin-top: 1rem;
}

.file-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background-color: var(--surface-darker);
  border-radius: var(--border-radius);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
}

.file-actions button {
  background: none;
  border: none;
  color: var(--secondary-color);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.file-actions button:hover {
  color: var(--primary-color);
  background-color: rgba(41, 121, 255, 0.1);
}

.file-actions .remove-file-button:hover {
  color: var(--error-color);
  background-color: rgba(244, 67, 54, 0.1);
}

.upload-progress {
  margin-top: 1rem;
  background-color: var(--surface-darker);
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

/* Style for the progress bar to use light green color */
.upload-progress .progress-bar {
  height: 100%;
  background-color: var(--text-light-green);
  width: 0;
  transition: width 0.3s ease;
}

.upload-progress .progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  color: var(--text-white);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.upload-progress.visible {
  display: block;
}

/* Overlay styles for center screen progress bar */
.center-progress-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  /* Ensure it's not scrollable */
  overflow: hidden;
  /* Remove any margin or padding that might affect positioning */
  margin: 0;
  padding: 0;
}

.center-progress-container {
  background-color: #000000; /* Black background */
  padding: 2.5rem;
  border-radius: 16px; /* More rounded corners */
  width: 80%;
  max-width: 500px; /* Bigger */
  text-align: center;
  /* Ensure container is properly centered */
  margin: 0 auto;
  /* Increase z-index to ensure it's above everything */
  position: relative;
  z-index: 3001;
  /* Add subtle box shadow for depth */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.center-progress-container .upload-progress {
  margin-top: 1rem;
  width: 100%;
  height: 30px; /* Doubled height for even thicker progress bar */
  border-radius: 15px; /* Proportional border radius for the thicker bar */
}

.center-progress-container .progress-text {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem; /* Add your desired spacing here */
  font-size: 1.2rem; /* Larger font size for better readability */
  font-weight: 600; /* Bolder text */
  color: var(--text-white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); /* Enhanced text shadow for better contrast */
}

/* Modal styling for file details */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}

.modal-content {
  background-color: var(--surface-dark);
  padding: 2rem;
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 500px;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--secondary-color);
}

.close-modal:hover {
  color: var(--text-white);
}

/* --- Admin Panel Specific Styles --- */
.admin-main {
    max-width: 900px; /* Limit width of admin content */
    margin: 2rem auto; /* Center the admin content */
    padding: 0 1rem; /* Add horizontal padding */
}

.admin-section {
    margin-bottom: 2rem; /* Space between sections */
}

/* User Table Styling */
#user-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    margin-bottom: 1.5rem; /* Space below the table */
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#user-table th,
#user-table td {
    padding: 12px 15px; /* Padding in cells */
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

#user-table td:not(:last-child),
#user-table th:not(:last-child) {
     border-right: 1px solid var(--border-color);
}

#user-table thead th {
    background-color: var(--surface-darker);
    color: var(--text-white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom-width: 2px;
}

#user-table tbody tr {
    transition: background-color 0.2s ease;
}

#user-table tbody tr:nth-child(even) {
    background-color: var(--surface-darker);
}

#user-table tbody tr:hover {
    background-color: var(--primary-dark);
    color: var(--text-white);
}

#user-table tbody tr:last-child td {
    border-bottom: none;
}

#user-table .delete-user-button {
    background-color: var(--error-color);
    padding: 6px 10px;
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none;
}

#user-table .delete-user-button:hover {
    background-color: #d32f2f;
}

/* Add New User Form Styling */
#add-user-form {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap */
    gap: 1rem; /* Space between form elements */
    align-items: flex-end; /* Align items to the bottom */
}

#add-user-form input[type="text"],
#add-user-form input[type="password"] {
    flex-grow: 1; /* Allow inputs to grow */
    min-width: 150px; /* Minimum width for inputs */
    margin-bottom: 0; /* Remove default margin-bottom */
}

#add-user-form label {
    display: flex; /* Use flex for label and checkbox */
    align-items: center; /* Vertically align */
    margin-bottom: 0; /* Remove default margin-bottom */
    white-space: nowrap; /* Prevent wrapping for "Admin?" */
}

#add-user-form input[type="checkbox"] {
    margin-right: 0.5rem; /* Space between checkbox and text */
    width: auto; /* Allow checkbox to take its natural width */
    margin-bottom: 0; /* Remove default margin-bottom */
}

#add-user-form button[type="submit"] {
    flex-shrink: 0; /* Prevent button from shrinking */
    margin-top: 0; /* Remove default margin-top */
}

/* Settings Form Styling */
#settings-form .form-group {
    margin-bottom: 1.5rem;
}

#settings-form label {
    margin-bottom: 0.5rem;
}

#settings-form textarea,
#settings-form input[type="text"] {
    width: 100%;
    margin-bottom: 0; /* Remove default margin-bottom */
}

#settings-form button[type="submit"] {
    margin-top: 1rem; /* Space above the button */
}

/* Chat Management Section Styling */
#delete-inactive-chats-button {
    background-color: var(--error-color);
    box-shadow: 0 2px 5px rgba(244, 67, 54, 0.3);
    text-transform: none;
    font-weight: 500;
}

#delete-inactive-chats-button:hover {
    background-color: #d32f2f;
}

.status-message {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 8px 12px;
    border-radius: 6px;
    text-align: center;
}

#delete-chats-status.success-message {
    color: var(--success-color);
    background-color: rgba(15, 235, 22, 0.1);
    border: 1px solid rgba(15, 235, 22, 0.3);
}

#delete-chats-status.error-message {
    color: var(--error-color);
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Legal Disclaimer Styles */
.legal-disclaimer {
    position: fixed; /* Fixed position relative to the viewport */
    bottom: 0px; /* At the very bottom of the page */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust for exact centering */
    z-index: 100; /* Behind the initial dialog box (z-index 2000) */
    font-size: 0.75rem; /* Small letters */
    color: #888888; /* Slightly darker color */
    text-align: center;
    padding: 0; /* No padding */
    background-color: transparent; /* No background color */
    border-radius: 0; /* No border-radius */
    white-space: nowrap; /* Prevent text from wrapping */
}
