﻿:root {
    --bg: #0e0f12; /* page background */
    --panel: #111318; /* panels & sidebar */
    --soft: #1a1d24; /* message blocks */
    --soft-rgb: 26, 29, 36; /* RGB values for --soft */
    --border: #22252e;
    --muted: #a1a7b3;
    --text: #e8e9ee;
    --accent: #10a37f; /* teal-ish accent */
    --accent-2: #1e7a66;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    --scrollbar-thumb: #2a3240;
    --scrollbar-thumb-hover: #3a4356;
    --textarea-background: #2a2a2e;
    --success-text: #a7f3d0;
    --failed-text: #fca5a5;
    --queued-text: #a5d8ff;
    --queued-rgb: 165, 216, 255;
    --processing-text: #fcd34d; 
    --processing-rgb: 252, 211, 77;
}

/* Reset-ish */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: radial-gradient(1000px 600px at 75% -200px, rgba(16,163,127,.08), transparent 70%), var(--bg);
    font: 400 16px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    letter-spacing: .2px;
    background: var(--bg);
    transition: background 0.3s ease, color 0.3s ease;
}

    body.light-theme {
        --bg: #ffffff;
        --panel: #f2f3f5; /* sidebar panels */
        --soft: #f7f7f9; /* chat bubbles */
        --soft-rgb: 247, 247, 249; /* RGB values for --soft */
        --border: #d0d0d0;
        --muted: #666666;
        --text: #000000;
        --accent: #10a37f; /* teal-ish accent */
        --accent-2: #1e7a66;
        --danger: #d9534f;
        --shadow: 0 6px 20px rgba(0,0,0,.15);
        --scrollbar-thumb: #d0d0d0; /* Matches your light theme border */
        --scrollbar-thumb-hover: #b0b0b0; /* A slightly darker hover state */
        --textarea-background: #f7f7f9;
        --success-text: #438f6c;
        --failed-text: #b65f5f;
        --queued-text: #3b82f6;
        --queued-rgb: 59, 130, 246;
        --processing-text: #d97706; 
        --processing-rgb: 217, 119, 6;
    }

.theme-toggle {
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    user-select: none;
}

button, input, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--accent);
    text-decoration: none;
}

/* App layout */
.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "sidebar header" "sidebar main" "sidebar composer";
    height: 100dvh;
    overflow: hidden;
}

/* Sidebar */
/*.sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--panel), var(--panel));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}*/
.sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--panel), var(--panel));
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100dvh; /* ✅ dynamic viewport height works better on iOS Safari */
    overflow: hidden; /* keep scroll only inside conversations */
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px;
    border-bottom: 1px solid var(--border);
}

    .brand .logo {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        background: conic-gradient(from 180deg at 50% 50%, var(--accent), var(--accent-2));
        box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 2px 10px rgba(16,163,127,.35);
    }

    .brand h1 {
        font-size: 15px;
        margin: 0;
        letter-spacing: .4px;
        font-weight: 600;
    }

.sidebar .section-title {
    margin: 16px;
    margin-top: 20px;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .12em;
}

/*.conversations {
    flex: 1;
    overflow: auto;
    padding: 0 8px 12px;
}*/
.conversations {
    flex: 1;
    overflow-y: auto; /* ✅ scroll only the chat list area */
    padding: 0 8px 12px;
    min-height: 0; /* ✅ ensures flexbox allows shrinking for scroll */
}
.conv-item {
    position: relative; /* This is crucial for positioning the dots */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 6px 8px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .2s ease;
}

    .conv-item:hover {
        background: var(--soft); /* ✅ theme-aware */
        border-color: var(--border);
    }

    .conv-item.active {
        background: var(--soft); /* ✅ theme-aware */
        border-color: var(--border);
    }

    .conv-item .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--accent);
        box-shadow: 0 0 0 3px rgba(16,163,127,.12);
    }

    .conv-item .title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text);
        font-size: 14px;
        padding-right: 14px;
    }
    /* Style for the disabled, processing chat room item */
    .conv-item.processing {
        opacity: 0.6;
        cursor: not-allowed;
        pointer-events: none; /* This makes the item unclickable */
    }

