/* SalesIA Modern Design System - ChatGPT Style with FGF Branding */

:root {
    /* FGF Brand Colors */
    --fgf-primary: #7BC142;
    --fgf-primary-dark: #6BA237;
    --fgf-primary-light: #8FCC56;
    --fgf-primary-surface: rgba(123, 193, 66, 0.08);
    --fgf-primary-hover: rgba(123, 193, 66, 0.12);
    --fgf-white: #FFFFFF;
    --fgf-dark: #333333;
    /* Modern Neutral Palette (ChatGPT-inspired) */
    --surface-primary: #FFFFFF;
    --surface-secondary: #F9FAFB;
    --surface-tertiary: #F3F4F6;
    --surface-elevated: #FFFFFF;
    --surface-overlay: rgba(0, 0, 0, 0.5);
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;
    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;
    --border-strong: #9CA3AF;
    /* Semantic Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;
    /* Spacing Scale (8pt grid) */
    --space-0: 0;
    --space-1: 0.25rem; /* 4px */
    --space-2: 0.5rem; /* 8px */
    --space-3: 0.75rem; /* 12px */
    --space-4: 1rem; /* 16px */
    --space-5: 1.25rem; /* 20px */
    --space-6: 1.5rem; /* 24px */
    --space-8: 2rem; /* 32px */
    --space-10: 2.5rem; /* 40px */
    --space-12: 3rem; /* 48px */
    --space-16: 4rem; /* 64px */
    /* Border Radius */
    --radius-xs: 0.25rem; /* 4px */
    --radius-sm: 0.5rem; /* 8px */
    --radius-md: 0.75rem; /* 12px */
    --radius-lg: 1rem; /* 16px */
    --radius-xl: 1.25rem; /* 20px */
    --radius-2xl: 1.5rem; /* 24px */
    --radius-3xl: 2rem; /* 32px */
    --radius-full: 9999px;
    /* Typography Scale */
    --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', system-ui, sans-serif;
    --font-family-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    --text-xs: 0.75rem; /* 12px */
    --text-sm: 0.875rem; /* 14px */
    --text-base: 1rem; /* 16px */
    --text-lg: 1.125rem; /* 18px */
    --text-xl: 1.25rem; /* 20px */
    --text-2xl: 1.5rem; /* 24px */
    --text-3xl: 1.875rem; /* 30px */
    --text-4xl: 2.25rem; /* 36px */

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-loose: 1.75;
    /* Shadows (Material 3 inspired) */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    /* Layout Dimensions */
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 0px;
    --header-height: 0px;
    --mobile-breakpoint: 768px;
    /* Z-index Scale */
    --z-base: 0;
    --z-raised: 10;
    --z-overlay: 1000;
    --z-modal: 1100;
    --z-toast: 1200;
}

/* ===== BASE STYLES ===== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--text-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background-color: var(--surface-primary);
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* ===== CHATGPT-STYLE LAYOUT ===== */

.chatgpt-app {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* ===== FIXED SIDEBAR STATES ===== */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--surface-primary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(0);
    transition: all var(--transition-normal);
    z-index: var(--z-overlay);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

    /* FIXED: Proper sidebar states */
    .sidebar.open {
        transform: translateX(0);
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
    }

    .sidebar.closed {
        transform: translateX(-100%);
        width: 0;
        min-width: 0;
        box-shadow: none;
    }

.sidebar-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 68px;
    background: var(--surface-secondary);
    flex-shrink: 0;
}

.new-chat-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--fgf-primary);
    color: var(--fgf-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(123, 193, 66, 0.2);
    position: relative;
    overflow: hidden;
}

    .new-chat-button:hover {
        background: var(--fgf-primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(123, 193, 66, 0.3);
    }

    .new-chat-button:active {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(123, 193, 66, 0.2);
    }

    .new-chat-button svg {
        transition: transform var(--transition-fast);
    }

    .new-chat-button:hover svg {
        transform: rotate(90deg);
    }

/* ===== FIXED HIDE SIDEBAR BUTTON ===== */
.hide-sidebar-button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

    .hide-sidebar-button:hover {
        background: var(--surface-secondary);
        color: var(--text-primary);
        border-color: var(--border-medium);
        transform: scale(1.05);
    }

    .hide-sidebar-button:active {
        transform: scale(0.95);
    }

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

    .sidebar-content::-webkit-scrollbar {
        width: 4px;
    }

    .sidebar-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .sidebar-content::-webkit-scrollbar-thumb {
        background: var(--border-medium);
        border-radius: var(--radius-full);
    }

/* ===== ENHANCED NO CHATS MESSAGE ===== */
.no-chats-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
    text-align: center;
    opacity: 0.7;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    stroke-width: 1.5;
}

.no-chats-message p {
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    margin: 0 0 var(--space-2) 0;
}

.no-chats-message span {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin: 0;
}

