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

:root {
    /* ===== NOTHING DESIGN SYSTEM — Light Mode ===== */
    
    /* Core colors (Light mode — 3-surface system for spatial contrast) */
    --color-text-primary: #111111;
    --color-text-secondary: #444444;
    --color-text-placeholder: #777777;
    --color-text-display: #000000;
    --color-text-disabled: #999999;
    --color-bg-primary: #F7F7F8;
    --color-bg-secondary: #EDEDF0;
    --color-bg-sidebar: #F0F0F3;
    --color-bg-sidebar-header: #F0F0F3;
    --color-bg-chat: #FAFAFA;
    --color-bg-right-panel: #F0F0F3;
    --color-bg-card: #FFFFFF;
    --color-border: #D4D4D8;
    --color-border-visible: #A1A1AA;
    --color-border-sidebar: #DDDDE0;
    --color-accent: #00BCFF;
    --color-accent-secondary: #0099D6;
    --color-accent-subtle: rgba(0, 188, 255, 0.10);
    --color-hover: rgba(0, 0, 0, 0.06);
    --color-shadow: none;
    --color-sidebar-text: #111111;
    --color-sidebar-text-secondary: #444444;
    --color-sidebar-nav-hover: rgba(0, 0, 0, 0.06);
    
    /* Status colors */
    --color-success: #4A9E5C;
    --color-warning: #D4A843;
    --color-error: #D71921;
    --color-interactive: #007AFF;
    
    /* Bayer brand */
    --bayer-green: #89D329;
    
    /* Spacing system (8px base grid) */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    
    /* Border radius — Nothing: cards rounded, technical sharp, buttons pill */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-card: 16px;
    --radius-pill: 999px;
    --radius-full: 50%;
    
    /* Typography scale */
    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.5rem;
    --text-2xl: 2.25rem;
    --text-dynamic: clamp(0.875rem, 2vw, 1.25rem);
    --spacing-dynamic: clamp(8px, 2vw, 24px);
    --sidebar-width-dynamic: clamp(200px, 25vw, 270px);
    --font-responsive: clamp(0.875rem, 2.5vw, 1.125rem);
    --padding-responsive: clamp(12px, 3vw, 24px);
    --icon-size: clamp(32px, 6vw, 44px);
    
    /* Font families — Nothing: Doto (display 36px+), Space Grotesk (body), Space Mono (data/labels) */
    --font-display: 'Doto', 'Space Mono', monospace;
    --font-body: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
    --font-mono: 'Space Mono', 'JetBrains Mono', 'SF Mono', monospace;
    --font-chat: 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
    
    /* Shadows — Nothing: NONE. Flat surfaces, border separation only. */
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;
    
    /* Transitions — Nothing: 150-250ms ease-out, no spring/bounce */
    --transition-fast: 0.15s ease-out;
    --transition-base: 0.2s ease-out;
    --transition-slow: 0.25s ease-out;
}

body.dark-theme {
    /* ===== NOTHING DESIGN SYSTEM — Dark Mode (OLED Instrument Panel) ===== */
    --color-text-primary: #E8E8E8;
    --color-text-secondary: #999999;
    --color-text-placeholder: #666666;
    --color-text-display: #FFFFFF;
    --color-text-disabled: #666666;
    --color-bg-primary: #000000;
    --color-bg-secondary: #111111;
    --color-bg-sidebar: #000000;
    --color-bg-sidebar-header: #111111;
    --color-bg-chat: #000000;
    --color-bg-right-panel: #000000;
    --color-bg-card: #111111;
    --color-border: #222222;
    --color-border-visible: #333333;
    --color-border-sidebar: rgba(255, 255, 255, 0.08);
    --color-accent: #89D329;
    --color-accent-secondary: #6FAE1B;
    --color-accent-subtle: rgba(137, 211, 41, 0.12);
    --color-hover: rgba(255, 255, 255, 0.04);
    --color-shadow: none;
    --color-sidebar-text: #E8E8E8;
    --color-sidebar-text-secondary: #999999;
    --color-sidebar-nav-hover: rgba(255, 255, 255, 0.06);
    --color-interactive: #5B9BF6;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Flex Utilities */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Spacing Utilities */
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.px-xs { padding-left: var(--spacing-xs); padding-right: var(--spacing-xs); }
.px-sm { padding-left: var(--spacing-sm); padding-right: var(--spacing-sm); }
.px-md { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }
.px-lg { padding-left: var(--spacing-lg); padding-right: var(--spacing-lg); }
.px-xl { padding-left: var(--spacing-xl); padding-right: var(--spacing-xl); }

.py-xs { padding-top: var(--spacing-xs); padding-bottom: var(--spacing-xs); }
.py-sm { padding-top: var(--spacing-sm); padding-bottom: var(--spacing-sm); }
.py-md { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }
.py-lg { padding-top: var(--spacing-lg); padding-bottom: var(--spacing-lg); }
.py-xl { padding-top: var(--spacing-xl); padding-bottom: var(--spacing-xl); }

.m-xs { margin: var(--spacing-xs); }
.m-sm { margin: var(--spacing-sm); }
.m-md { margin: var(--spacing-md); }
.m-lg { margin: var(--spacing-lg); }
.m-xl { margin: var(--spacing-xl); }

.mx-auto { margin-left: auto; margin-right: auto; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

/* Position & Layout Utilities */
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Display Utilities */
.hidden { display: none !important; }

/* ========================================
   BASE STYLES
   ======================================== */

body {
    font-family: var(--font-body);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    transition: background-color var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 400;
}

/* ========================================
   COMPONENTS
   ======================================== */

/* Loading Spinner */
.spinner {
    display: inline-block;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--color-accent);
    border-radius: var(--radius-full);
    width: 12px;
    height: 12px;
    animation: spin 1s linear infinite;
    margin-left: var(--spacing-xs);
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   LAYOUT
   ======================================== */

.app-container {
    display: grid;
    grid-template-columns: 270px minmax(300px, 1fr) minmax(0, 50vw);
    grid-template-rows: 1fr;
    grid-template-areas: "sidebar chat right";
    width: 100%;
    height: 100vh;
    background-color: var(--color-bg-card);
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
    position: relative;
}

/* Improved responsive behavior for collapsed sidebar */
.app-container.sidebar-collapsed {
    grid-template-columns: minmax(85px, 85px) minmax(280px, 1fr) minmax(0, 35vw);
}

/* Large screens - allow right panel to expand more */
@media (min-width: 1600px) {
    .app-container {
        grid-template-columns: 800px 1fr clamp(400px, 45vw, 800px);
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 85px 1fr clamp(450px, 50vw, 900px);
    }
}

/* Ultra-wide screens - maximize space usage */
@media (min-width: 1920px) {
    .app-container {
        grid-template-columns: 800px 1fr minmax(500px, 50vw);
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 85px 1fr minmax(600px, 55vw);
    }
}

/* Medium-large screens */
@media (max-width: 1400px) {
    .app-container {
        grid-template-columns: 270px 1fr 35vw;
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 85px 1fr 30vw;
    }
}

@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 270px 1fr 320px;
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 85px 1fr 300px;
    }
}

/* ---- Tablet: sidebar overlay, 2-column layout ---- */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr minmax(0, 35vw);
        grid-template-areas: "chat right";
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 1fr minmax(0, 35vw);
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 270px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease-out;
    }
    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    /* Sidebar backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }
    .sidebar-backdrop.visible {
        display: block;
    }

    /* Hamburger always visible */
    .sidebar-menu-button {
        display: flex;
    }
}

/* ---- Phone: single column + bottom sheet ---- */
@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-areas: "chat";
    }
    .app-container.sidebar-collapsed {
        grid-template-columns: 1fr;
    }

    /* Hide desktop right-panel collapse button on mobile */
    .right-panel-collapse-btn {
        display: none !important;
        visibility: hidden !important;
    }

    /* Add top space for the fixed hamburger button */
    .chat-header {
        padding-top: 68px;
        height: auto;
    }

    /* Right panel becomes bottom sheet */
    .right-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 60vh;
        max-height: 70vh;
        z-index: 900;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
        border-radius: 16px 16px 0 0;
        border-top: 1px solid var(--color-border);
        background: var(--color-bg-right-panel);
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
    }
    .right-panel.bottom-sheet-open {
        transform: translateY(0);
    }
    .right-panel.collapsed {
        transform: translateY(100%);
    }

    /* Bottom sheet drag handle */
    .bottom-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 8px 0 4px;
        cursor: grab;
        flex-shrink: 0;
    }
    .bottom-sheet-handle::after {
        content: '';
        width: 36px;
        height: 4px;
        background: var(--color-border-visible);
        border-radius: 2px;
    }

    /* Bottom sheet backdrop */
    .bottom-sheet-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 899;
    }
    .bottom-sheet-backdrop.visible {
        display: block;
    }

    /* Floating toggle button */
    .bottom-sheet-toggle {
        display: flex;
        position: fixed;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 800;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--color-border-visible);
        border-radius: var(--radius-full);
        background: var(--color-bg-card);
        color: var(--color-accent);
        font-size: 1rem;
        cursor: pointer;
        transition: all var(--transition-base);
    }
    .bottom-sheet-toggle:active {
        opacity: 0.7;
    }
    .bottom-sheet-toggle.has-content {
        animation: sheet-notify 2s ease-in-out infinite;
    }
    @keyframes sheet-notify {
        0%, 100% { box-shadow: 0 0 0 0 rgba(0, 188, 255, 0.4); }
        50% { box-shadow: 0 0 0 6px rgba(0, 188, 255, 0); }
    }

    body.dark-theme .bottom-sheet-toggle.has-content {
        animation: sheet-notify-dark 2s ease-in-out infinite;
    }
    @keyframes sheet-notify-dark {
        0%, 100% { box-shadow: 0 0 0 0 rgba(137, 211, 41, 0.4); }
        50% { box-shadow: 0 0 0 6px rgba(137, 211, 41, 0); }
    }

    .chatbox {
        padding: 16px;
        max-height: calc(100vh - 140px);
    }

    .message {
        margin-bottom: 16px;
        gap: 10px;
    }
    .user-message, .agent-message {
        max-width: 100%;
    }
    .user-icon, .agent-icon {
        width: 36px;
        height: 36px;
        font-size: 1em;
    }
    .message-content {
        font-size: 0.9375rem;
        padding: 14px 18px;
    }
    .user-message .message-content,
    .agent-message .message-content {
        padding: 14px 18px;
        font-size: 0.9375rem;
    }

    .input-area {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        min-height: 68px;
    }
    #userInput {
        font-size: 1rem;
        padding: 12px 16px;
        min-height: 44px;
        max-height: 100px;
        border-radius: 22px;
    }
}

/* ---- Extra small phone ---- */
@media (max-width: 480px) {
    .chatbox {
        padding: 12px;
    }
    .input-area {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }
    #userInput {
        font-size: 0.9375rem;
        padding: 10px 14px;
    }
}