/* Style for the "Processing report..." text and spinner */
.processing-status {
    display: flex;
    align-items: center;
    font-size: 0.8em;
    color: #888; /* Or your theme's muted color */
    margin-top: 4px;
}

/* A simple CSS spinner animation */
.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/*.sidebar .controls {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 8px;
}*/
.sidebar .controls {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 8px;
    flex-shrink: 0; /* ✅ keeps buttons always visible */
}

.sidebar .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
    transition: .2s ease;
    text-align: left;
    color: var(--text);
}

    .sidebar .btn:hover {
        border-color: var(--border);
        background: var(--soft);
    }

    .sidebar .btn .icon {
        width: 16px;
        height: 16px;
        opacity: .9;
    }

/* Header */
.header {
    grid-area: header;
    position: sticky;
    top: 0;
    /*z-index: 1001;*/
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--panel) 70%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

    .header .left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .header .menu-btn {
        display: none;
    }

    .header .title {
        font-weight: 600;
        font-size: 14px;
        color: var(--text);
    }

    .header .actions {
        display: flex;
        gap: 8px;
    }

.ghost-btn {
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: .2s ease;
}

    .ghost-btn:hover {
        /* This adds a 5% black overlay, subtly darkening the button */
        background-color: rgba(0, 0, 0, 0.05);
        /* You can optionally make the border darker too for more contrast */
        border-color: var(--scrollbar-thumb);
    }

/* Make main chat area fill available space */
.main {
    grid-area: main;
    overflow: auto;
    padding: 20px 0 120px;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 80px; /* leave space so messages don't hide behind composer */
    box-sizing: border-box;
}

/* Main wrapper */
.main {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 190px);
    padding: 0 12px;
    box-sizing: border-box;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    flex-direction: column;
    height: 100%;
    display: flex;
}

.msg {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient( 180deg, var(--soft), rgba(var(--soft-rgb), 0.25) );
}

    .msg.user {
        background: transparent;
    }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--soft);
    display: grid;
    place-items: center;
    font-size: 12px;
    color: var(--muted);
    border: 1px solid var(--border);
}

    .avatar.assistant {
        background: linear-gradient(135deg, var(--accent), var(--accent-2));
        color: var(--soft);
    }

.bubble {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    transition: box-shadow .3s ease;
}
    .bubble:hover {
        background: var(--soft);
    }

.msg.user .bubble {
    background: var(--panel); /* ✅ theme-aware */
}

.bubble:hover {
    box-shadow: 0 14px 32px rgba(0,0,0,.45);
}

.bubble h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.bubble p {
    margin: 0;
    color: var(--text);
}

.bubble .meta {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

/* Markdown-ish content */
.bubble pre {
    background: #0c0f14;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 10px;
    overflow: auto;
}

.bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.bubble ul {
    margin: 6px 0 6px 20px;
}

.bubble blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 3px solid var(--border);
    color: #b8c0cc;
}

/* Fix composer at bottom */
.composer {
    grid-area: composer;
    position: sticky; /* stays at bottom of viewport */
    bottom: 0;
    z-index: 10;
    background: linear-gradient(180deg, transparent, var(--panel) 40%, var(--panel) 70%);
    border-top: 1px solid var(--border);
}

    .composer .inner {
        max-width: 860px;
        margin: 0 auto;
        padding: 12px 16px 16px;
    }
.input-wrap {
    display: flex;
    flex-direction: column; /* stack chip row above input row */
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px;
    gap: 8px;
}

/*.input-wrap {
    display: grid;
    grid-template-columns: 1fr auto;*/ /* left: textarea, right: buttons */
    /*gap: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px;
    align-items: center;*/ /* vertical align */
/*}*/

    .input-wrap textarea {
        width: 100%;
    }
textarea {
    background: transparent;
    border: 0;
    outline: none;
    resize: none;
    height: 48px;
    max-height: 220px;
    padding: 10px 12px;
    color: var(--text);
    scrollbar-width: thin;
    scrollbar-color: #2a3240 transparent;
}
.buttons {
    display: flex;
    align-items: center;
    gap: 8px; /* spacing between buttons */
}
.send-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
    transition: .2s ease;
}

    .send-btn:hover {
        color: white;
        background: var(--accent-2);
    }

    .send-btn:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

