@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Text:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Default: Dark Mode */
    --bg-body: #0f0f0f;
    --bg-sidebar: #161618;
    --bg-chat: #0f0f0f;
    --bg-code: #1e1e1e;
    --bg-input: #27272a;
    --bg-hover: #27272a;
    --border-color: #3f3f46;

    --accent-primary: #2563eb;
    --accent-secondary: #4f46e5;
    --gradient-main: linear-gradient(135deg, #A5B4FC, #818CF8);

    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --bubble-user-bg: #27272a;
    --bubble-ai-bg: #000000;

    /* Legacy support for existing styles */
    --primary-color: var(--accent-primary);
    --secondary-color: var(--bg-input);
    --text-color: var(--text-main);
    --subheading-color: var(--text-muted);
    --placeholder-color: #6c6c6c;
    --hover-color: var(--bg-hover);
    --secondary-hover-color: #dbe1ea;

    /* Sidebar Dimensions */
    --sidebar-width-expanded: 220px;
    --sidebar-width-collapsed: 60px;
    --sidebar-width: var(--sidebar-width-expanded);

    /* Transition — standard duration for uniform theme toggle */
    --smooth-transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

[data-theme="light"] {
    --bg-body: #f9fafb;
    --bg-sidebar: #ffffff;
    --bg-chat: #ffffff;
    --bg-code: #f3f4f6;
    --bg-input: #ffffff;
    --bg-hover: #f3f4f6;
    --border-color: #e5e7eb;

    --text-main: #111827;
    --text-muted: #6b7280;
    --bubble-user-bg: #f3f4f6;
    --bubble-ai-bg: #fcfcfd;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    transition: background-color var(--smooth-transition), color var(--smooth-transition);
}

/* --- Sidebar Base Styles --- */
.sidebar-base {
    background-color: var(--bg-sidebar);
    border-color: var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: var(--sidebar-width);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), width 0.3s ease;
    z-index: 1000;
}

.sidebar-base.shrunken {
    width: var(--sidebar-width-collapsed);
    overflow:visible;
}

/* --- Left Sidebar --- */
.sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    border-right: 1px solid var(--border-color);
}

.logo {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    /* gap: 10px; */
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.5px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--smooth-transition);
    color: var(--text-main);
}

.logo-svg {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-left.shrunken .logo-text {
    opacity: 0;
    display: none;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.nav-menu::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--smooth-transition);
    white-space: nowrap;
    font-size: 13px;
}

.nav-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--bg-hover);
    color: var(--accent-primary);
    font-weight: 500;
}

[data-theme="dark"] .nav-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: #60a5fa;
}

.nav-icon {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.nav-text {
    opacity: 1;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.sidebar-left.shrunken .nav-item {
    justify-content: center;
    padding: 10px 0;
}

.sidebar-left.shrunken .nav-icon {
    margin: 0;
    min-width: unset;
}

.sidebar-left.shrunken .nav-text {
    display: none;
    opacity: 0;
}

/* Workspace management when shrunken */
.sidebar-left.shrunken .workspace-fieldset {
    display: none !important;
}

.workspace-collapsed-icon {
    display: none !important;
}

.sidebar-left.shrunken .workspace-collapsed-icon {
    display: flex !important;
    justify-content: center;
    padding: 10px 0;
}

.user-profile {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition);
}

.user-avatar-profile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #A5B4FC, #818CF8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.user-text {
    opacity: 1;
    transition: opacity var(--smooth-transition);
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
}

.user-email {
    font-size: 10px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
    /* Hidden as requested */
}

.sidebar-left.shrunken .user-profile {
    justify-content: center;
    padding: 15px 0;
}

.sidebar-left.shrunken .user-text {
    display: none;
    opacity: 0;
}

.user-menu {
    display: none !important;
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 1100;
}

.user-menu.open {
    display: block !important;
}

.sidebar-left.shrunken .user-menu {
    left: 65px;
    bottom: 10px;
    width: 200px;
    right: auto;
    z-index: 9999;
}