/* Chat History Items */
.chat-history-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-1);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

    .chat-history-item:hover {
        background: var(--surface-secondary);
    }

    .chat-history-item.active {
        background: var(--fgf-primary-surface);
        border: 1px solid var(--fgf-primary-light);
    }

    .chat-history-item .icon {
        width: 16px;
        height: 16px;
        color: var(--text-secondary);
        flex-shrink: 0;
    }

    .chat-history-item .title {
        flex: 1;
        font-size: var(--text-sm);
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-history-item .actions {
        display: none;
        align-items: center;
        gap: var(--space-1);
    }

    .chat-history-item:hover .actions {
        display: flex;
    }

    .chat-history-item .action-button {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        background: transparent;
        border-radius: var(--radius-sm);
        cursor: pointer;
        color: var(--text-secondary);
        transition: all var(--transition-fast);
    }

        .chat-history-item .action-button:hover {
            background: var(--surface-tertiary);
            color: var(--text-primary);
        }

    .chat-history-item .delete-button:hover {
        background: rgba(239, 68, 68, 0.1);
        color: var(--error);
        transform: scale(1.1);
    }

    .chat-history-item .action-button[title="Rename"]:hover {
        background: rgba(59, 130, 246, 0.1);
        color: #3b82f6;
        transform: scale(1.1);
    }

/* Chat Search Styles */
.chat-search-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-primary);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--fgf-primary);
    box-shadow: 0 0 0 3px rgba(123, 193, 66, 0.1);
    background: var(--surface-primary);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.clear-search-button {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search-button:hover {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

.no-search-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.no-search-results .empty-state-icon {
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.no-search-results p {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

.no-search-results span {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Custom Modal Styles */
.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: 1000;
    backdrop-filter: blur(4px);
    animation: modalFadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--surface-primary);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
    border: 1px solid var(--border-light);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    background: var(--surface-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--fgf-primary);
    box-shadow: 0 0 0 3px rgba(123, 193, 66, 0.1);
}

.modal-input::placeholder {
    color: var(--text-tertiary);
}

.delete-warning {
    text-align: center;
    padding: 20px 0;
}

.delete-warning svg {
    color: var(--error);
    margin-bottom: 16px;
}

.delete-warning p {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
}

.delete-warning .warning-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
}

.modal-button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    min-width: 80px;
}

.modal-button.secondary {
    background: var(--surface-secondary);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.modal-button.secondary:hover {
    background: var(--surface-tertiary);
    border-color: var(--border-dark);
}

.modal-button.primary {
    background: var(--fgf-primary);
    color: white;
    border-color: var(--fgf-primary);
}

.modal-button.primary:hover:not(:disabled) {
    background: #5a9a3a;
    border-color: #5a9a3a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 193, 66, 0.3);
}

.modal-button.primary:disabled {
    background: var(--surface-tertiary);
    color: var(--text-tertiary);
    border-color: var(--border-light);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal-button.danger {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

.modal-button.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.delete-modal .modal-content {
    max-width: 450px;
}

/* Modal Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Beta Modal Specific Styles */
.beta-modal {
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
}

.beta-features-content {
    line-height: 1.7;
    font-size: 15px;
}

.beta-intro {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(123, 193, 66, 0.08), rgba(123, 193, 66, 0.03));
    border-radius: 12px;
    text-align: center;
}

.beta-intro p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.feature-section {
    margin-bottom: 24px;
}

.feature-section h4 {
    margin: 0 0 16px 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--fgf-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 2px solid rgba(123, 193, 66, 0.2);
}

.feature-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.feature-list li {
    margin-bottom: 12px;
    padding: 12px 16px;
    background: var(--surface-secondary);
    border-radius: 8px;
    border-left: 4px solid var(--fgf-primary);
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.feature-list li:hover {
    background: var(--surface-tertiary);
    transform: translateX(2px);
}

.feature-list li strong {
    color: var(--fgf-primary);
    font-weight: 600;
}

.beta-notice {
    margin-top: 24px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(123, 193, 66, 0.15), rgba(123, 193, 66, 0.08));
    border-radius: 10px;
}

.beta-notice p {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.5;
}

/* Agent Cards Styling */
.agents-intro {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-secondary);
    font-style: italic;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.agent-card {
    background: linear-gradient(135deg, var(--surface-primary), var(--surface-secondary));
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.agent-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--fgf-primary), #5a9c2a);
}

.agent-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--fgf-primary);
}

.agent-icon {
    font-size: 20px;
    margin-bottom: 6px;
    display: block;
    transition: transform 0.3s ease;
}

.agent-card h5 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--fgf-primary);
}


/* Minimal Border Style Variants */
.agent-card-variant1 {
    /* Variant 1: Original minimal border */
    background: var(--surface-primary);
    border: 2px solid var(--fgf-primary);
    box-shadow: none;
}

.agent-card-variant1::before {
    display: none;
}

.agent-card-variant1:hover {
    background: rgba(123, 193, 66, 0.05);
    transform: translateY(-2px);
}

.agent-card-variant1:hover .agent-icon {
    transform: scale(1.2);
}

.agent-card-variant2 {
    /* Variant 2: Dashed border */
    background: var(--surface-primary);
    border: 2px dashed var(--fgf-primary);
    box-shadow: none;
}

.agent-card-variant2::before {
    display: none;
}

.agent-card-variant2:hover {
    background: rgba(123, 193, 66, 0.05);
    border-style: solid;
    transform: translateY(-2px);
}

.agent-card-variant3 {
    /* Variant 3: Thicker border */
    background: var(--surface-primary);
    border: 3px solid var(--fgf-primary);
    box-shadow: none;
}

.agent-card-variant3::before {
    display: none;
}

.agent-card-variant3:hover {
    background: rgba(123, 193, 66, 0.08);
    border-color: #5a9c2a;
    transform: translateY(-2px);
}

.agent-card-variant4 {
    /* Variant 4: Rounded corners with border */
    background: var(--surface-primary);
    border: 2px solid var(--fgf-primary);
    border-radius: 15px;
    box-shadow: none;
}

.agent-card-variant4::before {
    display: none;
}

.agent-card-variant4:hover {
    background: rgba(123, 193, 66, 0.05);
    transform: translateY(-2px);
}

.agent-card-variant5 {
    /* Variant 5: Border with subtle shadow */
    background: var(--surface-primary);
    border: 2px solid var(--fgf-primary);
    box-shadow: 0 2px 8px rgba(123, 193, 66, 0.2);
}

.agent-card-variant5::before {
    display: none;
}

.agent-card-variant5:hover {
    background: rgba(123, 193, 66, 0.05);
    box-shadow: 0 4px 12px rgba(123, 193, 66, 0.3);
    transform: translateY(-2px);
}

.agent-card-variant6 {
    /* Variant 6: Double border effect */
    background: var(--surface-primary);
    border: 2px solid var(--fgf-primary);
    box-shadow: 0 0 0 1px rgba(123, 193, 66, 0.3);
}

.agent-card-variant6::before {
    display: none;
}

.agent-card-variant6:hover {
    background: rgba(123, 193, 66, 0.05);
    box-shadow: 0 0 0 2px rgba(123, 193, 66, 0.5);
    transform: translateY(-2px);
}

/* Responsive Modal */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-button {
        width: 100%;
    }
    
    .beta-features-content {
        font-size: 14px;
    }
    
    .feature-section h4 {
        font-size: 15px;
    }
    
    .agents-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .agent-card {
        padding: 8px;
    }
    
    .agent-icon {
        font-size: 18px;
    }
    
    .agent-card h5 {
        font-size: 11px;
    }
}

/* User Profile Section */
.sidebar-footer {
    padding: var(--space-4);
    background: var(--surface-primary);
    flex-shrink: 0;
    position: relative;
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

    .user-profile:hover {
        background: var(--surface-tertiary);
    }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--fgf-primary), var(--fgf-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fgf-white);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

    .user-avatar.guest {
        background: var(--surface-tertiary);
        color: var(--text-secondary);
        border: 2px solid var(--border-medium);
    }

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: var(--space-1);
}

/* User Menu */
.user-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-2);
    overflow: hidden;
    z-index: var(--z-raised);
}

.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

    .user-menu-item:hover {
        background: var(--surface-secondary);
        color: var(--error);
    }

    .user-menu-item svg {
        color: var(--text-secondary);
        transition: color var(--transition-fast);
    }

    .user-menu-item:hover svg {
        color: var(--error);
    }

/* ===== SIDEBAR OVERLAY REMOVED ===== */
/* Overlay removed for better compatibility and simpler UX */

/* ===== AUTHENTICATION SCREENS ===== */

.auth-loading-screen,
.auth-required-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #f8fffe 0%, #f0f9ff 50%, #f0fdf4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: var(--font-family);
}