/* ========================================
   SIDEBAR STYLES
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    width: clamp(200px, 25vw, 270px);
    height: 100vh;
    background: var(--color-bg-sidebar);
    transition: all 0.4s ease;
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border-sidebar);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 85px;
}

.sidebar .sidebar-header {
    display: flex;
    position: relative;
    padding: 20px;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border-sidebar);
}

.sidebar-header .header-logo img {
    width: 38px;
    height: 38px;
    display: block;
    object-fit: contain;
    border-radius: 2px;
}

.sidebar-header .sidebar-toggler,
.sidebar-menu-button {
    position: absolute;
    right: var(--spacing-xl);
    height: 30px;
    width: 30px;
    border: 1px solid var(--color-border-sidebar);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    background: transparent;
    color: var(--color-sidebar-text-secondary);
    transition: all var(--transition-base);
}

.sidebar.collapsed .sidebar-header .sidebar-toggler {
    transform: translate(-4px, 65px);
}

.sidebar-header .sidebar-toggler i,
.sidebar-menu-button i {
    font-size: 1.2rem;
    transition: all var(--transition-slow);
    color: inherit;
}

body.dark-theme .sidebar-header .sidebar-toggler,
body.dark-theme .sidebar-menu-button {
    color: var(--color-sidebar-text);
    background: var(--color-sidebar-nav-hover);
}

.sidebar.collapsed .sidebar-header .sidebar-toggler i {
    transform: rotate(180deg);
}

.sidebar-header .sidebar-toggler:hover,
.sidebar-menu-button:hover {
    background: var(--color-sidebar-nav-hover);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Sidebar User Profile Section */
.sidebar-user-profile {
    padding: 0 15px;
    margin-top: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--color-bg-sidebar);
    transition: all 0.3s ease;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: transparent;
    border-radius: 2px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    color: var(--color-sidebar-text);
    white-space: nowrap;
}

.sidebar-user-info:hover {
    background: var(--color-sidebar-nav-hover);
}

.sidebar.collapsed .sidebar-user-profile {
    padding: 0 15px;
    margin-top: 75px; /* Push down when collapsed to avoid overlap with toggle button */
}

.sidebar.collapsed .sidebar-user-info {
    padding: 11px 15px;
    justify-content: center;
    gap: 0;
    border-radius: 2px;
}

.sidebar.collapsed .sidebar-user-info span {
    display: none;
}

.sidebar-user-info .fa-user-circle {
    color: var(--color-accent);
    font-size: 1em;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-user-name {
    color: var(--color-sidebar-text);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: opacity 0.3s ease, width 0.3s ease;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 15px;
    background: transparent;
    color: var(--color-sidebar-text-secondary);
    text-decoration: none;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.4s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sidebar-logout-btn:hover {
    background: var(--color-sidebar-nav-hover);
    color: var(--color-accent);
}

.sidebar-logout-btn i {
    color: #ef4444;
    font-size: 1em;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-logout-btn .logout-text {
    color: var(--color-sidebar-text-secondary);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar.collapsed .sidebar-logout-btn span,
.sidebar.collapsed .sidebar-login-btn span {
    display: none;
}

.sidebar-login-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 15px;
    background: var(--color-accent);
    color: white;
    text-decoration: none;
    border-radius: 2px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.4s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.sidebar-login-btn:hover {
    background: var(--color-accent-secondary);
    color: white;
}

.sidebar-login-btn i {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    font-size: 1em;
}

.sidebar-login-btn .login-text {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.sidebar.collapsed .sidebar-login-btn,
.sidebar.collapsed .sidebar-logout-btn {
    padding: 11px 15px;
    justify-content: center;
    gap: 0;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-nav .nav-list {
    list-style: none;
    display: flex;
    gap: clamp(6px, 1vw, 10px); /* Increased gap to prevent overlapping */
    padding: 0 15px;
    flex-direction: column;
    transform: translateY(15px);
    transition: 0.4s ease;
}

.sidebar .sidebar-nav .primary-nav {
    overflow-y: auto;
    scrollbar-width: thin;
    padding-bottom: 20px;
    flex: 1;
    min-height: 0;
    scrollbar-color: transparent transparent;
}

.sidebar .sidebar-nav .primary-nav:hover {
    scrollbar-color: var(--color-border-visible) transparent;
}

.sidebar.collapsed .sidebar-nav .primary-nav {
    overflow: unset;
    transform: translateY(65px);
}

.sidebar-nav .nav-item .nav-link {
    color: var(--color-sidebar-text);
    display: flex;
    gap: 12px;
    white-space: nowrap;
    border-radius: 2px;
    padding: clamp(10px, 2vw, 13px) 15px;
    align-items: center;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    min-height: clamp(38px, 5vh, 44px);
}

.sidebar-nav .nav-item:is(:hover, .open) > .nav-link:not(.dropdown-title) {
    color: var(--color-accent); 
    background: var(--color-sidebar-nav-hover);
}

body.dark-theme .sidebar-nav .nav-item:is(:hover, .open) > .nav-link:not(.dropdown-title) {
    color: var(--color-accent); 
}

.sidebar-nav .nav-item:is(:hover, .open) > .nav-link.dropdown-title {
    color: var(--color-accent);
    background: var(--color-sidebar-nav-hover);
}

.sidebar .nav-link .nav-label {
    transition: opacity 0.2s ease-out;
    border: none;
    font-weight: 400;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-sidebar-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}




/* Hide nav-label, dropdown-icon, and theme-toggle-track when sidebar is collapsed */
.sidebar.collapsed .nav-label,
.sidebar.collapsed .dropdown-icon,
.sidebar.collapsed .theme-toggle-track {
    display: none !important;
}

/* Ensure icons remain visible and properly positioned when collapsed */
.sidebar.collapsed .nav-link i {
    opacity: 1 !important;
    transform: translateX(0) !important;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Ensure theme icon aligns with other icons when collapsed */
.sidebar.collapsed .theme-toggle .theme-icon {
    transform: none;
}

/* Hide dropdown menus by default when sidebar is collapsed */
.sidebar.collapsed .dropdown-menu {
    display: none !important;
}

/* Show dropdown menus on hover when sidebar is collapsed */
.sidebar.collapsed .nav-item:hover .dropdown-menu {
    display: block !important;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: var(--color-bg-sidebar);
    border: 1px solid var(--color-border-sidebar);
    border-radius: 2px;
    box-shadow: 0 4px 16px var(--color-shadow);
    z-index: 1000;
    opacity: 1;
    pointer-events: auto;
    margin-left: 10px;
}

/* Ensure collapsed sidebar maintains proper width */
.sidebar.collapsed {
    width: 85px !important;
}

/* Ensure nav links in collapsed sidebar center the icons */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 11px 15px;
    gap: 0;
}

.sidebar.collapsed .nav-link .dropdown-icon {
    transition: opacity 0.3s 0s ease;
}

.sidebar-nav .secondary-nav {
    position: absolute;
    bottom: 10px;
    width: calc(100% - 20px);
    margin: 0 10px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-sidebar);
    border-radius: 6px;
    gap: 0;
    padding: 4px;
    overflow: hidden;
}

.sidebar-nav .nav-item {
    position: relative;
}
.sidebar-nav .secondary-nav .nav-item .nav-link {
    padding: 7px 12px;
    min-height: 34px;
    max-height: 34px;
    border-radius: 4px;
    font-size: var(--text-xs);
    line-height: 1;
}
/* Dropdown Stylings */
.sidebar-nav .dropdown-container .dropdown-icon {
    margin: 0 -4px 0 auto;
    transition: transform var(--transition-slow), opacity 0.3s 0.2s ease, color var(--transition-base);
    color: var(--color-sidebar-text-secondary);
}

.sidebar-nav .dropdown-container.open .dropdown-icon {
    transform: rotate(180deg);
    height: auto;
    max-height: calc(100vh - 450px); /* Prevent overlap with secondary nav */
    overflow-y: auto;
}

/* Dropdown icon color states */
.sidebar-nav .nav-item:hover .dropdown-icon,
.sidebar-nav .nav-item.open .dropdown-icon {
    color: var(--color-accent);
}

/* Dark theme dropdown icon colors */
body.dark-theme .sidebar-nav .dropdown-container .dropdown-icon {
    color: var(--color-sidebar-text-secondary);
}

body.dark-theme .sidebar-nav .nav-item:hover .dropdown-icon,
body.dark-theme .sidebar-nav .nav-item.open .dropdown-icon {
    color: var(--color-accent);
}

.sidebar-nav .dropdown-menu {
    height: 0;
    overflow-y: hidden;
    list-style: none;
    padding-left: 15px;
    transition: height 0.4s ease;
    max-height: calc(100vh - 400px);
}

.sidebar.collapsed .dropdown-menu {
    position: sticky;
    top: -10px;
    left: 100%;
    opacity: 0;
    height: auto !important;
    padding-right: 10px;
    overflow-y: unset;
    pointer-events: none;
    border-radius: 0 10px 10px 0;
    background: var(--color-bg-sidebar);
    border: 1px solid var(--color-border-sidebar);
    transition: 0s;
}

.sidebar.collapsed .dropdown-menu:has(.dropdown-link) {
    padding: 7px 10px 7px 24px;
}

.sidebar.collapsed .nav-item:hover > .dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(12px);
    transition: all 0.4s ease;
}

.sidebar.collapsed .nav-item:hover > .dropdown-menu:has(.dropdown-link) {
    transform: translateY(10px);
}

.dropdown-menu .nav-item .nav-link {
    color: var(--color-sidebar-text-secondary);
    padding: 9px 15px;
}

.sidebar.collapsed .dropdown-menu .nav-link {
    padding: 7px 15px;
}

.dropdown-menu .nav-item .nav-link.dropdown-title {
    display: none;
    color: var(--color-sidebar-text);
    padding: 9px 15px;
}

.dropdown-menu:has(.dropdown-link) .nav-item .dropdown-title {
    font-weight: 500;
    padding: 7px 15px;
}

.sidebar.collapsed .dropdown-menu .nav-item .dropdown-title {
    display: block;
}

.sidebar-menu-button {
    display: none;
}

/* Dropdown Selector Styles */
.dropdown-selector {
    padding: 4px 15px 8px 15px;
    color: var(--color-sidebar-text-secondary);
    min-width: 0;
    width: 100%;
}

.dropdown-selector label {
    display: block;
    color: var(--color-sidebar-text-secondary);
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 5px;
}

.dropdown-selector select {
    width: 100%;
    min-width: 0;
    padding: 7px 8px;
    border: 1px solid var(--color-border-sidebar);
    border-radius: 2px;
    background-color: var(--color-bg-primary);
    color: var(--color-sidebar-text);
    font-size: 0.8rem;
    font-family: var(--font-mono);
    box-sizing: border-box;
}

.dropdown-selector select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Environment Toggle Styles */
.environment-toggle-container {
    padding: 8px 15px;
}

.environment-toggle {
    display: flex;
    gap: 4px;
    background-color: var(--color-bg-primary);
    border-radius: 2px;
    padding: 3px;
    border: 1px solid var(--color-border-sidebar);
}

.env-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 2px;
    background-color: transparent;
    color: var(--color-sidebar-text-secondary);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.env-option:hover {
    background-color: var(--color-hover);
}

.env-option.active {
    background-color: var(--color-sidebar-nav-hover);
    color: var(--color-sidebar-text);
    box-shadow: none;
    border-color: var(--color-border-sidebar);
}

.env-option i {
    font-size: 0.9em;
}

.env-prod.active {
    color: #10b981; /* Green for production */
}

.env-qa.active {
    color: #f59e0b; /* Amber for QA */
}

/* Edit Config Button Container */
.edit-config-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg) 0 var(--spacing-lg);
}

/* Edit Config Button - Fully integrated with utility classes */
.edit-config-btn {
    /* Base button styles */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85em;
    text-decoration: none;
    transition: all var(--transition-base);
    user-select: none;
    position: relative;
    
    /* Primary button colors */
    background: var(--color-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.edit-config-btn:hover {
    background-color: var(--color-accent-secondary);
    box-shadow: var(--shadow-md);
}

.edit-config-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Pulsing save-reminder badge when button is in Confirm (needs-save) state */
.edit-config-btn.needs-save {
    box-shadow: 0 0 0 0 rgba(0, 188, 255, 0.7);
    animation: needs-save-pulse 1.6s ease-in-out infinite;
}

.edit-config-btn.needs-save::after {
    content: '!';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 13px;
    height: 13px;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

@keyframes needs-save-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 188, 255, 0.7); }
    60%  { box-shadow: 0 0 0 6px rgba(0, 188, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 188, 255, 0); }
}

body.dark-theme .edit-config-btn.needs-save {
    box-shadow: 0 0 0 0 rgba(137, 211, 41, 0.7);
    animation: needs-save-pulse-dark 1.6s ease-in-out infinite;
}
@keyframes needs-save-pulse-dark {
    0%   { box-shadow: 0 0 0 0 rgba(137, 211, 41, 0.7); }
    60%  { box-shadow: 0 0 0 6px rgba(137, 211, 41, 0); }
    100% { box-shadow: 0 0 0 0 rgba(137, 211, 41, 0); }
}

/* Force Reload Button */
.force-reload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.85em;
    text-decoration: none;
    transition: all var(--transition-base);
    user-select: none;
    background: transparent;
    color: var(--color-text-secondary);
}

.force-reload-btn:hover {
    background: var(--color-hover-bg, rgba(0,0,0,0.06));
    color: var(--color-text);
    border-color: var(--color-text-secondary);
}

.force-reload-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.force-reload-btn.loading i {
    animation: fa-spin 0.8s linear infinite;
}

/* Tooltip for force-reload rendered via JS into body (avoids overflow clipping) */
#force-reload-tooltip {
    position: fixed;
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm, 4px);
    padding: 4px 8px;
    font-size: 0.72em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#force-reload-tooltip.visible {
    opacity: 1;
}