.sidebar-toggle-btn {
    position: absolute;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--smooth-transition);
    z-index: 10;
}

.sidebar-left .sidebar-toggle-btn {
    right: 10px;
    top: 14px;
}

.sidebar-left.shrunken .sidebar-toggle-btn {
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    top: 14px;
    right: auto;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-chat);
    position: relative;
    min-width: 0;
    transition: background-color var(--smooth-transition), margin 0.3s ease;
}

.main-header {
    height: 48px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-chat);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
}

.header-title h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
    transition: color var(--smooth-transition);
}

.header-title span {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    transition: color var(--smooth-transition);
}

.version-badge {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: 'Fira Code', monospace;
    transition: background-color var(--smooth-transition), color var(--smooth-transition), border-color var(--smooth-transition);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}

.release-tag {
    background: var(--accent-primary);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all var(--smooth-transition);
}

.action-buttons-row {
    height: 44px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
}

.btn-icon-sub {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    transition: all var(--smooth-transition);
}

.btn-icon-sub:hover {
    background-color: var(--bg-hover);
    border-color: var(--text-muted);
}

/* --- Chat Area --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.chat-container::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    width: fit-content;
    animation: fadeInUp 0.3s ease-out;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
    flex-direction: row;
}

.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    transition: background-color var(--smooth-transition), color var(--smooth-transition);
}

.message.user .message-icon {
    background: #3f3f46;
    color: white;
}

.message.ai .message-icon {
    background: var(--gradient-main);
    color: white;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    transition: background-color var(--smooth-transition), color var(--smooth-transition), border-color var(--smooth-transition);
}

.message.user .message-bubble {
    background-color: var(--bubble-user-bg);
    color: var(--text-main);
}

.message.ai .message-bubble {
    background-color: var(--bubble-ai-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    width: 100%;
    /* padding: 0 !important; */
}

[data-theme="light"] .message-bubble table th,
[data-theme="light"] .message-bubble table td {
    background-color: #ffffff;
    color: var(--text-main);
}

/* --- Input Area --- */
.input-area-wrapper {
    padding: 12px 24px;
    background-color: var(--bg-chat);
    transition: background-color var(--smooth-transition), color var(--smooth-transition);
}

.input-box {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    display: flex;
    align-items: flex-end;
    padding: 6px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all var(--smooth-transition);
}

.input-box:focus-within {
    border-color: var(--accent-primary);
}

.input-box textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    outline: none;
    line-height: 1.5;
    padding: 10px 14px;
    scrollbar-width: none;
    transition: color var(--smooth-transition);
}

.input-box textarea::-webkit-scrollbar {
    display: none;
}

.input-box form {
    display: flex;
    align-items: flex-end;
    width: 100%;
    gap: 4px;
}

.input-actions-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-bottom: 3px;
}

.send-btn {
    width: 34px;
    height: 34px;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--smooth-transition);
    font-size: 16px;
    opacity: 0.15;
    pointer-events: none;
    margin-bottom: 2px;
}

.send-btn.active {
    opacity: 1;
    pointer-events: auto;
    background: var(--text-main);
    color: var(--bg-body);
}

[data-theme="light"] .send-btn {
    background: #000000;
    color: #ffffff;
}

.input-btn-minimal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--smooth-transition);
    margin-bottom: 1px;
}

.input-btn-minimal:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

/* LLM source pill inside the query input row */
#llm-source-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--smooth-transition);
    margin-bottom: 3px;
    letter-spacing: 0.01em;
}
#llm-source-pill:hover {
    border-color: var(--accent-primary);
    color: var(--text-main);
    background: var(--bg-input);
}

.disclaimer-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
}

/* Right Sidebar */
.right-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease, background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
    z-index: 1000;
}

.right-sidebar.collapsed {
    transform: translateX(100%);
}

.right-sidebar.settings-expanded {
    width: 50vw;
    transform: translateX(0);
}

.main-content.settings-pushed {
    margin-right: 50vw;
}