.auth-loading-content,
.auth-required-content {
    text-align: center;
    max-width: 500px;
    padding: var(--space-8);
    background: var(--surface-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-light);
}

    .auth-loading-content h2,
    .auth-required-content h1 {
        font-size: var(--text-2xl);
        font-weight: var(--font-weight-bold);
        color: var(--fgf-primary);
        margin: var(--space-4) 0 var(--space-2) 0;
    }

    .auth-loading-content p,
    .auth-required-content p {
        font-size: var(--text-base);
        color: var(--text-secondary);
        margin-bottom: var(--space-6);
        line-height: var(--line-height-relaxed);
    }

.auth-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--fgf-primary), #5a9c2a);
    border-radius: 50%;
    color: var(--fgf-white);
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Typewriter effect */
.typewriter-container {
    display: inline-block;
    position: relative;
}

.typewriter-text {
    display: inline;
}

.typewriter-cursor {
    animation: blink 1s infinite;
    color: var(--fgf-primary);
    font-weight: bold;
    margin-left: 2px;
}

/* Typewriter markdown - professional formatting with proper padding */
.typewriter-markdown-container {
    display: block;
    position: relative;
    padding: 20px 24px; /* Generous padding for readability */
    line-height: 1.6; /* Good line height for readability */
    font-size: 16px;
    margin: 0; /* No margins */
    word-spacing: normal; /* Normal word spacing */
    letter-spacing: normal; /* Normal letter spacing */
    text-align: left; /* Ensure left alignment */
    width: 100%; /* Take full width of bubble */
    word-wrap: break-word; /* Smart word wrapping */
    overflow-wrap: break-word; /* Modern word wrapping */
    hyphens: auto; /* Smart hyphenation for long words */
    box-sizing: border-box; /* Include padding in width calculation */
    white-space: normal; /* Allow normal text wrapping */
    max-width: none; /* Remove any width constraints */
    min-width: 0; /* Allow shrinking */
    flex-shrink: 1; /* Allow flex shrinking */
}

.markdown-inline-text {
    display: inline;
    margin: 0;
    padding: 0;
    line-height: 1.5; /* Consistent line height */
    white-space: normal; /* Ensure normal text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Force better text flow for AI messages - WITH TIGHTER TYPOGRAPHY */
.message-bubble.assistant .typewriter-markdown-container,
.message-bubble.assistant .markdown-content,
.message-bubble.assistant .enhanced-markdown-content,
.message-bubble.assistant .smart-markdown-content {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
    width: 100% !important;
    display: block !important;
    padding: 0 !important; /* Remove padding since bubble now has it */
    margin: 0 !important;
    box-sizing: border-box !important;
    font-size: 14px !important; /* Smaller, tighter text */
    line-height: 1.5 !important; /* Tighter line height */
    color: #374151 !important; /* Softer text color, less harsh */
}

/* Ensure text flows naturally without forced line breaks */
.message-bubble.assistant p,
.message-bubble.assistant span,
.message-bubble.assistant div {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.textarea-container:focus-within {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* ===== MAIN CONTENT AREA ===== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--surface-primary);
    position: relative;
    overflow: hidden;
    min-width: 0; /* FIXED: Allow content to shrink */
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
}

    /* Single continuous line at the bottom */
    .main-content::after {
        content: '';
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: var(--border-medium);
        z-index: 1000;
    }

    .main-content.sidebar-closed {
        margin-left: 0;
    }

/* ===== FIXED SIDEBAR TOGGLE BUTTON ===== */
.sidebar-toggle-button {
    position: fixed;
    top: var(--space-4);
    left: var(--space-4);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    cursor: pointer;
    z-index: calc(var(--z-overlay) + 1);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--fgf-primary);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8);
}

    .sidebar-toggle-button.show {
        opacity: 1;
        visibility: visible;
        transform: scale(1);
    }

    .sidebar-toggle-button:hover {
        background: var(--surface-secondary);
        box-shadow: var(--shadow-xl);
        transform: translateY(-2px);
        border-color: var(--fgf-primary-light);
    }

    .sidebar-toggle-button:active {
        transform: translateY(0);
        box-shadow: var(--shadow-lg);
    }

/* ===== BETA VERSION TAG ===== */
.beta-version-tag {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--fgf-primary), #5a9c2a);
    color: white;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 1;
    visibility: visible;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    border: 1px solid #5a9c2a;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: calc(var(--z-overlay) + 1);
    overflow: hidden;
}

    .beta-version-tag::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
        transition: left 0.5s ease;
    }

    .beta-version-tag:hover {
        transform: translateX(-50%) translateY(-2px) scale(1.05);
        box-shadow: var(--shadow-xl);
        background: linear-gradient(135deg, #5a9c2a, var(--fgf-primary));
        border-color: var(--fgf-primary);
    }

    .beta-version-tag:hover::before {
        left: 100%;
    }

/* ===== CHAT CONTAINER ===== */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    min-width: 0; /* FIXED: Allow container to shrink */
    position: relative;
    background: linear-gradient(135deg, rgba(123, 193, 66, 0.02) 0%, rgba(123, 193, 66, 0.01) 50%, transparent 100%);
}

/* Professional Subtle Neural Network */
.chat-container {
    position: relative;
    overflow: hidden;
}

/* Interactive Neural Network Canvas */
.chat-container {
    position: relative;
    overflow: hidden;
}

#neural-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* AI Typing State - Enhanced Neural Activity */
.chat-container.ai-typing #neural-canvas {
    opacity: 0.9;
}

/* Header Neural Network Canvas */
#header-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

.welcome-header {
    position: relative;
    overflow: hidden;
}

/* ===== AI ARTIFACT (Welcome Screen) ===== */

/* ===== ABSTRACT HEADER DESIGN ===== */

.abstract-header {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin-bottom: var(--space-6);
    padding: var(--space-8) var(--space-6);
    background: linear-gradient(135deg, rgba(123, 193, 66, 0.05) 0%, rgba(123, 193, 66, 0.02) 100%);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(123, 193, 66, 0.1);
    overflow: hidden;
}

.abstract-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--fgf-primary), #5a9c2a);
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 60px;
    height: 60px;
    top: 60%;
    right: 15%;
    animation-delay: 1.5s;
}

.shape-3 {
    width: 40px;
    height: 40px;
    top: 30%;
    right: 25%;
    animation-delay: 3s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4.5s;
}

.shape-5 {
    width: 50px;
    height: 50px;
    top: 10%;
    right: 40%;
    animation-delay: 2s;
}