/* Tooltip styling for the edit button - REMOVED */
/*
.edit-config-btn:hover::after {
    content: attr(title);
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.edit-config-btn:hover::before {
    content: '';
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    border: var(--spacing-xs) solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    pointer-events: none;
}
*/


/* Chat History Container */
.chat-history-container {
    max-height: 250px;
    overflow-y: auto;
    padding: 0 15px;
    margin-bottom: 10px;
}

.sidebar-nav .dropdown-container.open .dropdown-menu {
    height: auto;
    max-height: calc(100vh - 500px); /* Prevent overlap with secondary nav */
    overflow-y: auto;
}

.chat-history-container ul {
    list-style: none;
    padding: 0;
}

.chat-history-container li {
    margin-bottom: 4px;
    padding: 7px 8px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-body);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-sidebar-text-secondary);
    transition: background-color 0.15s ease;
    border: 1px solid transparent;
}

.chat-history-container li:hover {
    background-color: var(--color-hover);
}

/* Add active session styling */
.chat-history-container li.active-session {
    background-color: rgba(0, 87, 184, 0.15);
    color: var(--color-accent);
    box-shadow: none;
    border: 1px solid var(--color-accent);
}

.chat-history-container li.active-session a {
    color: var(--color-accent) !important;
    font-weight: 600;
}

.chat-history-container li.active-session span {
    color: var(--color-accent) !important;
    opacity: 0.7;
}

/* Ensure active session styling overrides hover */
.chat-history-container li.active-session:hover {
    background-color: rgba(0, 87, 184, 0.2);
    transform: none;
    box-shadow: none;
}

.chat-history-container li a {
    text-decoration: none;
    color: var(--color-sidebar-text-secondary);
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.chat-history-container li span {
    font-size: 0.8em;
    color: var(--color-text-placeholder);
    white-space: nowrap;
}

/* Responsive media query code for small screens */
@media (max-width: 768px) {
    .sidebar-menu-button {
        position: fixed;
        left: 16px;
        top: 16px;
        height: 44px;
        width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-full);
        cursor: pointer;
        color: var(--color-text-primary);
        background: var(--color-bg-card);
        box-shadow: none;
        transition: all var(--transition-base);
        z-index: 1001;
    }
    
    .sidebar-menu-button:hover {
        background: var(--color-hover);
        color: var(--color-accent);
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    .sidebar.collapsed .sidebar-header .sidebar-toggler {
        transform: none;
    }
    
    .sidebar.collapsed .sidebar-nav .primary-nav {
        transform: translateY(15px);
    }
    
    .chat-area {
        margin-left: 0;
        height: 100dvh;
        max-height: 100vh;
        min-height: 400px;
    }
    
    .right-panel-header {
        padding: 12px 16px;
        margin: 0;
        height: auto;
    }
    
    .user-profile-section {
        justify-content: center;
    }
    
    .user-info-right {
        padding: 6px 10px;
    }
    
    .login-btn-right {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .message-content table th,
    .message-content table td {
        max-width: 150px;
        min-width: 60px;
        font-size: 0.8em;
        padding: 3px 6px;
    }
    
    .table-scroll-wrapper table {
        min-width: 250px !important;
    }
}

/* Chat Area Styles (Middle Column) - ENHANCED */
.chat-area {
    grid-area: chat;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-chat);
    overflow: hidden;
    margin-left: 0;
    position: relative;
    min-width: 0; /* Allow shrinking below content size */
    min-height: 100vh;
    /* Add max-height to prevent overflow */
    max-height: 100vh;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--color-bg-card);
    border: none;
    box-shadow: none;
    gap: 16px;
    height: 84px;
    box-sizing: border-box;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.chat-title-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-title-section .main-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    color: var(--color-text-primary);
    line-height: 1.2;
    text-transform: uppercase;
}

.chat-header h3 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.7;
    letter-spacing: 0.03em;
}

.chat-header button {
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.chat-header button:hover {
    background: var(--color-accent);
    color: #FFFFFF;
    border-color: var(--color-accent);
}

/* Chatbox improvements for better scrolling */
.chatbox {
    flex-grow: 1;
    padding: 40px; /* Increased padding for even more breathing room */
    overflow-y: auto;
    background: transparent;
    display: flex;
    flex-direction: column;
    scrollbar-width: 6px;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
    min-height: 0; /* Allow chatbox to shrink if needed */
    /* Improved height calculation */
    max-height: calc(100vh - 172px); /* Header (84px) + Input area (88px) */
    /* Add padding-bottom to prevent content from being hidden behind input */
    padding-bottom: 20px;
    font-family: 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
}

.chatbox *:not(i):not(.fas):not(.far):not(.fab):not(.fa):not(.fa-solid):not(.fa-regular):not(.fa-brands) {
    font-family: inherit !important;
}

.chatbox::-webkit-scrollbar {
    width: 6px;
}

.chatbox::-webkit-scrollbar-track {
    background: transparent;
}

.chatbox::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.chatbox::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Message Styles */
.message {
    display: flex;
    align-items: flex-start;
    gap: clamp(16px, 3vw, 20px); /* Increased gap */
    max-width: 100%;
    width: 100%; /* Force full width for all messages */
    position: relative;
    margin-bottom: clamp(20px, 4vw, 28px); /* Increased spacing between messages */
}

.user-message {
    flex-direction: row-reverse;
    align-items: flex-start;
    margin-left: auto;
    margin-right: 0;
    max-width: 100%;
}

.user-message .message-content {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    border: 1.5px solid var(--color-accent);
    border-radius: 4px 0 4px 4px;
    box-shadow: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 450;
    line-height: 1.65;
    max-width: fit-content;
    width: auto;
    flex: 0 1 auto;
    overflow: visible;
    min-height: 44px;
    transition: border-color 0.2s ease;
}

.user-message .message-content:hover {
    border-color: var(--color-accent-secondary);
}

.agent-message {
    flex-direction: row; /* Same as user message for consistent layout */
    align-items: flex-start; /* Same as user message */
    margin-left: 0; /* Same as user message for left alignment */
    margin-right: auto; /* Same as user message */
    max-width: 100%; /* Full width for maximum space - same as user message */
}

.user-icon {
    width: clamp(36px, 5vw, 40px);
    height: clamp(36px, 5vw, 40px);
    font-size: clamp(1em, 1.8vw, 1.15em);
    border-radius: 8px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: none;
    transition: border-color 0.2s ease-out;
}

.user-icon:hover {
    border-color: var(--color-accent);
}

.agent-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    color: var(--color-accent);
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: none;
    transition: border-color 0.2s ease-out;
}

.agent-icon:hover {
    border-color: var(--color-accent);
}

/* Dark theme adjustments for icons */
body.dark-theme .user-icon {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    box-shadow: none;
}

body.dark-theme .user-icon:hover {
    border-color: var(--color-accent);
}

.message-content {
    /*padding: 14px 20px;*/ /* Increased default padding */
    border-radius: 12px;
    word-wrap: break-word;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    /*font-size: 1.05rem;*/
    /*line-height: 1.7;*/ 
    padding: clamp(14px, 3vw, 24px);
    font-size: clamp(0.875rem, 2.5vw, 1.125rem);
    line-height: clamp(1.4, 2vw, 1.7);
    font-family: var(--font-chat);
}

/* Markdown table styles for chat messages - Enhanced Responsive */
.message-content table {
    border-collapse: collapse;
    margin: 0;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem); /* Responsive font size */
    border: none; /* Border handled by wrapper */
    width: max-content; /* Take only the space needed for content */
    table-layout: auto; /* Allow natural column sizing */
    min-width: clamp(300px, 80vw, 100%); /* Responsive minimum width */
    max-width: 100%; /* Prevent table from exceeding container */
}

.message-content table th,
.message-content table td {
    padding: clamp(6px, 1.5vw, 12px); /* Responsive padding */
    text-align: left;
    border: 1px solid #ddd;
    word-wrap: break-word; /* Allow text wrapping to prevent overlapping */
    overflow-wrap: break-word; /* Handle long words */
    max-width: clamp(150px, 25vw, 250px); /* Responsive max width */
    min-width: clamp(60px, 15vw, 150px); /* Responsive minimum width */
    vertical-align: top; /* Align content to top of cell */
    font-size: clamp(0.75rem, 1.8vw, 0.9rem); /* Individual cell font scaling */
}