.right-sidebar.studio-expanded {
    width: 30vw;
    transform: translateX(0);
}

.main-content.studio-pushed {
    margin-right: 30vw;
}

.right-sidebar.shrunken {
    width: var(--sidebar-width-collapsed);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.history-list::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.history-item {
    padding: 8px 4px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--smooth-transition);
    white-space: nowrap;
    overflow: hidden;
    color: var(--text-main);
    position: relative;
}

.history-item-actions {
    position: absolute;
    right: 4px;
    opacity: 0;
    transition: all var(--smooth-transition);
    color: var(--text-muted);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 14px;
    z-index: 10;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-item-actions:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.history-actions-menu {
    position: fixed;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    min-width: 140px;
    padding: 4px;
    display: none;
}

.history-actions-menu.active {
    display: block;
}

.history-action-option {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--smooth-transition);
}

.history-action-option:hover {
    background: var(--bg-hover);
}

.history-action-option.delete {
    color: #ef4444;
}

.history-action-option.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.history-item:hover {
    background-color: var(--bg-hover);
    padding-right: 32px;
}

.history-item.active {
    background-color: var(--bg-hover);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

/* --- Workspace Styles --- */
.workspace-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #d3c7c7;
    transition: all var(--smooth-transition);
    position: relative;
    cursor: pointer;
}

.workspace-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.workspace-item-icon {
    font-size: 12px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.workspace-item-info {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    max-width: 140px;
}

.workspace-file-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.2;
}

.workspace-file-type {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.6;
    letter-spacing: 0.3px;
}

.workspace-item-remove {
    opacity: 0;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--smooth-transition);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.workspace-item:hover .workspace-item-remove {
    opacity: 1;
}

.workspace-item-remove:hover {
    color: #ef4444;
}

#workspace-content::-webkit-scrollbar {
    width: 4px;
}

#workspace-content::-webkit-scrollbar-track {
    background: transparent;
}

#workspace-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

#workspace-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

#workspace-content {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.history-icon {
    font-size: 14px;
    color: var(--text-muted);
    min-width: 20px;
    text-align: center;
    transition: color var(--smooth-transition), opacity var(--smooth-transition);
}

.history-text {
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.right-sidebar.shrunken .history-text {
    opacity: 0;
    width: 0;
    display: none;
}

.sidebar-right.shrunken .history-item {
    justify-content: center;
    padding: 12px 0;
}

/* --- FAQ Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-body);
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color var(--smooth-transition);
}

.faq-item {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.faq-question {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 5px;
}

.faq-answer {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.right-sidebar-header {
    height: 48px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
}

.right-sidebar-header h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.faq-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.faq-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--smooth-transition);
}

.faq-item:hover {
    border-color: var(--accent-primary);
    background-color: var(--bg-hover);
}

.faq-question {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 4px;
    transition: color var(--smooth-transition);
}

.faq-answer {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    transition: color var(--smooth-transition);
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeInUp 0.3s ease-out;
}

.user-message {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.user-message .message-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.user-avatar-chat {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bot-avatar-chat {
    background: #e0e7ff;
    color: var(--primary-color);
}

.message-content {
    flex: 1;
    max-width: 85%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.user-message .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-bubble {
    background: var(--secondary-color);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: var(--subheading-color);
    margin-top: 4px;
    padding-left: 4px;
}

/* Data table in messages */
.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.8rem;
}

.message-bubble table th,
.message-bubble table td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
    background: black;
}

.message-bubble table th {
    background-color: #000000;
    font-weight: 600;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
}

.table-container table {
    margin: 0 !important;
    min-width: 100%;
}

/* Panels */
.data-panel,
.trace-panel {
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 1rem;
    margin: 0 1.5rem 1rem;
    display: none;
}

.data-panel.active,
.trace-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.panel-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color);
}

.panel-close {
    cursor: pointer;
    color: var(--subheading-color);
    transition: all var(--smooth-transition);
}

.panel-close:hover {
    color: var(--text-color);
}