.neural-connections {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.connection {
    position: absolute;
    background: linear-gradient(90deg, transparent, var(--fgf-primary), transparent);
    opacity: 0.1;
    animation: pulse 4s ease-in-out infinite;
}

.connection-1 {
    width: 200px;
    height: 2px;
    top: 30%;
    left: 20%;
    transform: rotate(15deg);
    animation-delay: 0s;
}

.connection-2 {
    width: 150px;
    height: 2px;
    top: 60%;
    right: 25%;
    transform: rotate(-20deg);
    animation-delay: 1s;
}

.connection-3 {
    width: 180px;
    height: 2px;
    bottom: 30%;
    left: 30%;
    transform: rotate(45deg);
    animation-delay: 2s;
}

.connection-4 {
    width: 120px;
    height: 2px;
    top: 45%;
    right: 35%;
    transform: rotate(-35deg);
    animation-delay: 3s;
}

.header-content {
    position: relative;
    z-index: 2;
}

.logo-container {
    margin-bottom: var(--space-4);
}
.logo-image {
width:80px;
}
.logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 85px;
    height: 85px;
    background: linear-gradient(135deg, var(--fgf-primary), #5a9c2a);
    border-radius: 50%;
    color: var(--fgf-white);
    box-shadow: 0 8px 32px rgba(123, 193, 66, 0.3);
    animation: logoGlow 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.1;
        transform: scaleX(1);
    }

    50% {
        opacity: 0.2;
        transform: scaleX(1.1);
    }
}

@keyframes logoGlow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(123, 193, 66, 0.3);
    }

    50% {
        box-shadow: 0 12px 40px rgba(123, 193, 66, 0.5);
    }
}

@keyframes organicPulse {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.02);
    }
}

@keyframes flowingData {
    0% {
        background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%, 0% 0%;
    }

    25% {
        background-position: 25% 0%, 25% 0%, 25% 0%, 25% 0%, 0% 25%, 0% 25%, 0% 25%, 0% 25%, 25% 0%, 0% 75%, 75% 0%, 25% 100%, 100% 25%, 25% 0%, 50% 0%, 75% 0%, 0% 35%, 0% 55%, 0% 75%;
    }

    50% {
        background-position: 50% 0%, 50% 0%, 50% 0%, 50% 0%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 0% 50%, 50% 0%, 0% 50%, 50% 0%, 50% 50%, 50% 50%, 50% 0%, 50% 0%, 50% 0%, 0% 50%, 0% 50%, 0% 50%;
    }

    75% {
        background-position: 75% 0%, 75% 0%, 75% 0%, 75% 0%, 0% 75%, 0% 75%, 0% 75%, 0% 75%, 0% 75%, 75% 0%, 0% 25%, 25% 0%, 75% 0%, 0% 75%, 75% 0%, 50% 0%, 25% 0%, 0% 65%, 0% 45%, 0% 25%;
    }

    100% {
        background-position: 100% 0%, 100% 0%, 100% 0%, 100% 0%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 0% 100%, 100% 0%, 0% 0%, 0% 0%, 100% 0%, 0% 100%, 100% 0%, 50% 0%, 0% 0%, 0% 100%, 0% 100%, 0% 100%;
    }
}

@keyframes neuralPulse {
    0%, 100% {
        filter: brightness(1) contrast(1);
    }

    50% {
        filter: brightness(1.2) contrast(1.1);
    }
}


.ai-artifact {
    position: relative;
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-logo {
    width: 120px;
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 8px 16px rgba(123, 193, 66, 0.2));
}

/* Animated Sparks */
.ai-spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--fgf-primary);
    border-radius: var(--radius-full);
    opacity: 0;
    animation: sparkle 3s infinite;
}

.spark-1 {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.spark-2 {
    top: 30%;
    right: 15%;
    animation-delay: 1s;
}

.spark-3 {
    bottom: 25%;
    left: 15%;
    animation-delay: 2s;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Chat Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 50px !important; /* Increased left and right padding to 50px */
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: var(--space-3); /* Reduced gap between messages */
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
    position: relative;
    z-index: 1;
}

    .messages-container::-webkit-scrollbar {
        width: 6px;
    }

    .messages-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .messages-container::-webkit-scrollbar-thumb {
        background: var(--border-medium);
        border-radius: var(--radius-full);
    }

        .messages-container::-webkit-scrollbar-thumb:hover {
            background: var(--border-strong);
        }

/* ===== FIXED MESSAGE BUBBLES ===== */

.message-group {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3); /* Keep avatar gap comfortable */
    max-width: 100%;
    animation: fadeInUp 0.3s ease-out;
    margin-bottom: var(--space-1); /* Reduced from space-2 - more compact message spacing */
}

    .message-group.user {
        flex-direction: row-reverse;
        justify-content: flex-start; /* Ensure proper alignment */
    }

        .message-group.user .message-content {
            display: flex;
            flex-direction: column;
            align-items: flex-end; /* Align user content to the right */
        }

.message-avatar {
        width: 40px;
        height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    position: relative;
}

    .message-avatar.user {
        background: linear-gradient(135deg, var(--fgf-primary), var(--fgf-primary-light));
        color: var(--fgf-white);
    }

    .message-avatar.assistant {
        background: var(--surface-elevated);
        border: 2px solid var(--border-light);
        color: var(--fgf-primary);
    }

.ai-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

    .ai-avatar.typing {
        animation: pulse 2s infinite;
    }

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Professional typing effect - subtle and clean */
.message-bubble.typing {
    animation: typingPulse 2s ease-in-out infinite; /* Slower, more professional */
    opacity: 1;
    border: 1px solid #e5e7eb; /* Subtle border */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Professional shadow */
    background: rgba(255, 255, 255, 0.98); /* Clean white background */
}

@keyframes typingPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        border-color: #e5e7eb;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    50% {
        opacity: 0.95;
        transform: scale(1.02); /* Very subtle scale */
        border-color: #d1d5db; /* Slightly darker border */
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15); /* Slightly stronger shadow */
    }
}

/* Typing dots animation */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.typing-dot {
    width: 6px; /* Professional size */
    height: 6px;
    border-radius: 50%;
    background: #6b7280; /* Professional gray color */
    animation: typingBounce 1.4s infinite ease-in-out; /* Professional timing */
    opacity: 0.7; /* Subtle transparency */
}

    .typing-dot:nth-child(1) {
        animation-delay: -0.32s;
    }

    .typing-dot:nth-child(2) {
        animation-delay: -0.16s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: 0s;
    }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(1);
        opacity: 0.4; /* Subtle transparency */
    }

    40% {
        transform: scale(1.2); /* Subtle bounce */
        opacity: 0.8; /* Slightly more visible */
    }
}

.message-content {
    flex: 1;
    max-width: calc(100% - 56px);
    min-width: 0;
    position: relative;
}