.message-content table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 1;
}

.message-content table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Style for the JavaScript-created table wrapper - Enhanced Responsive */
.table-scroll-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    margin: clamp(8px, 2vw, 12px) 0 !important; /* Responsive margin */
    border: 1px solid #ddd !important;
    border-radius: clamp(4px, 1vw, 8px) !important; /* Responsive border radius */
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    contain: layout !important;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem); /* Table container font scaling */
}

/* Ensure tables within scroll wrapper don't exceed available space */
.table-scroll-wrapper table {
    min-width: 300px !important; /* Ensure readability */
    max-width: none !important; /* Allow horizontal scroll if needed */
}
.agent-message .message-content {
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    border-radius: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.65;
    box-shadow: none;
    font-weight: 450;
    max-width: none;
    width: auto;
    flex: 1;
    overflow: hidden;
    min-height: 44px;
    transition: none;
}

.agent-message .message-content:hover {
    border-color: transparent;
}
body.dark-theme .message-content table tr:nth-child(even) {
    background: var(--color-bg-secondary);
}


/* Chat message code block styles */
.message-content pre {
    max-height: 300px;
    overflow-y: auto;
    /*overflow-x: auto;*/
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 16px;
    margin: 12px 0;
    font-family: var(--font-chat);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--color-text-primary);
    box-shadow: none;
}

.message-content pre::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.message-content pre::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.message-content pre::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.message-content pre::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

.message-content code {
    font-family: var(--font-chat);
    font-size: 12px;
    background: var(--color-bg-secondary);
    padding: 2px 5px;
    border-radius: 2px;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

/* Chat message list styles */
.message-content ol {
    counter-reset: list-counter;
    padding-left: 0;
    margin: 12px 0;
    list-style: none;
}

.message-content ol > li {
    display: block;
    margin: 8px 0;
    padding-left: 2em;
    position: relative;
    counter-increment: list-counter;
}

.message-content ol > li:before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
    color: var(--color-accent);
}

/* Nested lists inside ordered list items */
.message-content ol li ul {
    counter-reset: none;
    padding-left: 1.5em;
    margin: 8px 0;
    list-style: none;
}

.message-content ol li ul li {
    margin: 4px 0;
    padding-left: 1em;
    position: relative;
    counter-increment: none;
}

.message-content ol li ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-text-secondary);
    font-weight: normal;
}

/* Regular unordered lists */
.message-content ul {
    padding-left: 1.5em;
    margin: 12px 0;
    list-style: none;
}

.message-content ul li {
    margin: 6px 0;
    padding-left: 1em;
    position: relative;
}

.message-content ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-text-secondary);
}

.message-content h3 {
    margin: 16px 0 8px 0;
    color: var(--color-text-primary);
    font-weight: 600;
}

.message-content h4 {
    margin: 12px 0 6px 0;
    color: var(--color-text-primary);
    font-weight: 500;
}
/* Loading animation for agent messages */
.loading .agent-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Suggestion Buttons and Interactive Elements */
.suggestion-btn {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-visible, var(--color-border));
    color: var(--color-text-primary);
    padding: 10px 20px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s ease-out;
    box-shadow: none;
}

.suggestion-btn:hover {
    background: var(--color-text-display, var(--color-text-primary));
    color: var(--color-bg-primary);
    border-color: var(--color-text-display, var(--color-text-primary));
}

/* Message Feedback and References */
.message-feedback {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.feedback-btn,
.reference-toggle {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 5px 12px;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.15s ease-out;
}

.feedback-btn:hover,
.reference-toggle:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
}

.reference-toggle {
    margin-left: auto;
    color: var(--color-interactive, #007AFF);
    border-color: var(--color-border);
}

.references {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    font-size: 0.85em;
}

.references ul {
    list-style: none;
    padding-left: 0;
}

.references li {
    margin-bottom: 6px;
    color: var(--color-text-secondary);
}

.suggested-questions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}


/* Input Area Styles - IMPROVED */
.input-area {
    display: flex;
    flex-direction: column;
    padding: clamp(16px, 2vw, 24px);
    background: var(--color-bg-chat);
    border: none;
    align-items: stretch;
    gap: 6px;
    box-shadow: none;
    flex-shrink: 0;
    position: sticky;
    bottom: 0; /* Stick to bottom */
    z-index: 10;
    min-height: 88px;
    /* Add these new properties for better positioning */
    width: 100%;
    box-sizing: border-box;
    margin-top: auto; /* Push to bottom */
    min-height: clamp(76px, 10vh, 100px);
}

.input-controls {
    display: flex;
    align-items: flex-end;
    gap: clamp(8px, 2vw, 16px);
    width: 100%;
}

.input-disclaimer {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    line-height: 1.3;
    padding: 0 4px;
}

/* Layout stable states - improved */
.layout-stable .input-area,
.app-container .input-area {
    display: flex;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    /* Force recalculation when layout changes */
    transform: translateZ(0);
}

.layout-stable .chat-area,
.app-container .chat-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-height: 100vh;
}

/* Layout updating state improvements */
.layout-updating {
    visibility: hidden;
    /* Prevent flicker during transitions */
    transition: none !important;
}

.layout-updating * {
    pointer-events: none;
    transition: none !important;
}

/* Add specific styles for when right panel is toggling */
.app-container.panel-transitioning .input-area {
    /* Ensure input area stays at bottom during transitions */
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: none;
    padding: 0;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.2s ease-out;
    pointer-events: auto;
    min-width: 300px;
}

.notification-show {
    opacity: 1;
    transform: translateX(0);
}

.notification-hide {
    opacity: 0;
    transform: translateX(100%);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 12px;
}

.notification-message {
    flex: 1;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.15s ease;
}

.notification-close:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

/* Notification Types */
.notification-error {
    border-color: var(--color-accent);
}

.notification-error .notification-message {
    color: var(--color-accent);
}

.notification-warning {
    border-color: var(--color-warning, #D4A843);
}

.notification-warning .notification-message {
    color: var(--color-warning, #D4A843);
}

.notification-success {
    border-color: var(--color-success, #4A9E5C);
}

.notification-success .notification-message {
    color: var(--color-success, #4A9E5C);
}

.notification-info {
    border-color: var(--color-text-secondary);
}

.notification-info .notification-message {
    color: var(--color-text-secondary);
}

/* Dark theme adjustments */
body.dark-theme .notification {
    background: var(--color-bg-secondary);
    border-color: var(--color-border-sidebar);
}

body.dark-theme .notification-error .notification-message {
    color: var(--color-accent);
}

body.dark-theme .notification-warning .notification-message {
    color: var(--color-warning, #D4A843);
}

body.dark-theme .notification-success .notification-message {
    color: var(--color-success, #4A9E5C);
}

body.dark-theme .notification-info .notification-message {
    color: var(--color-text-secondary);
}

/* Config Inline Warnings — Nothing-style bracket text */
.config-inline-warning {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-accent);
    margin-top: 6px;
    padding: 0;
    background: none;
    border: none;
    line-height: 1.4;
}

/* Confirm-config floating notification box */
.config-confirm-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-warning);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.config-confirm-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.config-confirm-toast i {
    color: var(--color-warning);
    font-size: 1.1em;
    flex-shrink: 0;
}

body.dark-theme .config-confirm-toast {
    background: var(--color-bg-secondary);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

@keyframes blink-warn {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.config-inline-warning.blink {
    animation: blink-warn 0.4s ease-out 2;
}

/* Input area disabled state */
.input-area.disabled #userInput {
    background: var(--color-bg-secondary);
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.input-area.disabled #sendButton {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Stop Generation Button */
#stopButton {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: clamp(44px, 8vw, 48px);
    height: clamp(44px, 8vw, 48px);
    font-size: clamp(1em, 2vw, 1.2em);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    animation: stopPulse 2s ease-in-out infinite;
}

#stopButton:hover {
    background: #b02a37;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

#stopButton:active {
    transform: translateY(0);
}

#stopButton i {
    font-size: 1em;
}

@keyframes stopPulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(220, 53, 69, 0.6); }
}

/* Override: stop button must remain clickable when input area is disabled */
.input-area.disabled #stopButton {
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
}

/* Improved textarea styling */
#userInput {
    flex-grow: 1;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: clamp(12px, 3vw, 16px);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-family: 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
    color: var(--color-text-primary);
    resize: none;
    overflow-y: auto;
    min-height: clamp(40px, 7vw, 44px);
    max-height: clamp(80px, 15vh, 120px);
    line-height: 1.6;
    transition: border-color 0.2s ease-out;
    box-shadow: none;
    box-sizing: border-box;
    width: 100%;
}

#userInput:focus {
    outline: none;
    border-color: var(--color-text-primary);
    background: var(--color-bg-card);
    box-shadow: none;
}

#userInput::placeholder {
    color: var(--color-text-placeholder);
    font-weight: 300;
}

#sendButton {
    background: var(--color-accent);
    color: #FFFFFF;
    border: none;
    border-radius: 999px;
    width: clamp(40px, 7vw, 44px);
    height: clamp(40px, 7vw, 44px);
    font-size: clamp(0.9em, 1.8vw, 1em);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-out;
    flex-shrink: 0;
    box-shadow: none;
}

#sendButton:hover {
    background: var(--color-accent-secondary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 188, 255, 0.3);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton i {
    font-size: 1em;
}

/* Loading Indicator Styles */
.loading .message-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: none;
}

.dot-flashing {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: var(--color-accent);
    animation: dotFlashing 1.4s infinite linear alternate;
    animation-delay: 0.5s;
    margin-right: 4px;
}

.dot-flashing::before,
.dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: var(--color-accent);
}

.dot-flashing::before {
    left: -12px;
    animation: dotFlashing 1.4s infinite alternate;
    animation-delay: 0s;
}

.dot-flashing::after {
    left: 12px;
    animation: dotFlashing 1.4s infinite alternate;
    animation-delay: 1s;
}

@keyframes dotFlashing {
    0% {
        background-color: var(--color-accent);
        opacity: 1;
    }
    50%,
    100% {
        background-color: var(--color-text-secondary);
        opacity: 0.3;
    }
}

/* Add more specific styles as needed for icons, active states, etc. */


/* New Right Panel Styles */
.right-panel {
    grid-area: right;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-right-panel);
    border: none;
    padding: 0;
    /*overflow: hidden;*/
    scrollbar-width: 6px;
    scrollbar-color: var(--color-border) transparent;
    position: relative;
    transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    /* RESPONSIVE SCALING - Allow expansion on large screens */
    width: 100%;
    flex: 1;
}

/* Hidden by default on desktop — only shown inside mobile media query */
.bottom-sheet-handle {
    display: none;
}
.bottom-sheet-toggle {
    display: none !important;
}
.sidebar-backdrop {
    display: none;
}
.bottom-sheet-backdrop {
    display: none;
}

.right-panel.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0;
    overflow: hidden !important; /* Collapse button is outside panel (in app-container), so hidden is safe */
    padding: 0 !important;
    border: none;
}

.right-panel::-webkit-scrollbar {
    width: 6px;
}