.trace-log {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.75rem;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
}

.data-content {
    background: white;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 55vh;
    overflow-y: auto;
    font-size: 0.85rem;
}

.sql-display {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.insights-content {
    background: var(--bg-sidebar);
    border-radius: 12px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.insights-easy-view,
.insights-technical-view {
    display: none;
}

.insights-easy-view.active,
.insights-technical-view.active {
    display: block;
}

.insights-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-hover);
    padding: 4px;
    border-radius: 10px;
    width: fit-content;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all var(--smooth-transition);
    color: var(--text-muted);
}

.toggle-btn:hover {
    color: var(--text-main);
}

.toggle-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-sidebar);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all var(--smooth-transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.stat-card.success {
    border-bottom: 3px solid #10b981;
}

.stat-card.warning {
    border-bottom: 3px solid #f59e0b;
}

.stat-card.danger {
    border-bottom: 3px solid #ef4444;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--smooth-transition);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    transition: color var(--smooth-transition);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.insights-section {
    margin-bottom: 1.5rem;
}

.insights-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.insights-section ul {
    margin: 0;
    padding-left: 1.5rem;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.6;
}

.insights-section li {
    margin-bottom: 0.5rem;
}

.insights-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}

.insights-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.insights-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accordion-item {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    padding: 0.5rem 0.75rem;
    transition: all var(--smooth-transition);
}

.accordion-header {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem;
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
    transition: color var(--smooth-transition);
}

.accordion-header:hover {
    color: #111827;
}

.accordion-icon {
    font-size: 0.9rem;
    color: #64748b;
    transition: color var(--smooth-transition), transform var(--smooth-transition);
}

.accordion-content {
    display: none;
    margin-top: 0.5rem;
}

.accordion-content.open {
    display: block;
}

/* File upload hidden input */
#file-upload {
    display: none;
}

/* Upload status */
.upload-status {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: 6px;
    margin: 0.5rem 0.75rem;
}

/* Responsive Table Styles */
.responsive-table-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 12px 0;
    background: var(--bg-sidebar);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition);
}

.table-scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--bg-hover);
    transition: scrollbar-color var(--smooth-transition);
}

.table-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-main);
}

.data-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.data-table thead {
    background: rgba(37, 99, 235, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    background: rgba(37, 99, 235, 0.05);
    transition: background-color var(--smooth-transition), color var(--smooth-transition), border-color var(--smooth-transition);
}

.data-table th.row-number-header {
    width: 60px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.data-table td {
    padding: 10px 16px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--smooth-transition), border-color var(--smooth-transition), background-color var(--smooth-transition);
}

.data-table td.row-number-cell {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    background: var(--bg-hover);
    transition: background-color var(--smooth-transition), color var(--smooth-transition);
}

.data-table tbody tr {
    transition: background-color var(--smooth-transition);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Pagination Styles */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--smooth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 13px;
}

.table-info {
    padding: 10px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .data-table {
        min-width: 500px;
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }

    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-info {
        text-align: center;
    }

    .pagination-controls {
        justify-content: center;
    }

    .pagination-btn {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
}



/* Custom Dialog */
.custom-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 20px;
    backdrop-filter: blur(2px);
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-dialog {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), box-shadow var(--smooth-transition);
}

.custom-dialog-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color var(--smooth-transition);
}

.custom-dialog-body {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    transition: color var(--smooth-transition);
}

.custom-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.btn-dialog {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--smooth-transition);
}

.btn-dialog-cancel {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
    transition: background-color var(--smooth-transition), border-color var(--smooth-transition), color var(--smooth-transition);
}

.btn-dialog-cancel:hover {
    background: var(--bg-hover);
}

.btn-dialog-confirm {
    background: var(--accent-primary);
    color: white;
}

.btn-dialog-confirm:hover {
    opacity: 0.9;
}

.btn-dialog-danger {
    background: #ef4444;
    color: white;
}