/* Professional message bubble styling */
.message-bubble {
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
    max-width: 90%; /* Increased for better text flow */
    min-width: 280px; /* Increased minimum width to prevent cramping */
    width: auto; /* Auto width based on content */
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    overflow: hidden;
    z-index: 1;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: slideInMessage 0.3s ease-out;
    display: block; /* Block display for proper text flow */
    white-space: normal; /* Allow normal text wrapping */
    text-align: left; /* Ensure left alignment */
}

    .message-bubble:hover {
        box-shadow: var(--shadow-md);
    }

    .message-bubble.user {
        background: linear-gradient(135deg, var(--fgf-primary), var(--fgf-primary-dark));
        color: var(--fgf-white);
        margin-left: auto; /* Align to right */
        margin-right: 0;
        border-bottom-right-radius: var(--radius-md);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: 0 4px 12px rgba(123, 193, 66, 0.3);
        align-self: flex-end; /* Ensure right alignment */
    }

    .message-bubble.assistant {
        background: rgba(255, 255, 255, 0.98) !important; /* Professional white background */
        background-color: rgba(255, 255, 255, 0.98) !important; /* Professional white background */
        color: #1f2937 !important; /* Professional dark text color */
        border: 1px solid #e5e7eb !important; /* Subtle professional border */
        margin-left: 0;
        margin-right: auto; /* Align to left */
        border-bottom-left-radius: var(--radius-md);
        backdrop-filter: blur(2px) !important; /* Subtle blur for professional look */
        -webkit-backdrop-filter: blur(2px) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1) !important; /* Professional layered shadow */
        padding: 14px !important; /* Reduced from 18px - more compact */
        font-weight: 400; /* Normal font weight */
        opacity: 1 !important; /* Force full opacity */
        filter: none !important; /* Remove any filters that might add transparency */
        mix-blend-mode: normal !important; /* Ensure normal blending */
        align-self: flex-start; /* Ensure left alignment */
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; /* Professional font stack */
        width: fit-content; /* Let content determine width */
        min-width: 280px; /* Increased minimum width for better readability */
        max-width: 90%; /* Allow more width */
        overflow: hidden; /* Ensure content doesn't overflow */
        font-size: 14px; /* Even smaller, less overwhelming */
        line-height: 1.5; /* Tighter line height */
    }

.message-text {
    padding: var(--space-3) var(--space-4); /* Proper padding for readability */
    font-size: 16px; /* Slightly larger font for better readability */
    line-height: 1.6; /* Good line height for readability */
    white-space: normal; /* Changed from pre-wrap to normal for better text flow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    font-weight: inherit; /* Inherit from parent bubble */
    letter-spacing: 0.01em; /* Slightly reduced letter spacing */
    display: block; /* Changed from inline-block to block for better text flow */
    text-rendering: optimizeLegibility; /* Better text rendering */
    -webkit-font-smoothing: antialiased; /* Smoother text on webkit */
}

/* ===== MARKDOWN STYLING ===== */
.markdown-content {
    line-height: 1.7;
    color: inherit;
    white-space: normal; /* Ensure normal text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: none; /* Remove width constraints */
}

/* Paragraphs with tighter spacing */
.markdown-paragraph {
    margin: 0 0 10px 0; /* Reduced from 14px to 10px - more compact */
    line-height: 1.5; /* Tighter line height */
    white-space: normal; /* Ensure normal text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 400; /* Ensure normal weight */
    color: #374151; /* Softer text color */
}

.markdown-paragraph:last-child {
    margin-bottom: 0; /* Remove bottom margin from last paragraph */
}

/* Lists with tighter spacing */
.markdown-list-item {
    margin: 0 0 4px 0; /* Reduced from 6px to 4px - tighter spacing */
    padding-left: var(--space-3); /* Comfortable indentation */
    position: relative;
    font-weight: 400; /* Normal weight */
    color: #374151; /* Softer color */
    line-height: 1.4; /* Tighter line height */
}

    .markdown-list-item::before {
        content: "•";
        color: var(--fgf-primary);
        font-weight: 500; /* Less bold bullet */
        position: absolute;
        left: 0;
    }

/* ===== MESSAGE ACTIONS ===== */
.message-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.message-group:hover .message-actions {
    opacity: 1;
}