.mic-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px; /* keeps same width/height as send */
    height: 42px;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
}

    .mic-btn svg {
        color: inherit; /* theme-aware */
    }

    .mic-btn.listening {
        color: var(--danger); /* red when active */
    }

.tips {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 10px;
}
.upload-btn,
.mic-btn,
#sendBtn {
    /*display: inline-flex;*/
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    cursor: pointer;
    transition: .2s ease;
}

    .upload-btn:hover,
    .mic-btn:hover,
    #sendBtn:hover {
        color: white;
        background: var(--accent-2);
    }
    .upload-btn{
        padding:10px;
    }
#sendBtn{
    padding:10px;
}
/* Utilities */
.row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.spacer {
    flex: 1;
}

.badge {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #0f1219;
    color: #c5cbd6;
    font-size: 12px;
}

/* Mobile */
@media (max-width: 1000px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-areas: "header" "main" "composer";
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: 90%;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform .3s ease;
        box-shadow: 30px 0 60px rgba(0,0,0,.45);
        z-index: 20;
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .header .menu-btn {
        display: inline-flex;
    }
}

/* Nice scrollbars (desktop) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--scrollbar-thumb-hover);
    }

.library-bar {
    background: var(--bg-light);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

    .library-bar button {
        background: var(--accent);
        border: none;
        border-radius: 6px;
        padding: 6px 12px;
        color: white;
        cursor: pointer;
    }

        .library-bar button:hover {
            background: var(--accent-2);
        }

.modal {
    display: none; /* This keeps them hidden until opened by your JavaScript */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    /* These rules apply only when the modal is made visible */
    /* They will center the content box */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--panel); /* ✅ theme-aware */
    margin: 7% auto;
    padding: 20px;
    border-radius: 10px;
    width: 400px;
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    /* Set a maximum height to prevent it from growing off-screen */
    max-height: 85vh;
    /* Add a scrollbar if the content inside is too tall */
    overflow-y: auto;
}
    .modal-content h2 {
        margin-top: 0;
        margin-bottom: 12px;
    }

/* Larger sizes */
.modal-lg {
    width: 600px;
}

.modal-xl {
    width: 900px;
}

.modal-xxl {
    width: 1200px;
}


.library-list {
    list-style: none;
    padding: 0;
}

    .library-list li {
        padding: 10px;
        border-radius: 6px;
        cursor: pointer;
        color: var(--text-light);
    }

        .library-list li:hover {
            background: var(--bg-light);
            color: var(--text);
        }
        /* highlight selected item */
        .library-list li.selected {
            background-color: var(--accent);
            color: white;
            border-radius: 4px;
        }
.close {
    float: right;
    font-size: 20px;
    cursor: pointer;
}

.modal-footer {
    margin-top: 20px;
    text-align: right;
}
/* Main container for the new two-panel layout */
.step1-redesigned {
    display: flex;
    gap: 24px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 24px;
}

/* Left sidebar for categories */
.modal-sidebar {
    flex-shrink: 0; /* Prevents the sidebar from shrinking */
    width: 200px;
    border-right: 1px solid var(--border);
    padding-right: 24px;
}

.category-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    font-size: 1rem;
    background-color: transparent;
    border: none;
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
}

    .category-btn:hover {
        background-color: var(--soft);
        color: var(--text);
    }

    .category-btn.active {
        background-color: var(--accent-2);
        color: white;
        font-weight: 500;
    }

/* Main content area on the right */
.modal-main-content {
    flex-grow: 1; /* Allows the main content to take up the remaining space */
}

.category-description {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: 24px;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease;
}

    .btn-primary:hover {
        background: var(--accent-2);
    }