.btn-dialog-danger:hover {
    opacity: 0.9;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ─── Table Picker Panel ─────────────────────────────────────────────────── */
/* Loading state */
.tps-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}
.tps-loading-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: tps-spin 0.8s linear infinite;
}
@keyframes tps-spin { to { transform: rotate(360deg); } }

/* Group label */
.tps-group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 12px;
}
.tps-group-label i { font-size: 11px; }

/* Source filter chips bar */
.tps-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 1rem;
}
.tps-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
    white-space: nowrap;
}
.tps-filter-chip i {
    font-size: 11px;
}
.tps-filter-chip:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}
.tps-filter-chip.tps-chip-active {
    background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-input));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 600;
}
/* Count badge on chip */
.tps-chip-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    transition: background 0.15s, color 0.15s;
}
.tps-filter-chip.tps-chip-active .tps-chip-count {
    background: color-mix(in srgb, var(--accent-primary) 20%, var(--bg-input));
    color: var(--accent-primary);
}

/* Group section wrapper */
.tps-group-section { margin-bottom: 24px; }

/* Cards grid — 2 compact columns */
.tps-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

/* Individual card — horizontal row layout */
.tps-card {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    user-select: none;
}
.tps-card:hover {
    background: color-mix(in srgb, var(--accent-primary) 6%, var(--bg-hover));
    border-color: var(--border-color);
    border-left-color: var(--accent-primary);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.08);
}
.tps-card .tps-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 14px;
    flex-shrink: 0;
}
.tps-card .tps-card-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.tps-card .tps-card-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-all;
    line-height: 1.35;
}
.tps-card .tps-card-sub {
    font-size: 10.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tps-card .tps-card-arrow {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
}
.tps-card:hover .tps-card-arrow {
    opacity: 1;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
}

/* ── Table picker card hover preview ──────────────────────────────────── */
.tps-card { position: relative; }

.tps-preview-pop {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    padding: 10px 12px;
    min-width: 340px;
    max-width: 520px;
    pointer-events: none;
}
.tps-preview-pop.tps-pop-visible { display: block; }

.tps-preview-pop-title {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 7px;
}
.tps-preview-pop table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}
.tps-preview-pop th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 600;
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tps-preview-pop td {
    padding: 3px 8px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 50%, transparent);
    color: var(--text-main);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tps-preview-pop tr:last-child td { border-bottom: none; }
.tps-preview-pop-loading {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 0;
}

/* Empty state */
.tps-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    gap: 10px;
    color: var(--text-muted);
    font-size: 13px;
}
.tps-empty i { font-size: 32px; opacity: 0.3; margin-bottom: 4px; }

/* Generic Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--smooth-transition);
    border: none;
    font-size: 14px;
    outline: none;
    line-height: 1.5;
}

.btn-black {
    background-color: #000000;
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-black:hover {
    background-color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-black:active {
    transform: translateY(0);
    background-color: #000000;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--secondary-color);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}

/* Mobile Responsiveness */
@media (max-width: 900px) {

    .sidebar-left,
    .right-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }

    .right-sidebar {
        transform: translateX(100%);
    }

    .sidebar-left.open,
    .right-sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    @keyframes bounce {

        0%,
        80%,
        100% {
            transform: scale(0);
        }

        40% {
            transform: scale(1.0);
        }
    }

    .suggestion-item {
        background: var(--bg-sidebar);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 15px;
        width: 220px;
        /* cursor: none; */
        transition: all var(--smooth-transition);
        text-align: center;
    }

    .suggestion-item:hover {
        border-color: var(--accent-primary);
        background-color: var(--bg-hover);
        transform: translateY(-2px);
    }

    .suggestion-item i {
        display: block;
        font-size: 24px;
        color: var(--accent-primary);
        margin-bottom: 10px;
    }

    .suggestion-item p {
        font-size: 13px;
        color: var(--text-main);
    }

}

/* --- Global Upload Menu --- */
.upload-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 12px);
    left: 10px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    width: max-content;
    min-width: 140px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: slideUpMenu 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
    -webkit-font-smoothing: antialiased;
}