.message-action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

    .message-action-button:hover {
        background: var(--surface-secondary);
        color: var(--text-primary);
        border-color: var(--border-medium);
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
    }

    .message-action-button:active {
        transform: translateY(0);
    }

    /* Enhanced animations for specific buttons */
    .message-action-button.copied {
        animation: copiedAnimation 0.6s ease-out;
    }

    .message-action-button.liked {
        animation: likedAnimation 0.6s ease-out;
    }

    .message-action-button.disliked {
        animation: dislikedAnimation 0.6s ease-out;
    }

    /* Copy button specific animations */
    .message-action-button[title="Copy message"]:hover {
        transform: translateY(-2px) scale(1.05);
        background: var(--fgf-primary);
        color: white;
        box-shadow: 0 4px 12px rgba(123, 193, 66, 0.3);
    }

    /* Like button specific animations */
    .message-action-button[title="Good response"]:hover {
        transform: translateY(-2px) scale(1.1);
        background: #10b981;
        color: white;
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }

    /* Dislike button specific animations */
    .message-action-button[title="Bad response"]:hover {
        transform: translateY(-2px) scale(1.1);
        background: #ef4444;
        color: white;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }

    /* Active feedback states */
    .message-action-button.liked-active {
        background: #10b981 !important;
        color: white !important;
        border-color: #10b981 !important;
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    }

    .message-action-button.liked-active:hover {
        background: #059669 !important;
        border-color: #059669 !important;
        transform: translateY(-1px) scale(1.05);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    }

    .message-action-button.disliked-active {
        background: #ef4444 !important;
        color: white !important;
        border-color: #ef4444 !important;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }

    .message-action-button.disliked-active:hover {
        background: #dc2626 !important;
        border-color: #dc2626 !important;
        transform: translateY(-1px) scale(1.05);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }

    /* Keyframe animations */
    @keyframes copiedAnimation {
        0% {
            transform: scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
        25% {
            transform: scale(1.2);
            background: #10b981;
            color: white;
        }
        50% {
            transform: scale(1.1);
            background: #10b981;
            color: white;
        }
        75% {
            transform: scale(1.05);
            background: #10b981;
            color: white;
        }
        100% {
            transform: scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
    }

    @keyframes likedAnimation {
        0% {
            transform: scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
        25% {
            transform: scale(1.3);
            background: #10b981;
            color: white;
        }
        50% {
            transform: scale(1.2);
            background: #10b981;
            color: white;
        }
        75% {
            transform: scale(1.1);
            background: #10b981;
            color: white;
        }
        100% {
            transform: scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
    }

    @keyframes dislikedAnimation {
        0% {
            transform: translateX(0) scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
        10% {
            transform: translateX(-3px) scale(1.1);
            background: #ef4444;
            color: white;
        }
        20% {
            transform: translateX(3px) scale(1.1);
            background: #ef4444;
            color: white;
        }
        30% {
            transform: translateX(-3px) scale(1.1);
            background: #ef4444;
            color: white;
        }
        40% {
            transform: translateX(3px) scale(1.1);
            background: #ef4444;
            color: white;
        }
        50% {
            transform: translateX(0) scale(1.2);
            background: #ef4444;
            color: white;
        }
        75% {
            transform: scale(1.05);
            background: #ef4444;
            color: white;
        }
        100% {
            transform: scale(1);
            background: var(--surface-elevated);
            color: var(--text-secondary);
        }
    }

/* ===== MESSAGE TIMESTAMP ===== */
.message-timestamp {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-family: var(--font-family-mono);
}

.message-group:hover .message-timestamp {
    opacity: 1;
}

.message-group.user .message-timestamp {
    text-align: right;
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    animation: fadeInUp 0.3s ease-out;
}

.typing-content {
    flex: 1;
}

.typing-bubble {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: rgba(255, 255, 255, 0.98); /* Clean white background */
    border: 1px solid #e5e7eb; /* Subtle border */
    border-radius: var(--radius-2xl);
    border-bottom-left-radius: var(--radius-md);
    margin-right: var(--space-8);
    font-size: var(--text-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Professional shadow */
    color: #1f2937; /* Clean dark text */
    font-weight: 400; /* Normal weight */
    max-width: fit-content; /* Don't take full width */
    width: fit-content; /* Fit content width */
}

.typing-dots {
    display: flex;
    gap: var(--space-1);
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--fgf-primary);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

    .typing-dot:nth-child(1) {
        animation-delay: -0.32s;
    }

    .typing-dot:nth-child(2) {
        animation-delay: -0.16s;
    }

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== UNIFIED INPUT STYLING FOR BOTH WELCOME AND CHAT MODES ===== */

/* Shared input wrapper styles */
.message-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-elevated);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-3xl);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
    width: 100%;
}

.message-input-wrapper:focus-within {
    border-color: var(--fgf-primary);
    box-shadow: 0 0 0 4px var(--fgf-primary-surface), var(--shadow-lg);
}

/* Shared textarea container */
.textarea-container {
    flex: 1;
    position: relative;
    min-width: 0;
    width: 100%;
    border: none !important;
    background: transparent;
}

/* Shared message input styles */
.message-input {
    width: 100%;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    font-family: var(--font-family-primary);
    font-size: var(--text-base);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    resize: none;
    max-height: 200px;
    min-height: 24px;
    padding: var(--space-2) 0;
    overflow-y: auto;
    scrollbar-width: none;
    transition: height var(--transition-fast);
}

.message-input::-webkit-scrollbar {
    display: none;
}

.message-input::placeholder {
    color: var(--text-tertiary);
    font-weight: var(--font-weight-normal);
}

.message-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.message-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Shared button styles */
.attachment-button,
.send-button {
    flex-shrink: 0;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-button {
    width: 40px;
    height: 40px;
    background: transparent;
    color: var(--text-secondary);
}

.attachment-button:hover:not(:disabled) {
    background: var(--surface-secondary);
    color: var(--text-primary);
    transform: scale(1.05);
}

.attachment-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-button {
    width: 40px;
    height: 40px;
    background: var(--fgf-primary);
    color: var(--fgf-white);
    box-shadow: var(--shadow-sm);
}

.send-button:hover:not(:disabled) {
    background: var(--fgf-primary-dark);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.send-button:active {
    transform: scale(1);
}

.send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: var(--surface-tertiary);
    color: var(--text-tertiary);
    box-shadow: none;
}

/* Shared character counter */
.character-counter {
    position: absolute;
    bottom: -28px;
    right: 0;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family-mono);
    padding: var(--space-1) var(--space-2);
    background: var(--surface-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.character-counter.limit-reached {
    color: var(--error);
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

/* ===== CHATGPT WELCOME SCREEN LAYOUT ===== */

/* ChatGPT-style welcome container that centers content vertically and horizontally */
.chatgpt-welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    padding: var(--space-8) var(--space-4);
    position: relative;
    z-index: 1;
}

.chatgpt-welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: var(--space-8);
    max-width: 600px;
}

/* ChatGPT-style centered input area - inherits shared styles */
.chatgpt-centered-input {
    width: 100%;
    max-width: 768px;
    position: relative;
}

.chatgpt-centered-input .input-container {
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Remove redundant styles - using shared classes above */

/* Responsive adjustments for centered input */
@media (max-width: 768px) {
    .chatgpt-welcome-container {
        padding: var(--space-6) var(--space-3);
        justify-content: flex-start;
        padding-top: 25vh; /* Center content vertically on mobile */
    }
    
    .chatgpt-welcome-content {
        margin-bottom: var(--space-6);
    }
    
    .message-input-wrapper {
        gap: var(--space-2);
        padding: var(--space-2);
    }
    
    .attachment-button,
    .send-button {
        width: 36px;
        height: 36px;
    }
    
    .character-counter {
        bottom: -24px;
        font-size: 10px;
    }
    
    /* Reduce messages-container padding on mobile for better space utilization */
    .messages-container {
        padding: var(--space-4) var(--space-4) var(--space-3) var(--space-4); /* 16px on mobile instead of 50px */
    }
}

/* ===== FIXED FULL-WIDTH INPUT AREA FOR CHAT MODE ===== */

.input-area {
    background: var(--surface-primary);
    padding: var(--space-4);
    flex-shrink: 0;
    width: 100%;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: auto;
}

.input-container {
    max-width: 768px;
    margin: 0 auto;
    position: relative;
    width: 100%;
}

/* Chat mode uses the same shared input styles defined above */

@media (max-width: 768px) {
    .input-area {
        padding: var(--space-3);
    }
}

/* ===== ENHANCED FGF-BRANDED TABLE STYLING FOR AI MESSAGE BUBBLES ===== */

/* Table wrapper with FGF styling */
.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(123, 193, 66, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    background: white;
    border: 2px solid rgba(123, 193, 66, 0.15); /* Enhanced border with FGF color */
    position: relative;
    transition: all var(--transition-normal);
}

.table-wrapper:hover {
    box-shadow: 0 12px 32px rgba(123, 193, 66, 0.16), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: rgba(123, 193, 66, 0.25); /* Enhanced border on hover */
}

/* Enhanced table with FGF branding and complete borders */
.enhanced-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    font-size: 0.95rem;
    font-family: var(--font-family-primary);
    margin: 0;
    table-layout: auto;
    min-width: 500px; /* Ensure tables don't get too cramped */
    border: 1px solid var(--border-light); /* Add outer border */
}

/* FGF-styled table headers with borders */
.enhanced-table th {
    background: linear-gradient(135deg, var(--fgf-primary) 0%, var(--fgf-primary-dark) 100%);
    color: var(--fgf-white);
    font-weight: 600;
    padding: 18px 20px;
    text-align: left;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.2); /* Add subtle vertical borders to headers */
    font-size: 0.9rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    position: relative;
    transition: all var(--transition-fast);
}

.enhanced-table th:first-child {
    border-top-left-radius: 16px;
}

.enhanced-table th:last-child {
    border-top-right-radius: 16px;
    border-right: none; /* Remove right border from last header column */
}

.enhanced-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

/* Enhanced table cells with borders */
.enhanced-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light); /* Add vertical borders */
    vertical-align: top;
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 0.95rem;
    position: relative;
    transition: all var(--transition-fast);
}

/* Remove borders from last row and column */
.enhanced-table tr:last-child td {
    border-bottom: none;
}

.enhanced-table td:last-child {
    border-right: none; /* Remove right border from last column */
}

.enhanced-table tr:last-child td:first-child {
    border-bottom-left-radius: 16px;
}

.enhanced-table tr:last-child td:last-child {
    border-bottom-right-radius: 16px;
}

/* Alternating row colors with FGF touch */
.enhanced-table tr:nth-child(even) {
    background-color: rgba(123, 193, 66, 0.02);
}

/* Professional hover effect */
.enhanced-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(123, 193, 66, 0.06) 0%, rgba(123, 193, 66, 0.03) 100%);
    transform: translateX(2px);
    box-shadow: -4px 0 12px rgba(123, 193, 66, 0.1);
}