.btn-secondary {
    background: var(--soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    cursor: pointer;
    white-space: nowrap;
}

    .btn-secondary:hover {
        background: var(--border);
    }

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

    .empty-state textarea {
        width: 60%;
        min-height: 80px;
        margin-top: 1rem;
    }

.chat-input {
    border-top: 1px solid #ddd;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

    .chat-input textarea {
        flex: 1;
        min-height: 50px;
    }

.hidden {
    display: none;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 16px;
}

    .empty-state textarea {
        width: 60%;
        min-height: 80px;
        margin: 1rem 0;
        padding: 10px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        background: var(--soft);
        color: var(--text);
        resize: none;
    }

    .empty-state .ghost-btn {
        padding: 10px 16px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        background: var(--panel);
        color: var(--text);
        cursor: pointer;
        transition: 0.2s;
    }

        .empty-state .ghost-btn:hover {
            background: var(--soft);
        }

.three-dots {
    position: absolute;
    right: 10px; /* Adjust as needed */
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #888; /* A light grey color */
    padding: 5px; /* Makes it easier to click */
}

.popup-menu {
    position: absolute;
    /* Use theme variables for colors */
    background-color: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    z-index: 1000;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.popup-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    /* Use theme variables for text color */
    color: var(--text);
}

    .popup-option:hover {
        /* Use a color for hover effect, possibly a lighter version of the background */
        background-color: var(--soft);
    }

#txtRenameChatRoom {
    width: 100%; /* Makes the input fill the parent width */
    padding: 12px;
    margin: 10px 0;
    box-sizing: border-box; /* Ensures padding doesn't increase total width */
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--text);
    background-color: var(--soft);
}

    #txtRenameChatRoom:focus {
        outline: none; /* Removes the default outline */
        border-color: var(--accent); /* Changes border color to accent color on focus */
        box-shadow: 0 0 5px var(--accent);
    }

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    background: var(--bg);
    transition: background 0.3s ease, color 0.3s ease;
}

.login-box {
    background: var(--panel);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    text-align: center;
    color: var(--text);
}

    .login-box .logo {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        margin: 0 auto 12px;
        background: conic-gradient(from 180deg at 50% 50%, var(--accent), var(--accent-2));
        box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 2px 10px rgba(16,163,127,.35);
    }

    .login-box h1 {
        font-size: 20px;
        margin-bottom: 20px;
        font-weight: 600;
    }

    .login-box input {
        width: 100%;
        padding: 12px;
        margin: 10px 0;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        background: var(--soft);
        color: var(--text);
    }

        .login-box input:focus {
            border-color: var(--accent);
            outline: none;
            box-shadow: 0 0 5px var(--accent);
        }

    .login-box button {
        width: 100%;
        padding: 12px;
        margin-top: 16px;
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: var(--radius-sm);
        font-weight: 600;
        cursor: pointer;
        transition: background 0.2s ease;
    }

        .login-box button:hover {
            background: var(--accent-2);
        }

    .login-box .links {
        margin-top: 16px;
        font-size: 14px;
        color: var(--muted);
    }

        .login-box .links a {
            color: var(--accent);
            margin-left: 4px;
        }

.profile-dropdown {
    position: relative;
    display: inline-block;
}

.profile-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: var(--text, #fff);
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 10px;
}

    .profile-btn .chevron {
        width: 14px;
        height: 14px;
        margin-left: 6px;
        opacity: 0.6;
    }
.form-group {
    margin-bottom: 16px;
    position: relative;
}
    .form-group label {
        display: block;
        margin-bottom: 6px;
        font-size: 14px;
        color: var(--text);
        text-align: left;
    }

    .form-group input {
        width: 100%;
        padding: 12px;
        border-radius: 6px;
        border: 1px solid #ccc;
        font-size: 14px;
        background: var(--soft);
        color: var(--text);
    }
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 4px;
        background-color: var(--textarea-background); /* Slightly lighter than modal background */
        color: #fff;
        font-size: 1rem;
        box-sizing: border-box; /* Include padding and border in element's total width and height */
    }

    .form-group textarea {
        min-height: 120px;
        resize: vertical; /* Allow vertical resizing */
    }

        .form-group select:focus,
        .form-group textarea:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.3); /* Assuming primary-rgb for shadow */
        }