.upload-menu.open {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--smooth-transition);
    text-align: left;
    background: transparent;
}

.upload-option:hover {
    background: var(--bg-hover);
    transform: translateX(6px);
}

.upload-option-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: transform var(--smooth-transition), background-color var(--smooth-transition), color var(--smooth-transition);
}

.upload-option:hover .upload-option-icon {
    transform: scale(1.1);
}

.icon-dataset {
    background: rgba(37, 99, 235, 0.15);
    color: #3b82f6;
}

.icon-knowledge {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.upload-option-text {
    flex: 1;
}

.upload-option-text h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    white-space: nowrap;
    letter-spacing: -0.2px;
    transition: color var(--smooth-transition);
}

.upload-option-text p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 1px 0 0 0;
    line-height: 1.3;
    font-weight: 400;
    transition: color var(--smooth-transition);
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.nav-sub-item {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--smooth-transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-sub-item.active {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
    font-weight: 600;
}

.nav-sub-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.ocr-task-item:hover {
    transform: translateY(-1px);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* --- Thinking & Loading Animations --- */
.intel-loader-container {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.intel-loader-container .message-icon {
    border-radius: 50% !important;
}

.intel-loader-ring {
    position: absolute;
    top: -3px;
    left: -3px;
    width: calc(100% + 6px);
    height: calc(100% + 6px);
    pointer-events: none;
    animation: intel-rotate 2s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

.intel-loader-ring svg {
    width: 100%;
    height: 100%;
}

.intel-loader-ring circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    /* 2 * PI * 18 */
    stroke-dashoffset: 113.1;
    animation: intel-draw 2.5s cubic-bezier(0.4, 0.0, 0.2, 1) infinite;
}

@keyframes intel-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes intel-draw {
    0% {
        stroke-dashoffset: 113.1;
        stroke: var(--accent-primary);
    }

    50% {
        stroke-dashoffset: 0;
        stroke: #a78bfa;
    }

    100% {
        stroke-dashoffset: -113.1;
        stroke: var(--accent-primary);
    }
}

.thinking-wrapper {
    display: flex;
    align-items: center;
    align-self: center;
    padding: 0 2px;
}

/* Progressive AI loader text */
.thinking-text-loader {
    font-size: 13px;
    color: var(--accent-primary);
    font-weight: 500;
    font-style: italic;
    opacity: 1;
    transition: opacity var(--smooth-transition);
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.thinking-text-loader::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: var(--accent-primary);
    margin-left: 3px;
    vertical-align: text-bottom;
    border-radius: 1px;
    animation: thinking-cursor-blink 0.85s step-end infinite;
    opacity: 0.7;
}

.thinking-text-loader.thinking-fade-out {
    opacity: 0;
}

@keyframes thinking-cursor-blink {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0;
    }
}

.thinking-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.2px;
    animation: pulse-text 2s infinite ease-in-out;
    font-family: 'Outfit', sans-serif;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.message.ai {
    animation: messageFadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes messageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: shimmer-swipe 1.5s infinite;
}

[data-theme="light"] .shimmer {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.03) 50%,
            rgba(0, 0, 0, 0) 100%);
}

/* --- RAG-Style Dashboard Promo Card --- */
.dashboard-promo-card {
    background: transparent;
    border-left: 2px solid var(--accent-primary);
    padding: 8px 0 8px 16px;

    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all var(--smooth-transition);
}

.dashboard-promo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-primary);
}

.dashboard-promo-icon {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.dashboard-promo-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Inter', sans-serif;
    color: var(--accent-primary);
}

.dashboard-promo-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.dashboard-promo-desc {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.4;
    flex: 1;
}

.dashboard-promo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
    text-decoration: none;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    transition: all var(--smooth-transition);
    white-space: nowrap;
}

.dashboard-promo-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

