:root {
    --kb-gradient-start: #0b1444;
    --kb-gradient-end: #1f6feb;
    --kb-gradient: linear-gradient(135deg, var(--kb-gradient-start), var(--kb-gradient-end));
    --kb-card-radius: 16px;
    --kb-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

html, body {
    height: 100%;
    background-color: #f4f6fb;
}

/* --- Sidebar ------------------------------------------------------- */

.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--kb-gradient);
}

.sidebar .brand {
    font-weight: 700;
    letter-spacing: .02em;
}

.sidebar .nav-link {
    border-radius: 999px;
    padding: .55rem 1rem;
    margin-bottom: .25rem;
    color: rgba(255, 255, 255, .75);
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, .92);
    color: var(--kb-gradient-end);
    font-weight: 700;
}

.page-content {
    max-width: 1200px;
}

/* --- Gradient page hero + pill tabs --------------------------------- */

.page-hero {
    background: var(--kb-gradient);
    border-radius: 20px;
    padding: 1.75rem 2rem;
    color: #fff;
    box-shadow: var(--kb-shadow);
    margin-bottom: 1.5rem;
}

.page-hero h1, .page-hero h3, .page-hero h4 {
    color: #fff;
    font-weight: 700;
    margin-bottom: .15rem;
}

.page-hero .subtitle {
    color: rgba(255, 255, 255, .75);
}

.page-hero .btn-outline-light,
.page-hero .btn-primary {
    border-radius: 999px;
}

.page-hero .badge {
    background-color: rgba(255, 255, 255, .15) !important;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
}

.pill-tabs {
    display: flex;
    gap: .25rem;
    margin-top: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .25);
}

.pill-tabs .nav-link {
    color: rgba(255, 255, 255, .75);
    border: none;
    border-radius: 10px 10px 0 0;
    padding: .55rem 1.1rem;
    font-weight: 600;
}

.pill-tabs .nav-link.active {
    background-color: rgba(255, 255, 255, .95);
    color: var(--kb-gradient-end);
}

/* --- Cards / tables -------------------------------------------------- */

.card {
    border: none;
    border-radius: var(--kb-card-radius);
    box-shadow: var(--kb-shadow);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border: none;
    color: #64748b;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .05em;
    font-weight: 700;
}

.table td {
    vertical-align: middle;
    border-color: #eef1f6;
}

.badge {
    border-radius: 999px;
    padding: .4em .8em;
    font-weight: 600;
}

/* --- Buttons ----------------------------------------------------------- */

.btn {
    border-radius: 999px;
    font-weight: 600;
}

.btn-primary {
    background: var(--kb-gradient);
    border: none;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--kb-gradient);
    opacity: .9;
}

/* --- App-specific bits (unchanged behavior, refreshed look) ----------- */

.folder-node {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
}

.folder-node:hover {
    background-color: #f1f3f5;
}

.folder-node.active {
    background-color: #e7f1ff;
    font-weight: 600;
}

.doc-row {
    cursor: grab;
}

.doc-row.selected-for-chat {
    background-color: #fff8e1;
}

.chat-dropzone {
    border: 2px dashed #adb5bd;
    border-radius: var(--kb-card-radius);
    padding: 16px;
    min-height: 120px;
    background-color: #fafafa;
}

.chat-dropzone.drag-over {
    border-color: #1f6feb;
    background-color: #eef5ff;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    background: #fff3cd;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #ffeeba;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

/* --- Chat: message list + bubbles -------------------------------------- */

.chat-message-list {
    border: 1px solid #eef1f6;
    border-radius: var(--kb-card-radius);
    padding: 1rem;
    height: 420px;
    overflow-y: auto;
    background-color: #fff;
}

.chat-bubble {
    border-radius: 16px;
}

.chat-thinking {
    opacity: .65;
}

/* Gemini-style skin (default): matches the app's blue gradient theme. */
.chat-theme-gemini .chat-bubble-user {
    background: var(--kb-gradient);
    color: #fff;
}

.chat-theme-gemini .chat-bubble-assistant {
    background-color: #f1f4fb;
    color: #1a2340;
}

/* ChatGPT-style skin: dark message pane, green/dark bubbles - purely a demo skin. */
.chat-theme-chatgpt .chat-message-list {
    background-color: #343541;
    border-color: #343541;
}

.chat-theme-chatgpt .chat-bubble-user {
    background-color: #10a37f;
    color: #fff;
}

.chat-theme-chatgpt .chat-bubble-assistant {
    background-color: #444654;
    color: #ececf1;
}

.chat-theme-chatgpt .text-muted {
    color: #acacbe !important;
}

.chat-theme-chatgpt .chat-input-bar {
    background-color: #40414f;
    border-color: #565869;
}

.chat-theme-chatgpt .chat-input {
    background-color: transparent;
    color: #ececf1;
}

.chat-theme-chatgpt .chat-input::placeholder {
    color: #8e8ea0;
}

/* --- Chat: input bar (paperclip + actions + text + send) --------------- */

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid #dfe3ee;
    border-radius: 999px;
    padding: .35rem .5rem .35rem 1rem;
    background-color: #fff;
}

.chat-input-bar .chat-input {
    border: none;
    box-shadow: none;
    flex: 1;
}

.chat-input-bar .chat-input:focus {
    box-shadow: none;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    color: #64748b;
}

.btn-icon:hover {
    background-color: #f1f4fb;
}

.btn-icon.dropdown-toggle::after {
    display: none;
}

.chat-attach-input {
    display: none;
}

.action-pill {
    background-color: #eef1f6 !important;
    color: #1a2340 !important;
    border: 1px solid #dfe3ee;
}

.btn-clear-action {
    border: none;
    background: transparent;
    color: inherit;
    margin-left: .4rem;
    padding: 0;
    font-size: .75rem;
    cursor: pointer;
}

/* --- Chat: sidebar history items ---------------------------------------- */

.chat-history-item {
    padding: 6px 8px;
    border-radius: 10px;
    margin-bottom: 2px;
}

.chat-history-item.active {
    background-color: #eef1f6;
}

/* --- Attachment -> knowledge base picker popup -------------------------- */

.kb-picker-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.kb-picker-modal {
    background-color: #fff;
    border-radius: var(--kb-card-radius);
    box-shadow: var(--kb-shadow);
    padding: 1.25rem;
    width: min(420px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
}