.profile-menu {
    position: absolute;
    right: 2px;
    background: var(--panel, #1f1f1f);
    color: var(--text, #fff);
    border: 1px solid var(--border, #333);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 180px;
    z-index: 1000;
    padding: 6px 0;
}

    .profile-menu.hidden {
        display: none;
    }

.menu-item {
    display: block;
    padding: 10px 14px;
    font-size: 14px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

    .menu-item:hover {
        background: rgba(255,255,255,0.1);
    }

.logout-form {
    margin: 0;
    padding: 0;
}

/*.logout-btn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: 14px;
    color: inherit;
    cursor: pointer;
}

    .logout-btn:hover {
        background: rgba(255,0,0,0.15);
        color: #ff6b6b;
    }*/
.logout-btn {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: 14px;
    color: inherit;
    cursor: pointer;
    display: flex; /* flex row */
    align-items: center; /* vertical centering */
    gap: 8px; /* spacing between icon and text */
}

    .logout-btn:hover {
        background: rgba(255,0,0,0.15);
        color: #ff6b6b;
    }

    .logout-btn svg {
        display: block; /* remove baseline offset */
        width: 20px;
        height: 20px;
        flex-shrink: 0; /* keep icon size consistent */
    }


#profileForm {
    display: block; /* not flex */
    height: auto; /* shrink to fit */
}

    #profileForm hr {
        margin: 40px;
    }

.chat-layout {
    display: flex;
    gap: 24px;
    flex: 1 1 auto; /* take remaining height */
    overflow: hidden; /* prevent main scrollbar */
}

.chat-column {
    flex: 0 0 860px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
    border-right: 1px solid var(--border);
    padding-right: 4px;
}
.suggestions-btn {
    display: none;
}
.suggestions-sidebar {
    background: var(--soft);
    overflow-y: auto;
    padding: 12px;
    box-sizing: border-box;
    width: 320px; /* fixed width like left sidebar */
    border-left: 1px solid var(--border);
}
.suggestions-sidebar {
    flex: 0 0 360px;
    height: 100%; /* same as chat-column */
}
/* suggestions sidebar base */
.suggestions-sidebar {
    grid-area: suggestions;
    background: linear-gradient(180deg, var(--panel), var(--panel));
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

/* Header inside suggestions */
.suggestions-header {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 10px;
}

/* Make the chips vertical and small */
.suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Use your existing chip styles but make them block-level in a column */
.suggestion-chip {
    display: block;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--soft);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.3;
    transition: background 0.15s ease, transform 0.08s ease;
    border: 1px solid transparent;
}

    .suggestion-chip:hover {
        background: var(--accent-2);
        color: #fff;
        transform: translateY(-1px);
    }

/* Responsive: stack on small screens */
@media (max-width: 1600px) {
    .chat-layout {
        flex-direction: column;
        gap: 12px;
    }

    .chat-column {
        flex: 1 1 auto;
    }

    .suggestions-btn {
        display: inline-flex; /* or flex/grid depending on your header buttons */
        align-items: center;
        justify-content: center;
        gap: 6px;
        cursor: pointer;
        padding: 8px 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--panel);
    }
    .suggestions-sidebar {
        position: fixed;
        top: var(--header-height, 60px); /* adjust to your header’s real height */
        right: 0;
        bottom: 0;
        width: 90%;
        max-width: 320px;
        transform: translateX(100%);
        transition: transform .3s ease;
        z-index: 20;
        background: var(--soft);
        overflow-y: auto;
    }
        .suggestions-sidebar.open {
            transform: translateX(0);
        }
}

.chat-composer {
    flex: 0 0 auto; /* fixed height */
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

/* New Library modal: grid & cards */
.new-lib-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 12px 0 8px;
}

.option-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
    border: 1px solid rgba(255,255,255,0.02);
    cursor: pointer;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
    text-align: left;
    color: var(--text);
}

    .option-card:hover {
        transform: translateY(-4px);
        background: var(--soft);
        border-color: var(--border);
    }

.option-icon {
    font-size: 22px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
}

.option-title {
    font-weight: 600;
    font-size: 15px;
}

.option-desc {
    font-size: 13px;
    color: var(--muted);
}

/* Make modal grid stack on narrow screens */
@media (max-width: 700px) {
    .new-lib-grid {
        grid-template-columns: 1fr;
    }

    .modal-content.modal-lg {
        width: 92%;
        margin: 6% auto;
    }
}

/* Trustpilot Preview Modal */
#trustpilotPreviewModal .modal-content.modal-xl {
    width: 90%; /* wider than normal */
    max-width: 1200px; /* optional hard cap */
    max-height: 90vh; /* never taller than viewport */
    overflow-y: auto; /* scroll reviews if too tall */
    display: flex;
    flex-direction: column; /* allow footer to stay at bottom */
    margin: 2% auto;
    position: relative;
}