.right-panel::-webkit-scrollbar-track {
    background: transparent;
}

.right-panel::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.right-panel::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-placeholder);
}

.accordion-container {
    background: var(--color-bg-card);
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    flex: 1;
    height: 100%;
}

.accordion-container:hover {
    box-shadow: none;
    transform: none;
}

.accordion-header {
    padding: clamp(10px, 2vw, 16px);
    background: var(--color-bg-secondary);
    border: none;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    transition: all 0.15s ease;
}

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

.accordion-header i {
    color: var(--color-accent);
    font-size: 1.1em;
}

.accordion-content {
    padding: clamp(16px, 3vw, 24px); /* Responsive padding */
    background: var(--color-bg-card);
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: clamp(0.875rem, 1.8vw, 1rem); /* Responsive content font size */
}

/* --- SQL/Visualization Viewer Area Sizing & Alignment --- */
.accordion-content.tab-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 20px;
    background: var(--color-bg-card);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden; /* Prevent double scrollbars - let child elements handle scrolling */
}

/* Optional: Make tab panes fill the area */
.tab-pane.active {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: normal;
    height: 100%;
}

/* Unified placeholder text style for empty tab panes */
.tab-pane > p,
.sql-query-container > p {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    padding: var(--spacing-md);
    margin: 0;
}

/* Scrollable SQL query container */
.sql-query-container {
    flex: 1;
    min-height: 0; /* Allow flex child to shrink below its content size */
    overflow-y: auto;
    overflow-x: hidden; /* Let the pre element handle horizontal scrolling */
    border: none; /* Let the pre element handle borders */
    border-radius: 0; /* Let the pre element handle border radius */
    background: transparent; /* Let the pre element handle background */
    box-shadow: none; /* Let the pre element handle shadows */
    margin: 0;
    position: relative;
}

.sql-query-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sql-query-container::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
    border-radius: 4px;
}

.sql-query-container::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.sql-query-container::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* Style for the SQL query pre/code block */
.sql-query-container pre {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    padding: 16px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid var(--color-border);
    box-shadow: none;
    margin: 0;
    height: auto;
    min-height: 200px;
    max-height: 80vh;
    overflow-y: auto; 
}

/* Legacy support for direct SQL display without container */
.accordion-content#sqlQueryDisplay pre {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre;
    word-wrap: normal;
    border: 1px solid var(--color-border);
    box-shadow: none;
    margin: 0;
}

/* Style for the plot display area */
.accordion-content#plotDisplay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    height: 100%;
    background: var(--color-bg-card);
    border-radius: 8px;
    color: var(--color-text-secondary);
    font-style: normal;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.75rem;
    border: 1px solid var(--color-border);
}

/* New styles for the visualization tabs */
.visualization-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.visualization-tabs {
    display: flex;
    border: none;
    background: transparent;
    margin-bottom: 16px;
    gap: 8px;
}

.tab-button {
    position: relative;
    padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 16px);
    border: 1px solid var(--color-border-visible, var(--color-border));
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 400;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    transition: all 0.2s ease-out;
    flex-grow: 0;
    font-size: clamp(0.75rem, 1.8vw, 0.8125rem);
    box-shadow: none;
    border: 1px solid var(--color-border-visible, var(--color-border));
}

.tab-button:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
}

.tab-button.active {
    background: var(--color-accent);
    color: #FFFFFF;
    box-shadow: none;
    border-color: var(--color-accent);
}

.tab-button.active i {
    color: var(--color-bg-primary) !important;
}

.tab-button i {
    color: var(--color-text-secondary);
    transition: color 0.3s ease;
    margin-right: 8px;
}

.tab-button:hover i {
    color: var(--color-text-primary);
}

/* Notification dot for visualization tab */
.tab-button .notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--color-accent);
    border-radius: 50%;
    border: 2px solid var(--color-bg-card);
    animation: pulse-notification 2s infinite;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    z-index: 999;
    pointer-events: none; /* Prevent interference with tab clicking */
}

.tab-button .notification-dot.visible {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Subtle pulsing animation for the notification dot */
@keyframes pulse-notification {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Hide notification dot when tab is active */
.tab-button.active .notification-dot {
    opacity: 0 !important;
    transform: scale(0) !important;
}

/* Data table styling */
.data-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 2px;
    background: var(--color-bg-card);
    box-shadow: none;
    border: 1px solid var(--color-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    border-radius: 0;
    overflow: hidden;
}

.data-table th {
    background: var(--color-bg-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    border: none;
    border-bottom: 2px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: 8px 14px;
    border: none;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}

.data-table tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

body.dark-theme .data-table tr:nth-child(even) {
    background: var(--color-bg-secondary);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Ensure plot containers fit */
.plot-container {
    width: 100%;
    height: auto;
}

/* Restored Data Indicator */
.restored-data-indicator {
    background: rgba(108, 117, 125, 0.1);
    border-left: 3px solid #6c757d;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 0 4px 4px 0;
    font-size: 0.875rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 6px;
}

.restored-data-indicator i {
    opacity: 0.7;
}

body.dark-theme .restored-data-indicator {
    background: rgba(108, 117, 125, 0.15);
    color: #adb5bd;
}

.restored-plot-disclaimer {
    background: rgba(255, 193, 7, 0.1);
    border-left: 3px solid #ffc107;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 0 4px 4px 0;
    font-size: 0.8rem;
    color: #856404;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.4;
}

.restored-plot-disclaimer i {
    margin-top: 2px;
    flex-shrink: 0;
}

body.dark-theme .restored-plot-disclaimer {
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
}

.dev-mode-note {
    font-size: 0.8em;
    color: var(--color-text-placeholder);
    font-style: italic;
    text-align: center;
    padding: 4px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 20px 18px;
    white-space: nowrap;
    border-top: 1px solid var(--color-border-sidebar);
    margin-top: auto;
    background: var(--color-bg-sidebar);
}

.sidebar-footer .theme-toggle {
    width: 100%;
    min-height: 48px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border: none;
    padding: 0 15px;
    white-space: nowrap;
    color: var(--color-sidebar-text);
    background: var(--color-bg-sidebar);
    transition: 0.2s ease-out;
}

.sidebar-footer .theme-toggle:hover {
    background: var(--color-hover);
}

.theme-toggle .theme-toggle-track {
    height: 20px;
    width: 36px;
    border-radius: 999px;
    margin-left: auto;
    background: var(--color-border-visible, #333333);
    position: relative;
    transition: opacity 0.2s ease-out, background-color 0.2s ease-out;
}

body.dark-theme .theme-toggle-track {
    background: var(--color-text-display, #FFFFFF);
}

.theme-toggle-track .theme-toggle-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-text-disabled, #666666);
    box-shadow: none;
    transition: transform 0.2s ease-out;
}

body.dark-theme .theme-toggle-indicator {
    transform: translateX(16px);
    background-color: #000000;
}

/* Theme Toggle as Nav Item - Force same styling as other nav items */
.sidebar-nav .secondary-nav .nav-item .theme-toggle {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    gap: 12px;
    white-space: nowrap;
    border-radius: 4px;
    padding: 7px 12px;
    align-items: center;
    text-decoration: none;
    border: 1px solid transparent;
    transition: 0.4s ease;
    color: var(--color-sidebar-text);
    min-height: 34px;
    max-height: 34px;
    font-size: var(--text-xs);
    line-height: 1;
}

.sidebar-nav .secondary-nav .nav-item .theme-toggle:hover {
    color: var(--color-accent);
    background: var(--color-sidebar-nav-hover);
}

/* Force theme toggle nav-label to match other nav-labels exactly */
.sidebar-nav .secondary-nav .nav-item .theme-toggle .nav-label {
    font-weight: 400;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-sidebar-text-secondary);
    transition: opacity 0.3s ease;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-grow: 0;
    flex-shrink: 0;
}

/* Theme icon - match other nav icons */
.theme-toggle .theme-icon {
    font-size: 1em;
    width: 20px;
    text-align: center;
    color: var(--color-sidebar-text-secondary);
}

/* Theme toggle track positioning - move to end like other nav items */
.sidebar-nav .secondary-nav .nav-item .theme-toggle .theme-toggle-track {
    margin-left: auto;
    opacity: 1;
    width: 40px;
    flex-shrink: 0;
}

/* Right Panel Collapse Button - Styled to match sidebar toggle */
.right-panel-collapse-btn {
    position: fixed;
    right: 40vw;
    top: 50%;
    transform: translate(12px, -50%);
    width: 30px;
    height: 30px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 1000;
    color: var(--color-text-secondary);
    opacity: 1 !important;
    visibility: visible !important;
}

.right-panel-collapse-btn:hover {
    background: var(--color-hover);
    color: var(--color-accent);
    transform: translate(8px, -50%);
    box-shadow: none;
}

.right-panel-collapse-btn i {
    font-size: 1.2rem;
    color: inherit;
    transition: all var(--transition-slow);
}

.right-panel-collapse-btn.collapsed {
    right: 0;
    transform: translate(-12px, -50%);
}

.right-panel-collapse-btn.collapsed:hover {
    transform: translate(-8px, -50%);
}

/* Dark theme support for right panel collapse button */
body.dark-theme .right-panel-collapse-btn {
    background: var(--color-sidebar-nav-hover);
    color: var(--color-sidebar-text);
}

body.dark-theme .right-panel-collapse-btn:hover {
    background: var(--color-hover);
    color: var(--color-accent);
}

/* Fix the icon direction logic - when collapsed show left arrow, when open show right arrow */
.right-panel-collapse-btn.collapsed i {
    transform: rotate(180deg); /* Right arrow when collapsed (pointing left to open) */
}

.right-panel-collapse-btn:not(.collapsed) i {
    transform: rotate(0deg); /* Left arrow when open (pointing right to close) */
}

/* Adjust button position when sidebar is collapsed */
/* Only adjust position on desktop (hidden on mobile via 768px rule) */
@media (min-width: 769px) {
    .app-container:has(.sidebar.collapsed) .right-panel-collapse-btn:not(.collapsed) {
        right: 40vw;
    }
}

/* Adjust app container grid for collapsed state — desktop only */
@media (min-width: 769px) {
    .app-container:has(.right-panel.collapsed) {
        grid-template-columns: 800px 1fr 0;
    }

    .app-container:has(.right-panel.collapsed):has(.sidebar.collapsed) {
        grid-template-columns: 85px 1fr 0;
    }
}

/* List styling within message content */
.message-content ol,
.message-content ul {
    margin: 8px 0;
    padding-left: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-content ol {
    counter-reset: list-counter;
    list-style: none;
}

.message-content ol li {
    counter-increment: list-counter;
    margin-bottom: 4px;
    padding-left: 35px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

.message-content ol li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 600;
    color: var(--color-accent);
    min-width: 30px;
    text-align: left;
}

.message-content ul {
    list-style: none;
}

.message-content ul li {
    margin-bottom: 4px;
    padding-left: 20px;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

.message-content ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* Nested list handling */
.message-content ol ol,
.message-content ul ul,
.message-content ol ul,
.message-content ul ol {
    margin: 4px 0;
    padding-left: 20px;
}

.message-content ol ol li::before {
    content: counter(list-counter, lower-alpha) ".";
}

.message-content ul ul li::before {
    content: "◦";
}

/* Legacy Info Card Styles - REPLACED BY INFO MODALS */
/* Old info card functionality has been replaced by modal implementation */
/* See Info Modal Styles section below for current implementation */

/* Info Modal Styles - Modern popup modals for Data Knowledge and Help */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.info-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.info-modal {
    background: var(--color-bg-card);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    box-shadow: none;
    animation: slideIn 0.2s ease-out;
    border: 1px solid var(--color-border-visible, var(--color-border));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.info-modal-header {
    background: var(--color-bg-secondary);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.info-modal-header i {
    color: var(--color-accent);
    font-size: 1.3em;
}

.info-modal-title {
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
    flex-grow: 1;
}

.info-modal-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 2px;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-modal-close:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
    transform: scale(1.05);
}

.info-modal-content {
    padding: 24px;
    color: var(--color-text-primary);
    line-height: 1.6;
    font-size: 1rem;
    overflow-y: auto;
    flex-grow: 1;
}

.info-modal-content h1,
.info-modal-content h2,
.info-modal-content h3,
.info-modal-content h4 {
    color: var(--color-text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.info-modal-content h1:first-child,
.info-modal-content h2:first-child,
.info-modal-content h3:first-child,
.info-modal-content h4:first-child {
    margin-top: 0;
}

.info-modal-content ul,
.info-modal-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.info-modal-content li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.info-modal-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.info-modal-content code {
    background: var(--color-bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.info-modal-content pre {
    background: var(--color-bg-secondary);
    padding: 16px;
    border-radius: 2px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    margin: 1rem 0;
}

/* Link styling for better visibility in both light and dark modes */
.info-modal-content a {
    color: var(--color-accent);
    text-decoration: underline;
    transition: color 0.2s ease;
    font-weight: 500;
}

.info-modal-content a:hover {
    color: var(--color-accent-secondary);
    text-decoration: none;
}

.info-modal-content a:visited {
    color: var(--color-accent);
    opacity: 0.8;
}

/* Dark theme support for info modal */
body.dark-theme .info-modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

/* Dark theme specific link colors for better visibility */
body.dark-theme .info-modal-content a {
    color: #60a5fa; /* Light blue - much more visible on dark background */
}

body.dark-theme .info-modal-content a:hover {
    color: #93c5fd; /* Even lighter blue on hover */
}

body.dark-theme .info-modal-content a:visited {
    color: #60a5fa;
    opacity: 0.9;
}

/* Mobile responsiveness for info modal */
@media (max-width: 768px) {
    .info-modal {
        width: 95%;
        max-height: 85vh;
        margin: 20px;
    }
    
    .info-modal-header {
        padding: 16px 20px;
    }
    
    .info-modal-content {
        padding: 20px;
        font-size: 0.95rem;
    }
}

/* Loading spinner for modal content */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

.loading-spinner::after {
    content: '';
    display: inline-block;
    border: 2px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

/* Visual state for active nav links */
.nav-item.info-modal-active > .nav-link {
    background: var(--color-sidebar-nav-hover);
    color: var(--color-accent);
}

/* Hide old info card container - use new modal instead */
.info-card-container {
    display: none !important; /* Hide old info cards */
}

/* Align SQL feedback and info card text with chat message styles */
#sqlFeedbackButtons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
#sqlFeedbackButtons span {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-primary);
    line-height: 1.5;
}
#sqlFeedbackButtons button {
    background: none;
    border: none;
    outline: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}
#sqlFeedbackButtons i {
    font-size: 1.2em;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
}
#sqlFeedbackButtons button:hover {
    background-color: var(--color-hover);
}
#sqlFeedbackButtons button:hover i {
    color: var(--color-text-primary);
}

/* Specific hover effects for thumbs up and thumbs down */
#sqlFeedbackButtons button#thumbs-up:hover {
    background-color: rgba(34, 197, 94, 0.1); /* Green background with opacity */
}
#sqlFeedbackButtons button#thumbs-up:hover i {
    color: #22c55e; /* Green color for thumbs up */
}

#sqlFeedbackButtons button#thumbs-down:hover {
    background-color: rgba(239, 68, 68, 0.1); /* Red background with opacity */
}
#sqlFeedbackButtons button#thumbs-down:hover i {
    color: #ef4444; /* Red color for thumbs down */
}
/* Active/clicked states for feedback buttons */
#sqlFeedbackButtons button.clicked {
    background-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(0, 87, 184, 0.3);
    border: 1px solid var(--color-accent);
}

#sqlFeedbackButtons button.clicked i {
    color: white !important;
}

#sqlFeedbackButtons button#thumbs-up.clicked {
    background-color: #22c55e !important; /* Green for thumbs up */
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    border: 1px solid #22c55e;
}