.enhanced-table tbody tr:hover td {
    color: var(--fgf-dark);
}

/* ===== ENHANCED CELL TYPE STYLING ===== */

/* Numeric cells - right aligned with monospace */
.cell-numeric {
    text-align: right;
    font-family: var(--font-family-mono);
    font-weight: 500;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03) 0%, rgba(59, 130, 246, 0.01) 100%);
}

/* Price cells - prominent styling */
.cell-price {
    text-align: right;
    font-family: var(--font-family-mono);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(34, 197, 94, 0.02) 100%);
    color: var(--success);
}

/* Contact info cells */
.cell-contact {
    font-family: var(--font-family-mono);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    color: var(--info);
}

/* Date cells */
.cell-date {
    font-family: var(--font-family-mono);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.05) 0%, rgba(168, 85, 247, 0.02) 100%);
    color: #7c3aed;
}

/* ID/Reference cells */
.cell-id {
    font-family: var(--font-family-mono);
    font-weight: 500;
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.05) 0%, rgba(107, 114, 128, 0.02) 100%);
    color: var(--text-secondary);
}

/* Status cells */
.cell-status {
    text-align: center;
    font-weight: 500;
}

/* Quantity cells */
.cell-quantity {
    text-align: right;
    font-family: var(--font-family-mono);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.02) 100%);
    color: var(--warning);
}

/* ===== CONTENT HIGHLIGHTING IN TABLE CELLS ===== */

/* Price highlighting - REMOVED - Keep plain text */
.price-highlight {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 600;
    /* No background, no colors, no padding */
}

/* Number highlighting - REMOVED - Keep plain text */
.highlight-number {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 500;
    text-align: right;
    /* No background, no colors, no padding */
}

/* Percentage highlighting - REMOVED - Keep plain text */
.highlight-percentage {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 500;
    /* No background, no colors, no padding */
}

/* Date highlighting - REMOVED - Keep plain text */
.highlight-date {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 400;
    /* No background, no colors, no padding */
}

/* Contact highlighting - REMOVED - Keep plain text */
.contact-highlight {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 400;
    /* No background, no colors, no padding */
}

/* ID highlighting - REMOVED - Keep plain text */
.highlight-id {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 400;
    /* No background, no colors, no padding */
}

/* Quantity highlighting - REMOVED - Keep plain text */
.highlight-quantity {
    /* Remove all styling - just display as normal text */
    font-family: var(--font-family-mono);
    font-weight: 400;
    /* No background, no colors, no padding */
}

/* ===== STATUS BADGES WITH FGF STYLING ===== */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    text-align: center;
    min-width: 80px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Success status */
.status-success {
    background: linear-gradient(135deg, var(--fgf-primary), var(--fgf-primary-dark));
    color: white;
    border-color: var(--fgf-primary-light);
}

/* Warning status */
.status-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border-color: #fbbf24;
}

/* Error status */
.status-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-color: #f87171;
}

/* Muted status */
.status-muted {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    border-color: #9ca3af;
}

/* Info status */
.status-info {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border-color: #60a5fa;
}

/* ===== TABLE ALIGNMENT CLASSES ===== */

.cell-left {
    text-align: left;
}

.cell-center {
    text-align: center;
}

.cell-right {
    text-align: right;
}

/* ===== ENHANCED MARKDOWN INTEGRATION FOR AI MESSAGE BUBBLES ===== */

/* Ensure markdown content in message bubbles uses proper table styling */
.message-bubble.assistant .enhanced-markdown-content,
.message-bubble.assistant .smart-markdown-content {
    padding: 0 !important; /* Let the table wrapper handle padding */
    width: 100%;
    max-width: none;
    overflow: visible;
}

/* Make sure tables in AI bubbles are properly contained with tighter spacing */
.message-bubble.assistant .table-wrapper {
    margin: 12px -14px; /* Reduced margin to match new bubble padding */
    max-width: calc(100% + 28px); /* Account for smaller bubble padding */
    overflow-x: auto;
}

.message-bubble.assistant .enhanced-table {
    min-width: 450px; /* Ensure readability in message bubbles */
    max-width: 100%;
    font-size: 13px; /* Even smaller table text - more compact */
}

/* Adjust table styling specifically for message bubble context with tighter spacing */
.message-bubble.assistant .enhanced-table th {
    font-size: 0.75rem; /* Smaller header text */
    padding: 10px 12px; /* Tighter padding */
    font-weight: 500; /* Less bold headers */
    letter-spacing: 0.02em; /* Reduced letter spacing */
    text-transform: capitalize; /* Less aggressive than uppercase */
}

.message-bubble.assistant .enhanced-table td {
    font-size: 0.8rem; /* Smaller cell text */
    padding: 8px 12px; /* Tighter cell padding */
    font-weight: 400; /* Normal weight for readability */
    color: #4b5563; /* Softer text color */
}

/* ===== MOBILE RESPONSIVE TABLE DESIGN ===== */