#trustpilotPreviewModal .close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10; /* keep it above scrollable content */
}
/* Company info and review list should scroll inside */
#trustpilot-company-info {
    margin-bottom: 16px;
}

#trustpilot-review-list {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh; /* keep space for header/footer */
    padding-right: 8px;
}

/* Review preview blocks */
.review-preview {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

    .review-preview:last-child {
        border-bottom: none;
    }

/* Footer pinned at bottom */
#trustpilotPreviewModal .modal-footer {
    border-top: 1px solid var(--border);
    padding: 12px;
    background: var(--panel);
    position: sticky;
    bottom: 0;
}
/* optional quick spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 6px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


.input-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto; /* textarea + 3 buttons */
    align-items: center;
    gap: 10px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.file-chip {
    display: flex;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--text);
}

    .file-chip .file-icon {
        margin-right: 6px;
    }

    .file-chip .remove-chip {
        background: none;
        border: none;
        color: var(--muted);
        margin-left: 8px;
        cursor: pointer;
    }
.file-uploader {
    display: flex!important;
    align-items: flex-start; /* Aligns items to the top */
    gap: 15px; /* Space between the button and the list */
}
.guidline-uploader {
    display: inline-flex !important;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding:5px;
}
#file-list-display {
    list-style: none;
    padding: 10px;
    margin: 0;
    font-family: sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background-color: var(--soft);
    border: 1px solid #ccc;
    border-radius: 6px;
    flex: 1;
    min-height: 104px;
    /*overflow-y: auto;*/
}
    #file-list-display li {
        display: flex;
        justify-content: space-between; /* Pushes name and button to opposite ends */
        align-items: center; /* Vertically centers them */
        padding: 5px 10px;
        margin-bottom: 5px;
    }
.remove-file-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
    .remove-file-btn:hover {
        color: var(--danger);
    }
.btn-danger {
    background-color: var(--danger);
    color: white;
    /* Inherits other .btn styles if you have them */
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
}

    .btn-danger:hover {
        opacity: 0.8;
    }
#newLibStepGuideline small {
    color: var(--muted);
    display: block;
    margin-top: 4px;
    text-align: right;
}
/* Style the parent label to be a flex container */
.file-uploader .upload-btn {
    display: flex; /* Arrange children (icon and text) in a row */
    align-items: center; /* Vertically align them in the middle */
    cursor: pointer; /* Show a pointer on hover */
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%; /* Ensure it takes up the full width */
    box-sizing: border-box;
}

/* Style the text span to handle long filenames gracefully */
#fileNameDisplay {
    margin-left: 10px; /* Add some space between the icon and text */
    white-space: nowrap; /* Prevent the text from wrapping to a new line */
    overflow: hidden; /* Hide any text that overflows the container */
    text-overflow: ellipsis; /* Add "..." if the filename is too long */
    flex-grow: 1; /* Allow the text to take up available space */
}
/* Base style for the option cards */
.option-card.new-chat-option {
    border: 2px solid #ddd; /* A subtle default border */
    background-color: var(--panel); /* A light, complementary background */
    transition: all 0.2s ease-in-out; /* Smooth transition for all changes */
}

    /* Style for when the user hovers over an option */
    .option-card.new-chat-option:hover {
        border-color: #aaa;
        transform: translateY(-2px); /* Lifts the card slightly */
    }

    /* --- THIS IS THE KEY --- */
    /* Style for the selected/active option card */
    .option-card.new-chat-option.active {
        border-color: #007bff; /* A bright color to show selection */
        background-color: var(--accent);
        transform: translateY(-2px);
    }

.complianceBtn{
    color: inherit;
}
.progress-bar-container {
    width: 100%;
    background-color: var(--soft);
    border-radius: 5px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-bar {
    width: 0%; 
    height: 24px;
    background-color: var(--accent); 
    text-align: center;
    line-height: 24px;
    color: white;
    transition: width 0.4s ease; /* Smooth animation for the bar */
}

/* in wwwroot/css/prompt-library.css */

.prompt-library-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #333;
    padding-bottom: 1rem;
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background-color: #2a2a2e;
    border: 2px dashed #555;
    border-radius: 8px;
    margin-top: 2rem;
}