#sqlFeedbackButtons button#thumbs-down.clicked {
    background-color: #ef4444 !important; /* Red for thumbs down */
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    border: 1px solid #ef4444;
}

/* ===== Thinking Process ===== */
.thinking-process {
    margin-bottom: 12px;
    margin-left: 56px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-secondary);
    overflow: hidden;
    font-size: 0.85rem;
    width: calc(100% - 56px);
    flex-shrink: 0;
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.thinking-header i {
    color: var(--color-accent);
    font-size: 0.85rem;
}

.thinking-process.collapsed {
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    background: var(--color-bg-secondary);
    padding: 0;
    overflow: hidden;
    margin-bottom: 12px;
    display: block;
    flex-shrink: 0;
}

.thinking-process.collapsed > summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
}

.thinking-process.collapsed > summary::-webkit-details-marker {
    display: none;
}

.thinking-process.collapsed > summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 6px;
    font-size: 0.65rem;
    transition: transform 0.2s ease;
    color: var(--color-text-secondary);
}

.thinking-process.collapsed[open] > summary::before {
    transform: rotate(90deg);
}

.collapsed-header:hover {
    background: var(--color-bg-tertiary, rgba(0,0,0,0.03));
}

.thinking-step-count {
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 4px;
    font-weight: 600;
}

.thinking-steps-list {
    padding: 4px 14px 10px;
    max-height: 260px;
    overflow-y: auto;
}

.thinking-step {
    padding: 5px 0;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--color-border);
}

.thinking-step:last-child {
    border-bottom: none;
}

.thinking-step.completed {
    opacity: 0.85;
}

.thinking-step.in-progress {
    color: var(--color-text-primary, var(--color-text));
}

.thinking-step-icon {
    font-size: 0.75rem;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    color: var(--color-accent);
}

.thinking-step-label {
    font-weight: 500;
    white-space: nowrap;
}

.thinking-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-step-detail-row {
    padding-left: 36px;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--color-text-tertiary, var(--color-text-secondary));
    line-height: 1.35;
    word-break: break-word;
}

.thinking-step-detail-row code {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    font-size: 0.72rem;
    background: rgba(0,0,0,0.05);
    padding: 1px 4px;
    border-radius: 3px;
}

.thinking-step-summary {
    color: var(--color-text-tertiary, var(--color-text-secondary));
    font-size: 0.75rem;
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.thinking-step-done {
    color: #22c55e;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.thinking-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: thinking-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes thinking-spin {
    to { transform: rotate(360deg); }
}

/* ===== End Thinking Process ===== */

/* User Response Feedback Buttons - similar to SQL feedback but for chat messages */
.userResponseFeedbackButtons {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    /* border-top: 1px solid var(--color-border); */
}

/* View Results Button Container */
.view-results-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

.view-results-container:empty {
    display: none;
}

/* View Results Button */
.view-results-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    margin-bottom: 8px;
    padding: 8px 14px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
}

.view-results-btn:hover {
    background: var(--color-accent-secondary);
    box-shadow: none;
    transform: none;
}

.view-results-btn:active {
    transform: none;
    box-shadow: none;
}

.view-results-btn i {
    font-size: 1.1em;
}

body.dark-theme .view-results-btn {
    background: var(--color-accent);
    box-shadow: none;
}

body.dark-theme .view-results-btn:hover {
    box-shadow: none;
}

/* Download Split Button */
.download-split-btn {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: nowrap;
    margin-left: 8px;
}

.download-main-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bayer-green);
    color: white;
    border: none;
    border-radius: 2px 0 0 2px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    white-space: nowrap;
}

.download-main-btn:hover {
    background: #579E0F;
    box-shadow: none;
}

.download-main-btn:disabled,
.download-main-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.download-main-btn i {
    font-size: 1.1em;
}

.download-arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    background: #579E0F;
    color: white;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 2px 2px 0;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    font-size: 0.85rem;
}

.download-arrow-btn:hover {
    background: #4A8A0D;
    box-shadow: none;
}

/* Inline options row */
.download-options-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.download-option-pill {
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: transparent;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.download-option-pill:hover {
    border-color: var(--bayer-green);
    color: var(--bayer-green);
    background: rgba(102, 181, 18, 0.06);
}

.download-option-pill.active {
    background: var(--bayer-green);
    color: white;
    border-color: var(--bayer-green);
    font-weight: 600;
}

/* Custom row input inline */
.download-custom-input {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.download-custom-field {
    width: 72px;
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.82rem;
    color: #333;
    background: #fff;
    text-align: center;
}

.download-custom-field:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}

.download-custom-field::-webkit-inner-spin-button,
.download-custom-field::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.download-custom-label {
    font-size: 0.8rem;
    color: #888;
}

/* Dark theme */
body.dark-theme .download-main-btn {
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

body.dark-theme .download-main-btn:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.5);
}

body.dark-theme .download-arrow-btn {
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
}

body.dark-theme .download-option-pill {
    border-color: rgba(255, 255, 255, 0.2);
    color: #bbb;
}

body.dark-theme .download-option-pill:hover {
    border-color: #28a745;
    color: #5bda7b;
    background: rgba(40, 167, 69, 0.12);
}

body.dark-theme .download-option-pill.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