@media (max-width: 768px) {
    .table-wrapper {
        margin: 16px 0;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(123, 193, 66, 0.1);
    }
    
    .enhanced-table {
        min-width: 400px; /* Ensure readability on mobile */
        font-size: 0.85rem;
    }
    
    .enhanced-table th,
    .enhanced-table td {
        padding: 12px 16px;
    }
    
    .enhanced-table th {
        font-size: 0.8rem;
    }
    
    /* Maintain borders on mobile */
    .enhanced-table th {
        border-right: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .enhanced-table td {
        border-right: 1px solid var(--border-light);
    }
    
    /* Remove right border from last columns on mobile */
    .enhanced-table th:last-child,
    .enhanced-table td:last-child {
        border-right: none;
    }
    
    /* Status badges smaller on mobile */
    .status-badge {
        padding: 3px 8px;
        font-size: 0.75rem;
        min-width: 60px;
    }
    
    /* Highlights smaller on mobile - REMOVED - Keep as normal text */
    .price-highlight,
    .highlight-number,
    .highlight-percentage,
    .highlight-date,
    .contact-highlight,
    .highlight-id,
    .highlight-quantity {
        /* Remove all color highlighting on mobile */
        font-family: var(--font-family-mono);
        font-weight: 400;
        font-size: inherit;
        padding: 0;
        background: none;
        color: inherit;
        box-shadow: none;
        display: inline;
        border-radius: 0;
    }
}

/* Responsive adjustments for message bubble tables */
@media (max-width: 768px) {
    .message-bubble.assistant .enhanced-table {
        min-width: 350px;
        font-size: 0.8rem;
    }
    
    .message-bubble.assistant .enhanced-table th,
    .message-bubble.assistant .enhanced-table td {
        padding: 10px 12px;
    }
    
    /* Maintain borders on mobile */
    .message-bubble.assistant .enhanced-table th {
        border-right: 1px solid rgba(255, 255, 255, 0.15);
    }
    
    .message-bubble.assistant .enhanced-table td {
        border-right: 1px solid var(--border-light);
    }
    
    /* Remove right border from last columns on mobile */
    .message-bubble.assistant .enhanced-table th:last-child,
    .message-bubble.assistant .enhanced-table td:last-child {
        border-right: none;
    }
    
    .message-bubble.assistant .status-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
        min-width: 50px;
    }
}

/* ===== ENHANCED TABLE ACCESSIBILITY ===== */

.enhanced-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.enhanced-table caption {
    caption-side: top;
    padding: 12px;
    font-weight: 600;
    color: var(--fgf-primary);
    text-align: left;
    font-size: 1.1rem;
}

/* Focus styles for accessibility */
.enhanced-table tbody tr:focus {
    outline: 2px solid var(--fgf-primary);
    outline-offset: -2px;
}

/* ===== TABLE LOADING STATE ===== */

.table-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(123, 193, 66, 0.1), transparent);
    animation: tableShimmer 1.5s infinite;
}

@keyframes tableShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== TABLE COPY FUNCTIONALITY ===== */

.table-copy-btn {
    background: rgba(123, 193, 66, 0.1);
    border: 1px solid rgba(123, 193, 66, 0.2);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.8rem;
    color: var(--fgf-primary);
    font-weight: 500;
}

.table-copy-btn:hover {
    background: rgba(123, 193, 66, 0.2);
    border-color: var(--fgf-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(123, 193, 66, 0.2);
}

.table-copy-btn:active {
    transform: scale(0.95);
}

/* ===== DARK MODE TABLE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    .table-wrapper {
        background: #1e293b;
        border-color: #334155;
    }
    
    .enhanced-table {
        background: #1e293b;
        color: #e2e8f0;
    }
    
    .enhanced-table th {
        background: linear-gradient(135deg, var(--fgf-primary-dark), #5a9c2a);
    }
    
    .enhanced-table td {
        border-bottom-color: #334155;
        border-right-color: #334155;
        color: #e2e8f0;
    }
    
    .enhanced-table tbody tr:nth-child(even) {
        background-color: rgba(123, 193, 66, 0.05);
    }
    
    .enhanced-table tbody tr:hover {
        background: linear-gradient(135deg, rgba(123, 193, 66, 0.1) 0%, rgba(123, 193, 66, 0.05) 100%);
    }
    
    /* Dark mode cell backgrounds */
    .cell-numeric,
    .cell-price,
    .cell-contact,
    .cell-date,
    .cell-id,
    .cell-quantity {
        background: rgba(123, 193, 66, 0.05);
    }
}

/* ===== PRINT STYLES FOR TABLES ===== */

@media print {
    .table-wrapper {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .enhanced-table th {
        background: #f5f5f5 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .enhanced-table tbody tr:hover {
        background: none !important;
        transform: none !important;
        box-shadow: none !important;
    }
    
    .status-badge,
    .price-highlight,
    .highlight-number {
        background: #f0f0f0 !important;
        color: #000 !important;
        box-shadow: none !important;
    }
    
    .table-copy-btn {
        display: none !important;
    }
}

/* ===== HIGH CONTRAST MODE TABLE SUPPORT ===== */

@media (prefers-contrast: high) {
    .enhanced-table {
        border: 2px solid #000;
    }
    
    .enhanced-table th {
        background: #000 !important;
        color: #fff !important;
        border: 1px solid #000;
    }
    
    .enhanced-table td {
        border: 1px solid #000;
        color: #000;
    }
    
    .status-badge {
        border: 2px solid #000;
        color: #000 !important;
        background: #fff !important;
    }
}

/* ===== ANIMATION FOR TABLE APPEARANCE ===== */

@keyframes tableSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.enhanced-table {
    animation: tableSlideIn 0.4s ease-out;
}

/* ===== TABLE FOOTER STYLING ===== */

.enhanced-table tfoot {
    background: linear-gradient(135deg, var(--surface-secondary), var(--surface-tertiary));
    font-weight: 600;
    color: var(--fgf-primary);
}

.enhanced-table tfoot td {
    border-top: 2px solid var(--fgf-primary);
    padding: 16px 20px;
    font-weight: 600;
}

/* ===== ENHANCED TABLE CAPTIONS ===== */

.enhanced-table caption {
    caption-side: top;
    padding: 12px;
    font-weight: 600;
    color: var(--fgf-primary);
    text-align: left;
    font-size: 1.1rem;
}

/* ===== TABLE SORTING INDICATORS ===== */

.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
}

.sortable-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
}

.sort-indicator.active {
    opacity: 1;
    color: var(--fgf-white);
}

/* Authentication Error Notification */
.auth-error-notification {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    background: var(--surface-elevated);
    border: 1px solid var(--error);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
}

.error-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
}

.error-message {
    flex: 1;
}

.error-message h3 {
    margin: 0 0 var(--space-2) 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.error-message p {
    margin: 0 0 var(--space-3) 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.error-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.retry-button,
.dismiss-button {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.retry-button {
    background: var(--fgf-primary);
    color: var(--fgf-white);
}

.retry-button:hover {
    background: var(--fgf-primary-dark);
    transform: translateY(-1px);
}

.dismiss-button {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

.dismiss-button:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

/* Mobile responsiveness for auth error */
@media (max-width: 768px) {
    .auth-error-notification {
        top: var(--space-2);
        left: var(--space-2);
        right: var(--space-2);
        transform: none;
        width: auto;
        max-width: none;
    }
    
    .error-content {
        padding: var(--space-3);
    }
    
    .error-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .retry-button,
    .dismiss-button {
        justify-content: center;
    }
}