.empty-state-icon .icon {
    width: 64px;
    height: 64px;
    stroke: #777;
    margin-bottom: 1rem;
}

/* Prompt Definition Accordion */
.prompt-definition {
    background-color: var(--soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 32px;
}

    .prompt-definition summary {
        font-weight: 600;
        padding: 16px;
        cursor: pointer;
        outline: none;
    }

    .prompt-definition .prompt-parts {
        padding: 0 16px 16px 16px;
        border-top: 1px solid var(--border);
    }

    .prompt-definition h4 {
        color: var(--text);
        font-size: 0.8rem;
        text-transform: uppercase;
        margin: 16px 0 4px 0;
    }

    .prompt-definition p {
        margin: 0;
        color: var(--text);
    }
.date-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-filter {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 16px; /* Pill shape */
    cursor: pointer;
    transition: all 0.2s ease;
    /* --- THEME UPDATES --- */
    border: 1px solid var(--border);
    background-color: var(--soft);
    color: var(--muted);
}

    .btn-filter:hover {
        /* Use a slightly lighter background on hover */
        background-color: var(--textarea-background);
        color: var(--text);
    }

    .btn-filter.active {
        /* Use your main accent color for the selected state */
        background-color: var(--accent);
        border-color: var(--accent-2);
        color: white; /* Use a high-contrast color for text */
        font-weight: 500;
    }
.schedule-options {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
}

    .schedule-options legend {
        padding: 0 8px;
        font-weight: 600;
        color: #eee;
    }

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.8rem;
}
.markdown-body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text); /* Use the main text color for the theme */
}

    .markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 {
        color: var(--text); /* Use the main text color for headings */
        margin-top: 1.5em;
        margin-bottom: 0.5em;
        line-height: 1.2;
    }

    .markdown-body h1 {
        font-size: 2.2em;
        /* Use the theme's border color */
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.3em;
    }

    .markdown-body h2 {
        font-size: 1.8em;
        /* Use the theme's border color */
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.3em;
    }

    .markdown-body h3 {
        font-size: 1.5em;
    }

    .markdown-body h4 {
        font-size: 1.2em;
    }

    .markdown-body p {
        margin-bottom: 1em;
    }

    .markdown-body ul, .markdown-body ol {
        margin-left: 20px;
        margin-bottom: 1em;
        list-style-type: disc;
    }

    .markdown-body ol {
        list-style-type: decimal;
    }

    .markdown-body li {
        margin-bottom: 0.5em;
    }

    .markdown-body strong {
        font-weight: bold;
        /* Use your theme's main accent color for consistency */
        color: var(--accent);
    }
.report-metadata {
    background-color: var(--border);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent);
}

    .report-metadata p {
        margin: 0;
        padding: 2px 0;
        color: var(--muted); 
    }

    .report-metadata strong {
        color: var(--text); 
    }
    
.header-title h1 {
    font-size: 1.8rem;
    margin: 0 0 4px 0;
}

.prompt-id {
    font-size: 0.8rem;
    color: var(--muted);
    font-family: monospace;
}