@keyframes shimmer-swipe {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* --- Suggestion Cards Design --- */
.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.suggestion-item {
    background: var(--bg-sidebar);
    border: 2px solid #5570E5;
    border-radius: 12px;
    padding: 20px;
    /* cursor: none; */
    transition: all var(--smooth-transition);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(85, 112, 229, 0.08);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.suggestion-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(85, 112, 229, 0.15);
    border-color: #3b82f6;
}

.suggestion-icon-container {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.suggestion-item h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.suggestion-item p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Responsive adjustments for 3-column grid */
@media (max-width: 1024px) {
    .suggestions-grid {
        gap: 15px;
    }

    .suggestion-item {
        padding: 15px;
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .suggestions-grid {
        gap: 10px;
    }

    .suggestion-item {
        padding: 12px;
        gap: 8px;
    }

    .suggestion-item h3 {
        font-size: 12px;
    }

    .suggestion-item p {
        font-size: 10px;
    }

    .suggestion-icon-container {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .suggestions-grid {
        gap: 8px;
    }

    .suggestion-item {
        padding: 8px;
        gap: 6px;
        border-width: 1px;
    }

    .suggestion-item h3 {
        font-size: 10px;
        letter-spacing: -0.2px;
    }

    .suggestion-item p {
        font-size: 8px;
        line-height: 1.2;
    }

    .suggestion-icon-container {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }
}
/* Usage Log Table Styles */
.usage-log-row:hover {
    background: var(--bg-hover) !important;
    cursor: default;
}

/* ===== Text Highlighter Tool Styles ===== */

.highlighter-container {
    position: relative;
    display: flex;
    align-items: center;
}

.highlighter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all var(--smooth-transition);
}

.highlighter-btn:hover {
    background: #f9f9f9;
    border-color: #999;
}

.highlighter-btn.active {
    background: #ffd966;
    border-color: #f0ad4e;
    color: #333;
}

.highlighter-chevron {
    width: 16px;
    height: 16px;
}

.highlighter-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    background: white;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 160px;
    justify-content: space-between;
}

.highlighter-menu.open {
    display: flex;
}

.highlighter-color {
    width: 28px;
    height: 28px;
    border: 2px solid #999;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--smooth-transition);
    padding: 0;
}

.highlighter-color:hover {
    border-color: #333;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.clear-highlights-btn {
    width: 28px;
    height: 28px;
    border: 2px solid #999;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    color: #666;
    transition: all var(--smooth-transition);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.clear-highlights-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fee2e2;
}

/* Highlight span styling */
.text-highlight {
    padding: 2px 4px;
    border-radius: 2px;
    cursor: default;
    transition: opacity var(--smooth-transition);
}

.text-highlight:hover {
    opacity: 0.8;
}

/* Studio Panel Cards Styling */
.studio-card {
    height: auto;
    min-height: 1.75rem;
    /* 44px */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-sidebar);
    font-family: 'Google Sans Text', sans-serif;
    font-size: 0.5rem;
    color: var(--text-main);
    text-align: center;
    white-space: normal;
    word-break: break-word;
    flex-wrap: wrap;
}

.studio-card i {
    font-size: 1rem;
    flex-shrink: 0;
    width: 100%;
}

.studio-card span {
    width: 100%;
    font-size: 0.75rem;
    line-height: 1.2;
}

.studio-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.studio-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.studio-card-edit {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    z-index: 2;
}

.studio-card-edit i {
    font-size: 10px !important;
}

.studio-card:hover .studio-card-edit {
    opacity: 1;
    transform: scale(1);
}

.studio-card-edit:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Studio Task Item Styling */
.studio-task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.studio-task-item:hover {
    background: var(--bg-sidebar);
    border-color: var(--accent-primary);
}

.studio-task-item i {
    font-size: 1rem;
    flex-shrink: 0;
}

.studio-task-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.studio-task-item-title {
    font-weight: 600;
    color: var(--text-main);
}

.studio-task-item-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Studio History Item Styling */
.studio-history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.studio-history-item:hover {
    background: var(--bg-sidebar);
    border-color: var(--accent-primary);
    transform: translateX(2px);
}

.studio-history-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 1s ease, background-color 1s ease;
}