body.dark-theme .download-custom-field {
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .download-custom-field:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

body.dark-theme .download-custom-label {
    color: #888;
}

/* User Message Actions Container */
.userMessageActions {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.userResponseFeedbackButtons span {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.userResponseFeedbackButtons button {
    background: none;
    border: none;
    outline: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.userResponseFeedbackButtons i {
    font-size: 1.1em;
    color: var(--color-text-secondary);
    transition: color 0.2s ease;
}

.userResponseFeedbackButtons button:hover {
    background-color: var(--color-hover);
}

.userResponseFeedbackButtons button:hover i {
    color: var(--color-text-primary);
}

/* Specific hover effects for user response feedback */
.userResponseFeedbackButtons button.response-thumbs-up:hover {
    background-color: rgba(34, 197, 94, 0.1); /* Green background with opacity */
}

.userResponseFeedbackButtons button.response-thumbs-up:hover i {
    color: #22c55e; /* Green color for thumbs up */
}

.userResponseFeedbackButtons button.response-thumbs-down:hover {
    background-color: rgba(239, 68, 68, 0.1); /* Red background with opacity */
}

.userResponseFeedbackButtons button.response-thumbs-down:hover i {
    color: #ef4444; /* Red color for thumbs down */
}

/* Active/clicked states for user response feedback buttons */
.userResponseFeedbackButtons button.clicked {
    background-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(0, 87, 184, 0.3);
    border: 1px solid var(--color-accent);
}

.userResponseFeedbackButtons button.clicked i {
    color: white !important;
}

.userResponseFeedbackButtons button.response-thumbs-up.clicked {
    background-color: #22c55e !important; /* Green for thumbs up */
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    border: 1px solid #22c55e;
}

.userResponseFeedbackButtons button.response-thumbs-down.clicked {
    background-color: #ef4444 !important; /* Red for thumbs down */
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    border: 1px solid #ef4444;
}

/* User Message Regenerate Button */
.userMessageRegenerateButton {
    display: flex;
    align-items: center;
}

.user-regenerate-btn {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.user-regenerate-btn:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
    border-color: var(--color-accent);
}

.user-regenerate-btn i {
    font-size: 0.9em;
    transition: transform 0.2s ease;
}

.user-regenerate-btn:hover i {
    transform: rotate(180deg);
}

.user-regenerate-btn span {
    font-weight: 500;
}

.user-regenerate-btn .ask-again-text {
    font-size: 0.60rem;
    font-weight: 400;
}

/* Copy Button Styles */
.sql-header {
    position: relative;
    margin-bottom: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px;
}

.sql-copy-button,
.sql-train-button {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: none;
    z-index: 10;
}

.sql-copy-button:hover,
.sql-train-button:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
    transform: none;
    box-shadow: none;
}

.sql-copy-button.copied {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.sql-copy-button.copied i {
    color: white !important;
}

/* Mark as Helpful button specific styles */
.sql-train-button {
    position: relative;
}

.sql-train-button:hover {
    background: #ec4899;
    color: white;
    border-color: #ec4899;
}

.sql-train-button:hover i {
    color: white;
}

.sql-train-button:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sql-train-button.trained {
    background: #10b981;
    color: white;
    border-color: #10b981;
    cursor: default;
}

.sql-train-button.trained i {
    color: white;
}

.sql-train-button.trained:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(0);
}

/* Info button styles */
.sql-info-button {
    background: transparent;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    margin-left: -4px; /* Pull closer to bookmark button */
}

.sql-info-button:hover {
    background: var(--color-hover);
    color: var(--color-accent);
    transform: scale(1.1);
}

.sql-info-button:active {
    transform: scale(0.95);
}

.sql-info-button i {
    transition: color 0.2s ease;
}

/* Ensure the SQL display container has relative positioning for absolute button */
#sqlQueryDisplay {
    position: relative;
}

#sqlQueryDisplay pre {
    position: relative;
    padding-top: 30px; /* Make room for the copy button */
}

.info-card-content,
.info-card-content p,
.info-card-content ul,
.info-card-content li {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text-primary);
    line-height: 1.5;
}

/* Session Expired Styling */
.session-expired .message-content {
    background: #fff3cd;
    border-left: 4px solid #f39c12;
    padding: 1rem;
    border-radius: 4px;
    color: #856404;
}

.dark-theme .session-expired .message-content {
    background: #3d2914;
    border-left: 4px solid #f39c12;
    color: #ffc107;
}

.session-expired .agent-icon i {
    color: #f39c12;
}

/* Login Prompt Modal */
.login-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-in-out;
}

.login-prompt-modal {
    background: var(--color-bg-card);
    border-radius: 2px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-in-out;
    border: 1px solid var(--color-border);
}

.login-prompt-content h3 {
    margin-top: 0;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.login-prompt-content h3 i {
    color: #f39c12;
}

.login-prompt-content p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.login-prompt-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: background-color 0.15s ease;
    flex: 1;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-secondary);
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-hover);
}

/* Session Expired Styles */
.session-expired .message-content {
    background: #fff3cd;
    border-left: 4px solid #f39c12;
    padding: 1rem;
    border-radius: 4px;
    color: #856404;
}

body.dark-theme .session-expired .message-content {
    background: #2d2a1f;
    border-left: 4px solid #f39c12;
    color: #ffc107;
}

.login-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.login-prompt-modal {
    background: var(--color-bg-card);
    border-radius: 4px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.2s ease-out;
    border: 1px solid var(--color-border);
}

.login-prompt-content h3 {
    margin-top: 0;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
}

.login-prompt-content p {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.login-prompt-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 2px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.15s ease;
    text-align: center;
    justify-content: center;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-secondary);
    transform: none;
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-hover);
}


/* Utility class for using dynamic scaling */
.dynamic-scale {
    transform: scale(var(--dynamic-scale, 1));
    transform-origin: center;
}

.width-responsive {
    width: calc(100% * var(--width-scale, 1));
}

.height-responsive {
    height: calc(100% * var(--height-scale, 1));
}
/* Multi-Select Database-Schema Component */
.multi-select-container {
    width: 100%;
}

.multi-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
}

.selected-count {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.refresh-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.multi-select-dropdown {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
}

.multi-select-options {
    padding: 8px;
}

.database-group {
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg-secondary);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: start;
    min-height: 48px;
}

.database-header {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-right: 1px solid var(--color-border);
    min-height: 48px;
}

.database-header .checkbox-label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.database-name {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.95em;
}

.schema-count {
    font-size: 0.8em;
    color: var(--color-text-secondary);
    margin-left: auto;
    margin-right: 8px;
}

.expand-btn {
    display: none;
}

.schema-list {
    grid-column: 2;
    grid-row: 1;
    padding: 8px 16px;
    max-height: none;
    overflow-y: visible;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.schema-list.collapsed {
    display: flex;
    max-height: none;
    padding: 8px 16px;
    overflow: visible;
}

.schema-item {
    display: block;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 4px;
}

.schema-item:hover {
    background: var(--color-hover);
}

.checkbox-label {
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.loading-state,
.error-state,
.empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.error-state {
    color: var(--error-color, #ff4444);
}

.loading-state i {
    margin-right: 8px;
}

/* Database & Schema Selection Button */
.db-schema-select-btn {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid var(--color-border-sidebar);
    border-radius: 2px;
    background: var(--color-bg-primary);
    color: var(--color-sidebar-text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.db-schema-select-btn:hover:not(:disabled):not(.disabled) {
    background: var(--color-hover);
    border-color: var(--color-accent);
}

.db-schema-select-btn:disabled,
.db-schema-select-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--color-bg-secondary);
}

/* Grey out the entire Database & Schema row (label + button) when locked */
.dropdown-selector:has(#openDbSchemaModalBtn:disabled),
.dropdown-selector:has(#openDbSchemaModalBtn.disabled) {
    opacity: 0.5;
    pointer-events: none;
}

.db-schema-select-btn .selected-count {
    flex: 1;
    text-align: left;
}

/* Warmup Status Indicator */
.warmup-status {
    margin-top: 10px;
    padding: 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.warmup-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.warmup-progress-fill {
    height: 100%;
    background: var(--color-accent);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.warmup-status-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: var(--color-text-secondary);
}

.warmup-status-text i {
    color: #667eea;
}

.warmup-status.background-warmup {
    animation: warmup-pulse 2s ease-in-out infinite;
}

@keyframes warmup-pulse {
    0%, 100% { border-color: var(--color-border); }
    50% { border-color: #667eea; }
}

.warmup-dismiss-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.warmup-dismiss-btn:hover {
    opacity: 1;
}

/* Icon Button (for refresh, etc.) */
.icon-btn {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 40px;
}

.icon-btn:hover:not(:disabled) {
    background: var(--color-hover);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.icon-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn i.fa-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Database & Schema Modal */
.db-schema-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.db-schema-modal {
    background: var(--color-bg-card);
    border-radius: 16px;
    box-shadow: none;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
    border: 1px solid var(--color-border-visible, var(--color-border));
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.db-schema-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.db-schema-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--color-text-primary);
}

.db-schema-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.db-schema-modal-close:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
}

.db-schema-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 24px;
    min-height: 0;
    max-height: calc(85vh - 160px); /* Modal height minus header/footer */
}

.db-schema-selection-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    padding: 8px;
}

.selection-tree-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.config-detail-column {
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--color-border);
    padding-left: 20px;
}

.db-schema-column {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    background: var(--color-bg-secondary);
    max-height: 100%;
}

.db-schema-column h4 {
    margin: 0;
    padding: 16px 20px;
    background: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    flex-shrink: 0;
}

.selection-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: 16px;
    max-height: calc(85vh - 180px);
}

.selection-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.selection-item:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
}

.selection-item.selected {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.selection-item input[type="checkbox"] {
    margin-right: 12px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.selection-item-label {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

.selection-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding-left: 12px;
}

.selection-item-count {
    font-size: 0.85em;
    color: var(--color-text-secondary);
}

.selection-item.selected .selection-item-count {
    color: rgba(255, 255, 255, 0.8);
}

.db-refresh-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.7;
}

.db-refresh-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--color-accent);
    opacity: 1;
}

.selection-item.selected .db-refresh-btn {
    color: rgba(255, 255, 255, 0.8);
}

.selection-item.selected .db-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.db-refresh-btn i.fa-spin {
    animation: spin 1s linear infinite;
}

.selection-item.active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

/* Cluster Quick Select Styles */
.cluster-item {
    display: flex;
    flex-direction: column;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto; /* Ensure clickable by default */
}

.cluster-item:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cluster-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    pointer-events: none;
}

.cluster-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    pointer-events: auto;
    flex-shrink: 0;
}

.cluster-item i {
    font-size: 2rem;
    color: var(--color-accent);
    pointer-events: none;
}

.cluster-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    pointer-events: none; /* Allow clicks to pass through to parent */
}

.cluster-description {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    pointer-events: none; /* Allow clicks to pass through to parent */
}

.cluster-item.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.3);
}

.cluster-item.active i,
.cluster-item.active .cluster-label,
.cluster-item.active .cluster-description {
    color: white;
}

.cluster-item.disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.cluster-item.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--color-border);
}

.db-schema-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--color-border);
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border-radius: 2px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-secondary);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-hover);
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */

.login-page {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background: #F5F5F5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: var(--spacing-2xl);
    position: relative;
    z-index: 10;
}

.login-card {
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: none;
    padding: var(--spacing-3xl) var(--spacing-2xl);
    text-align: center;
    position: relative;
    z-index: 20;
    animation: fadeInUp 0.25s ease-out;
    border: 1px solid #E8E8E8;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    margin-bottom: var(--spacing-2xl);
    text-align: center;
}

.login-logo img {
    max-width: 180px;
    height: auto;
    display: inline-block;
}