.header-actions {
    display: flex;
    gap: 12px;
}
.page-container {
    padding: 24px;
    height: 100%;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

    .page-header h1 {
        font-size: 1.8rem;
        margin: 0;
    }

    .page-header .btn {
        display: flex;
        align-items: center;
        gap: 8px;
    }

.prompt-meta-actions {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
    font-size: 0.8rem;
}

    .prompt-meta-actions a {
        margin-left: 16px;
    }

/* Run History Table */
.run-history h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.run-history table {
    width: 100%;
    border-collapse: collapse;
}

.run-history th, .run-history td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.run-history th {
    color: #aaa;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.run-history tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
.run-history .question-cell {
    max-width: 250px; /* Adjust width as needed */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-queued {
    color: var(--queued-text);
    background-color: rgba(var(--queued-rgb), 0.2);
}
.status-completed {
    color: var(--success-text);
    background-color: rgba(16, 185, 129, 0.2);
}

.status-failed {
    color: var(--failed-text);
    background-color: rgba(239, 68, 68, 0.2);
}
.status-processing {
    color: var(--processing-text);
    background-color: rgba(var(--processing-rgb), 0.2);
}




.form-column .form-group textarea {
    min-height:100px;
}

.step-indicator {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.step {
    background: var(--soft);
    color: var(--muted);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid var(--border);
    transition: background 0.2s ease, color 0.2s ease;
}

    .step.active {
        background: var(--accent);
        color: var(--text);
        border-color: var(--accent-2);
    }

.form-flex {
    display: flex;
    gap: 25px;
}

.form-column {
    flex: 1;
}

.preview-column {
    flex: 1;
    background: var(--soft);
    border-left: 2px solid var(--border);
    padding: 15px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.prompt-preview {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    height: 812px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: var(--text);
}

/* Tooltip / Info icon */
.info-icon {
    cursor: help;
    margin-left: 6px;
    color: var(--muted);
    transition: color 0.2s ease;
}

    .info-icon:hover {
        color: var(--accent);
    }

/* Small secondary button */
.btn-small {
    margin-top: 5px;
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.85em;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

    .btn-small:hover {
        background: var(--accent);
        border-color: var(--accent-2);
        color: #fff;
    }

/* Outline secondary button (footer) */
.btn-outline-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px; /* matches .btn-primary and .btn-secondary */
    border-radius: var(--radius-sm); /* consistent with your button corners */
    font-size: 0.95em;
    font-weight: 500;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

    .btn-outline-secondary:hover {
        background: var(--accent);
        border-color: var(--accent-2);
        color: #fff;
        box-shadow: var(--shadow);
    }

    .btn-outline-secondary:active {
        background: var(--accent-2);
        border-color: var(--accent-2);
    }


.modal .subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1em;
}

.hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5em;
}

.examples {
    list-style: disc;
    margin-left: 1.5em;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.date-filter-container.scrollable {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border);
    padding: 0.5em;
    border-radius: 0.5em;
}
#dateFilterSectionRunNow {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
#selectionSummary{
    min-height:20px;
}

input[type="file"] {
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
}

    input[type="file"]::file-selector-button {
        background-color: var(--accent);
        color: var(--text);
        border: none;
        padding: 6px 14px;
        border-radius: 6px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

        input[type="file"]::file-selector-button:hover {
            background-color: var(--accent-2);
        }

        input[type="file"]::file-selector-button:active {
            background-color: #004fa8;
        }





/* Style for the status lists (processing and failed) */
.library-status-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--soft);
}

    .library-status-list li {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

        .library-status-list li:last-child {
            border-bottom: none;
        }

/* Specific styling for the "Failed" section */
.failed-title {
    color: var(--danger);
}

.failed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.failed-name {
    font-weight: 500;
}

.failed-actions button {
    margin-left: 8px;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-retry {
    background-color: var(--accent-2);
    color: white;
    border-color: var(--accent);
}

.btn-clear {
    background-color: transparent;
    color: var(--muted);
    border-color: var(--muted);
}

    .btn-clear:hover {
        background-color: var(--danger);
        color: white;
        border-color: var(--danger);
    }
.section-title h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .section-title h3 svg {
        flex-shrink: 0;
    }

    .section-title h3 span {
        line-height: 1.4;
    }
/* Typing Indicator Animation */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 0; /* Add some vertical space */
}

    .typing-indicator span {
        height: 8px;
        width: 8px;
        border-radius: 50%;
        background-color: var(--muted); /* Use your theme's muted color */
        margin: 0 2px;
        animation: bounce 1.2s infinite ease-in-out;
    }

        /* Add delays to create the wave effect */
        .typing-indicator span:nth-child(2) {
            animation-delay: -1.0s;
        }

        .typing-indicator span:nth-child(3) {
            animation-delay: -0.8s;
        }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

.bubble-content details {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.bubble-content summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--muted);
    outline: none; /* Removes the focus ring in some browsers */
}

    .bubble-content summary:hover {
        color: var(--accent);
    }

.bubble-content details ul {
    margin-top: 8px;
    margin-left: 20px;
    font-size: 0.9rem;
}