.studio-history-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-sidebar);
}

.studio-history-item i {
    font-size: 1rem;
    flex-shrink: 0;
}

.studio-history-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.studio-history-item-title {
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.studio-history-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Custom Query Modal Styles (SaaS Style) */
.custom-query-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    /* Darker, slightly blue overlay */
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-query-overlay.show {
    display: flex;
    opacity: 1;
}

.custom-query-modal {
    background: var(--bg-sidebar);
    width: 90%;
    max-width: 440px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.custom-query-overlay.show .custom-query-modal {
    transform: translateY(0) scale(1);
}

.custom-query-header {
    padding: 20px 24px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-query-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.custom-query-body {
    padding: 0 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-query-body p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#custom-query-input {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color var(--smooth-transition), box-shadow var(--smooth-transition);
}

#custom-query-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.custom-query-footer {
    padding: 16px 24px;
    background: var(--bg-main);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.custom-query-footer .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--smooth-transition);
}

.custom-query-footer .btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.custom-query-footer .btn-secondary:hover {
    background: var(--bg-hover);
}

.custom-query-footer .btn-primary {
    background: var(--accent-primary);
    color: white;
    border: 1px solid var(--accent-primary);
}

.custom-query-footer .btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* ============================================================
   Model source selector (Settings → API tab)
   ============================================================ */
#model-source-card {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    max-width: 650px;
    margin: 0 auto 0 auto;
    transition: all 0.3s ease;
}

#model-source-card.state-initial {
    margin-top: 40px;
}

#model-source-card.state-selected {
    margin-top: 0;
}

.ms-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.02);
    transition: padding 0.3s ease;
}

#model-source-card.state-selected .ms-card-header {
    padding: 14px 20px;
}

.ms-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 4px 0;
    transition: font-size 0.3s ease;
}

#model-source-card.state-selected .ms-card-title {
    font-size: 13px;
    margin: 0;
}

.ms-card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    transition: opacity 0.2s ease, max-height 0.3s ease;
    overflow: hidden;
}

#model-source-card.state-selected .ms-card-subtitle {
    opacity: 0;
    max-height: 0;
}

.ms-toggle-row {
    padding: 16px 24px 0;
    display: flex;
    gap: 12px;
    transition: padding 0.3s ease;
}

#model-source-card.state-selected .ms-toggle-row {
    padding: 12px 16px 0;
    gap: 8px;
}

.ms-pill-btn {
    flex: 1;
    padding: 16px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    text-align: left;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
}

#model-source-card.state-selected .ms-pill-btn {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 20px;
    gap: 6px;
}

.ms-pill-btn.active {
    background: rgba(37,99,235,0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.ms-pill-btn.inactive {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.ms-pill-btn .pill-icon {
    font-size: 20px;
    line-height: 1;
    transition: font-size 0.25s ease;
}

#model-source-card.state-selected .ms-pill-btn .pill-icon {
    font-size: 14px;
}

.ms-pill-btn .pill-text-block .pill-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    transition: font-size 0.25s ease;
}

#model-source-card.state-selected .ms-pill-btn .pill-text-block .pill-label {
    font-size: 12px;
}

.ms-pill-btn .pill-text-block .pill-sub {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
    margin-top: 3px;
    transition: opacity 0.2s ease, max-height 0.25s ease;
    overflow: hidden;
    max-height: 20px;
}

#model-source-card.state-selected .ms-pill-btn .pill-text-block .pill-sub {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
}

#model-source-active-label {
    font-size: 11px;
    color: var(--text-muted);
    padding: 8px 20px 14px;
    min-height: 14px;
    opacity: 0;
    transition: opacity 0.3s ease 0.15s;
}

#model-source-card.state-selected #model-source-active-label {
    opacity: 1;
}

.ms-source-panel {
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

.ms-source-panel.panel-hidden {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.ms-source-panel.panel-visible {
    max-height: 900px;
    opacity: 1;
}

.ms-source-panel-inner {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}