.login-header {
    margin-bottom: var(--spacing-2xl);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: #000000;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.login-subtitle {
    font-size: 0.6875rem;
    color: #666666;
    font-weight: 400;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-message {
    margin-bottom: var(--spacing-3xl);
    padding: 0 var(--spacing-md);
}

.login-message p {
    font-size: 0.875rem;
    color: #666666;
    line-height: 1.6;
    font-family: var(--font-body);
}

.login-action {
    margin-bottom: var(--spacing-2xl);
}

.azure-login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    background: #000000;
    color: #FFFFFF;
    padding: 12px 32px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s ease-out;
    box-shadow: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 30;
    min-height: 44px;
}

.azure-login-button:hover {
    background: var(--color-accent);
    color: #FFFFFF;
    transform: none;
    box-shadow: none;
}

.azure-login-button:active {
    opacity: 0.8;
}

.azure-login-button i {
    font-size: 1.25rem;
}

/* Floating toast notification for flash messages */
.login-toast {
    position: fixed;
    top: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 10px 24px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    animation: toastIn 0.25s ease-out;
}

.login-toast.alert-info,
.login-toast.alert-success {
    background: #1A1A1A;
    color: #E8E8E8;
}

.login-toast.alert-danger {
    background: var(--color-accent);
    color: #FFFFFF;
}

.login-toast.fade-out {
    animation: toastOut 0.4s ease-out forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

.login-footer {
    margin-top: var(--spacing-xl);
    padding-top: 0;
}

.login-help-text {
    font-size: 0.7rem;
    color: #999999;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.login-help-text i {
    color: var(--color-accent);
}

/* Background decoration */
.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.login-bg-shape {
    position: absolute;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 0;
    animation: none;
}

.login-bg-shape.shape-1 {
    width: 1px;
    height: 100%;
    top: 0;
    left: 25%;
}

.login-bg-shape.shape-2 {
    width: 1px;
    height: 100%;
    top: 0;
    right: 25%;
}

.login-bg-shape.shape-3 {
    width: 100%;
    height: 1px;
    top: 30%;
    left: 0;
}

/* ---- Request Access Section ---- */
.request-access-section {
    margin-top: var(--spacing-lg);
    text-align: center;
}

.request-access-section .divider-text {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.request-access-section .divider-text::before,
.request-access-section .divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E8E8E8;
}

.request-access-section .divider-text span {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #999999;
    white-space: nowrap;
}

.request-access-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    background: transparent;
    color: #1A1A1A;
    padding: 10px 24px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.2s ease-out;
    border: 1px solid #CCCCCC;
    cursor: pointer;
    min-height: 40px;
}

.request-access-button:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.request-help-text {
    margin-top: var(--spacing-sm);
    font-size: 0.6875rem;
    color: #999999;
    line-height: 1.4;
}

.request-help-text strong {
    color: #666666;
    font-weight: 500;
}

/* Responsive design for login page */
@media (max-width: 768px) {
    .login-container {
        max-width: 90%;
        padding: var(--spacing-lg);
    }
    
    .login-card {
        padding: var(--spacing-2xl) var(--spacing-lg);
    }
    
    .login-logo img {
        max-width: 140px;
        height: auto;
        display: inline-block;
    }
    
    .login-header h1 {
        font-size: var(--text-lg);
    }
    
    .azure-login-button {
        width: 100%;
        padding: var(--spacing-md) var(--spacing-xl);
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: var(--spacing-md);
    }
    
    .login-card {
        padding: var(--spacing-xl) var(--spacing-md);
    }
    
    .login-logo img {
        max-width: 120px;
        height: auto;
        display: inline-block;
    }
    
    .login-bg-shape.shape-1,
    .login-bg-shape.shape-2,
    .login-bg-shape.shape-3 {
        display: none; /* Hide decorative shapes on very small screens */
    }   
}

/* Tree Structure Styles for Modal */
.tree-structure {
    width: 100%;
}

.tree-node {
    margin: 0;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.2s;
    user-select: none;
}

.tree-node-header:hover {
    background-color: var(--color-hover);
}

/* Cluster nodes - unchecked state (default) */
.cluster-node > .tree-node-header {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    font-weight: 600;
    margin-bottom: 4px;
    padding: 12px 14px;
    border-radius: 2px;
    border: 2px solid var(--color-border);
    transition: all 0.2s;
}

.cluster-node > .tree-node-header:hover {
    background: var(--color-hover);
    border-color: var(--color-accent);
}

.cluster-node .tree-icon {
    color: var(--color-accent);
    font-size: 1.2rem;
}

.cluster-node .tree-label {
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.cluster-node .tree-expand-btn {
    color: var(--color-text-primary);
}

/* Database nodes */
.database-node > .tree-node-header {
    padding-left: 32px;
    border-left: 2px solid var(--color-border);
    margin-left: 12px;
    background-color: var(--color-bg-card);
}

.database-node > .tree-node-header:hover {
    background-color: var(--color-hover);
    border-left-color: var(--color-accent);
}

/* Locked database nodes (e.g. AURORA_DATAPRODUCTS — select all or nothing) */
.database-node.locked > .tree-node-header {
    cursor: default;
}

.database-node.locked > .tree-node-header:hover {
    background-color: var(--color-bg-card);
    border-left-color: var(--color-border);
}

.database-node.locked .database-checkbox {
    cursor: not-allowed;
    opacity: 0.5;
}

.database-node .tree-icon {
    color: var(--color-accent);
    font-size: 1rem;
}

.database-node .tree-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Schema nodes */
.schema-node > .tree-node-header {
    padding-left: 56px;
    border-left: 2px solid var(--color-border);
    margin-left: 32px;
}

.schema-node > .tree-node-header:hover {
    background-color: var(--color-hover);
    border-left-color: var(--color-accent);
}

.schema-node .tree-icon {
    color: #6c757d;
    font-size: 0.9rem;
}

.schema-node .tree-label {
    font-size: 0.85rem;
}

.schema-node .tree-meta {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    margin-left: auto;
}

/* Tree checkboxes and radio buttons */
.tree-checkbox,
.tree-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--color-accent);
}

.cluster-node .tree-checkbox {
    accent-color: var(--color-accent);
}

/* Cluster node - checked state (checkbox) */
.cluster-node > .tree-node-header:has(.tree-checkbox:checked) {
    background: var(--color-accent);
    box-shadow: none;
    border-color: transparent;
}

.cluster-node > .tree-node-header:has(.tree-checkbox:checked) .tree-icon,
.cluster-node > .tree-node-header:has(.tree-checkbox:checked) .tree-label,
.cluster-node > .tree-node-header:has(.tree-checkbox:checked) .tree-expand-btn {
    color: white;
}

.cluster-node > .tree-node-header:has(.tree-checkbox:checked) .tree-checkbox {
    accent-color: white;
}

/* Expand/collapse button */
.tree-expand-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.tree-expand-btn:hover {
    opacity: 1;
}

.tree-expand-btn i {
    transition: transform 0.2s;
}

/* Tree children container */
.tree-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.tree-children.expanded {
    max-height: 5000px;
    overflow: visible;
    transition: max-height 0.5s ease-in;
}

/* Checked state styling */
.tree-node-header:has(.tree-checkbox:checked),
.tree-node-header:has(.tree-radio:checked) {
    background-color: rgba(0, 123, 255, 0.1);
}

/* Cluster checked state is defined above with specific styling */

.database-node > .tree-node-header:has(.tree-checkbox:checked) {
    border-left-color: var(--color-accent);
    background-color: rgba(0, 123, 255, 0.15);
}

.schema-node > .tree-node-header:has(.tree-checkbox:checked),
.schema-node > .tree-node-header:has(.tree-radio:checked) {
    border-left-color: var(--color-accent);
    background-color: rgba(0, 123, 255, 0.1);
}

.schema-node {
    position: relative;
}

/* Schema Config Button */
.schema-config-btn {
    margin-left: auto;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.schema-config-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.schema-config-btn i {
    font-size: 0.9rem;
}

/* Config Modal */
.config-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.config-modal {
    background: var(--color-bg-card);
    border-radius: 4px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--color-border);
}

.config-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.config-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-family: var(--font-display);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    color: var(--color-text-primary);
}

.config-modal-close {
    background: none;
    border: 1px solid var(--color-border);
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.15s;
}

.config-modal-close:hover {
    background: var(--color-hover);
    color: var(--color-text-primary);
}

.config-modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Config Detail Panel */
.config-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-accent);
    color: white;
    border-radius: 2px;
    margin-bottom: 16px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.config-detail-header i {
    font-size: 1.1rem;
}

.config-detail-content {
    flex: 1;
    overflow-y: auto;
}

.config-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    text-align: center;
}

.config-empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.config-empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

.config-detail-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 16px;
}

.config-detail-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border);
}

.config-detail-section {
    margin-bottom: 16px;
}

.config-detail-section:last-child {
    margin-bottom: 0;
}

.config-section-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.config-section-value {
    font-size: 1rem;
    color: var(--color-text-primary);
    padding: 8px 12px;
    background: var(--color-bg-secondary);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.config-section-value.config-true {
    color: #28a745;
    font-weight: 600;
}

.config-section-value.config-false {
    color: #dc3545;
    font-weight: 600;
}

.config-prefix-list {
    margin-top: 8px;
    padding-left: 12px;
}

.config-prefix-item {
    padding: 6px 10px;
    background: var(--color-accent);
    color: white;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    display: inline-block;
    margin: 4px 4px 4px 0;
}

/* Editable Config Styles */
.config-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.95em;
    font-family: 'Monaco', 'Courier New', monospace;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.config-input[readonly] {
    background-color: #f0f0f0;
    color: #666;
    cursor: not-allowed;
    opacity: 0.8;
}

.config-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.config-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.config-checkbox-label {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 1em;
    cursor: pointer;
}

.config-prefix-section {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--color-bg-secondary);
    border-radius: 2px;
    border: 1px solid var(--color-border);
}

.config-prefix-inputs {
    margin-bottom: 10px;
}

.config-prefix-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.config-prefix-input {
    flex: 1;
    background-color: white !important;
    cursor: text !important;
}

.config-prefix-remove-btn {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.config-prefix-remove-btn:hover {
    background-color: #d32f2f;
}

.config-add-prefix-btn {
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-add-prefix-btn:hover {
    background-color: #5568d3;
}

.config-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* Notification Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
/* Suggested Questions Styling */
.suggested-questions-container {
    margin-top: 20px;
    padding: 15px;
    background: var(--color-bg-secondary);
    border-radius: 2px;
    border: 1px solid var(--color-border);
}

.suggested-questions-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.suggested-questions-title i {
    color: var(--color-accent);
}

.suggested-questions-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggested-question-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    color: var(--color-text-primary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
}

.suggested-question-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: none;
}

.suggested-question-btn:active {
    transform: none;
}

.suggested-question-btn i {
    font-size: 1.1em;
    flex-shrink: 0;
}

.suggested-question-btn span {
    flex: 1;
    line-height: 1.4;
}

/* Responsive design for suggested questions */
@media (max-width: 768px) {
    .suggested-questions-container {
        padding: 12px;
    }
    
    .suggested-question-btn {
        padding: 10px 12px;
        font-size: 0.85em;
    }
}

/* Dark theme adjustments */
body.dark-theme .suggested-questions-container {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .suggested-question-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .suggested-question-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}