/* ================================================
 * ENTERPRISE-GRADE STYLING FOR STRATALENS
 * ================================================
 */

/* Transcript Speaker Formatting */
.speaker-section {
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border-left: 3px solid var(--accent-primary);
    background-color: rgba(0, 112, 216, 0.02);
    border-radius: 0 0.5rem 0.5rem 0;
}

.speaker-name {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.speaker-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-left: 0.5rem;
}

.speaker-content p {
    margin-bottom: 0.5rem;
}

.speaker-content p:last-child {
    margin-bottom: 0;
}

/* Citation Header Layout for Chat Citations */
.citation-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
}

/* Override citation header to use flex layout when it contains the button */
.citation-header:has(.view-transcript-btn) {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1rem !important;
}


/* 0. Box-sizing Reset for Better Layout Control */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 1. Base Variables & Refined Color Scheme - ENHANCED FOR PROFESSIONAL POLISH */
:root {
    /* Background Colors - Refined with subtle warmth */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    
    /* Border Colors - Softer, more refined */
    --border-primary: #e2e8f0;
    --border-secondary: #f1f5f9;
    --border-subtle: rgba(226, 232, 240, 0.6);
    --border-focus: rgba(0, 112, 216, 0.4);
    
    /* Text Colors - Enhanced hierarchy */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-quaternary: #94a3b8;
    --text-muted: #cbd5e1;
    
    /* Accent Colors - Deeper, more professional blue */
    --accent-primary: #0066cc;
    --accent-primary-hover: #0052a3;
    --accent-primary-light: rgba(0, 102, 204, 0.08);
    --accent-primary-subtle: rgba(0, 102, 204, 0.04);
    --accent-positive: #059669;
    --accent-negative: #dc2626;
    --accent-warning: #d97706;
    
    /* Enhanced Shadow System - Layered depth */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-focus: 0 0 0 3px rgba(0, 102, 204, 0.15);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 4px 12px rgba(0, 102, 204, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
    
    /* Typography */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    --letter-spacing-tight: -0.02em;
    --letter-spacing-normal: -0.01em;
    
    /* Animation Timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* 2. Base Body & Layout - ENHANCED FOR PROFESSIONAL POLISH */
html {
    overflow-x: hidden;
    width: 100%;
    height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    letter-spacing: var(--letter-spacing-normal);
    line-height: 1.6;
}

main { 
    flex-grow: 1;
    width: 100%;
    overflow-x: hidden;
}

/* Selection styling */
::selection {
    background: rgba(0, 102, 204, 0.15);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(0, 102, 204, 0.15);
    color: var(--text-primary);
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* 2.1. Mobile Viewport Constraints */
@media (max-width: 768px) {
    html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        position: relative;
        touch-action: pan-y;
    }
    
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        position: relative;
        touch-action: pan-y;
    }
    
    body > * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    main, section, div, nav, header {
        box-sizing: border-box;
    }
    
    /* Prevent pull-to-refresh overscroll */
    body {
        overscroll-behavior-y: contain;
        overscroll-behavior-x: none;
    }
}

/* 3. Professional Card - ENHANCED WITH REFINED DEPTH */
.card { 
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--duration-normal) var(--ease-in-out),
                border-color var(--duration-normal) var(--ease-in-out),
                transform var(--duration-normal) var(--ease-in-out);
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-primary);
}

.card-interactive:hover {
    transform: translateY(-1px);
}

/* 4. Enterprise Header - POLISHED GLASSMORPHISM */
.app-header {
    background-color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    position: sticky;
    top: 0;
    z-index: 40;
}

.dark .app-header {
    background-color: rgba(15, 23, 42, 0.92);
    border-bottom-color: rgba(51, 65, 85, 0.5);
}

/* NEW: Clean user section styling */
.user-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.logout-btn {
    color: #ef4444;
    transition: all 0.2s ease;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.logout-btn:hover {
    color: #dc2626;
    background-color: rgba(239, 68, 68, 0.1);
}

/* 5. Enhanced Professional Form & Button Styling - REFINED */
.btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 0.5rem; 
    font-weight: 550; 
    border-radius: var(--radius-md); 
    transition: all var(--duration-normal) var(--ease-out-expo); 
    cursor: pointer; 
    padding: 0.625rem 1.25rem; 
    font-size: 0.875rem;
    letter-spacing: var(--letter-spacing-tight);
    position: relative;
    overflow: hidden;
    border: none;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s var(--ease-out-expo);
    pointer-events: none;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary { 
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.15), 
                0 4px 12px rgba(0, 102, 204, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    height: 44px; 
    padding: 0 1.5rem;
}

.btn-primary:hover { 
    transform: translateY(-1px); 
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2), 
                0 8px 20px rgba(0, 102, 204, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.btn-primary:disabled { 
    background: var(--text-quaternary); 
    opacity: 0.6; 
    cursor: not-allowed; 
    box-shadow: none; 
    transform: none;
    filter: none;
}

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

.btn-secondary:hover { 
    border-color: var(--accent-primary); 
    color: var(--accent-primary); 
    background: var(--accent-primary-subtle);
    box-shadow: var(--shadow-sm), var(--shadow-focus);
}

.btn-secondary:active {
    background: var(--accent-primary-light);
}

.btn-outline { 
    background: transparent; 
    border: 1px solid var(--border-primary); 
    color: var(--text-secondary); 
    font-size: 0.8125rem; 
    padding: 0.5rem 1rem;
    height: auto;
}

.btn-outline:hover { 
    border-color: var(--accent-primary); 
    color: var(--accent-primary); 
    background: var(--accent-primary-subtle);
}

/* Ghost Button - More subtle variant */
.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
}

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

.btn-ghost:active {
    background: var(--bg-secondary);
}

/* 6. AI Reasoning Panel - ENHANCED */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}
.pulse-dot { animation: pulse-dot 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
#aiReasoningPanel .details-content { display: none; }
#aiReasoningPanel.expanded .details-content { display: block; }
#aiReasoningPanel.expanded .chevron-icon { transform: rotate(180deg); }

/* ENHANCED reasoning step styling */
.reasoning-step {
    transition: all 0.25s ease-in-out;
}

.reasoning-step:hover {
    background-color: rgba(0, 0, 0, 0.015);
    border-radius: 0.5rem;
}

.step-icon {
    transition: all 0.3s ease-in-out;
}

.step-title {
    transition: color 0.2s ease-in-out;
}

#reasoningStepsContainer {
    scroll-behavior: smooth;
}

/* Pulse animation for completion */
@keyframes completion-pulse {
    0% { background-color: rgba(34, 197, 94, 0.1); }
    50% { background-color: rgba(34, 197, 94, 0.2); }
    100% { background-color: transparent; }
}

.animate-pulse {
    animation: completion-pulse 1s ease-in-out;
}

/* Streaming and thinking step animations */
.streaming-indicator {
    position: relative;
    overflow: hidden;
}

.streaming-indicator::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #3b82f6;
    animation: blink 1s infinite;
}

.thinking-step {
    position: relative;
    overflow: hidden;
}

.thinking-cursor {
    animation: blink 1s infinite;
    color: #3b82f6;
    font-weight: bold;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.thinking-text {
    position: relative;
}

.step-completion {
    position: relative;
    font-weight: 600;
}

.step-completion::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #22c55e;
    border-radius: 50%;
}

/* Warning step styling for semantic queries */
.reasoning-step.warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 4px 0;
}

.reasoning-step.warning .step-title {
    color: #d97706;
    font-weight: 600;
}

.reasoning-step.warning .step-icon {
    color: #f59e0b;
}

.dark .reasoning-step.warning {
    background-color: rgba(245, 158, 11, 0.15);
    border-left-color: #f59e0b;
}

.dark .reasoning-step.warning .step-title {
    color: #fbbf24;
}

/* Enhanced panel status updates */
.pulse-dot {
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Progress bar animations */
#progressBar {
    transition: width 0.5s ease-in-out;
}

#initialLoadingProgress {
    transition: opacity 0.3s ease-in-out;
}

/* 7. MULTI-SHEET STYLING */
.multi-sheet-container {
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bg-secondary);
}

.sheet-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-primary);
    overflow-x: auto;
    min-height: 48px;
}

.sheet-tab {
    flex-shrink: 0;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.sheet-tab:hover {
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    color: var(--text-primary);
}

.sheet-tab.active {
    background: var(--bg-primary);
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 600;
}

.sheet-tab-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.sheet-content {
    display: none;
}

.sheet-content.active {
    display: block;
}

.sheet-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-primary);
}

.sheet-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
}

.sheet-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 8. Chart Modal - IMPROVED SIZING AND DESIGN */
.chart-modal-backdrop {
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(10px);
}

/* UPDATED: Better Chart Modal Styling with improved sizing */
#chartModal .chart-type-toggle {
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
}

#chartModal .chart-type-toggle button {
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: none;
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#chartModal .chart-type-toggle button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#chartModal .chart-type-toggle button.active {
    background: linear-gradient(135deg, #0070d8, #0052cc);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 112, 216, 0.2);
}

.chart-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

/* Enhanced Results Section */
.screener-results {
    background: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-primary);
    margin-top: 2rem;
    overflow: hidden;
}

.dark .screener-results {
    background: var(--bg-secondary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.screener-results-header {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-bottom: 1px solid var(--border-primary);
    padding: 1.75rem 2rem;
    position: relative;
    overflow: hidden;
}

.screener-results-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(16, 185, 129, 0.02) 50%, transparent 100%);
}

.screener-results-info h3 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    letter-spacing: -0.025em;
}

.screener-results-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.screener-results-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.screener-results-content {
    background: var(--bg-primary);
    padding: 0;
}

/* Excel-like Professional Table Styles */
.results-table-wrapper {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow-x: auto;
    max-width: 100%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .results-table-wrapper {
    border-color: #374151;
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.data-grid {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.875rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
}

.dark .data-grid {
    background: #1f2937;
}

/* Excel-like Header Styling */
.data-grid thead th {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-left: none;
    padding: 8px 12px;
    font-weight: 600;
    color: #374151;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    transition: background-color 0.15s ease;
    cursor: pointer;
    height: 32px;
    vertical-align: middle;
}

.dark .data-grid thead th {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.data-grid thead th:first-child {
    border-left: 1px solid #e5e7eb;
}

.dark .data-grid thead th:first-child {
    border-left-color: #4b5563;
}

.data-grid thead th:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.dark .data-grid thead th:hover {
    background: #4b5563;
    color: #f9fafb;
}

.data-grid thead th .sort-icon {
    color: #9ca3af;
    opacity: 0.7;
    transition: opacity 0.15s ease;
    margin-left: 4px;
    font-size: 0.7rem;
}

.data-grid thead th:hover .sort-icon {
    opacity: 1;
    color: #6b7280;
}

/* Excel-like Body Styling */
.data-grid tbody td {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-left: none;
    vertical-align: middle;
    color: #1f2937;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 400;
    position: relative;
    height: 28px;
    background: #ffffff;
}

.dark .data-grid tbody td {
    border-color: #4b5563;
    color: #f9fafb;
    background: #1f2937;
}

.data-grid tbody td:first-child {
    border-left: 1px solid #e5e7eb;
}

.dark .data-grid tbody td:first-child {
    border-left-color: #4b5563;
}

.data-grid tbody tr {
    transition: background-color 0.15s ease;
    position: relative;
}

.data-grid tbody tr:nth-child(even) td {
    background: #f9fafb;
}

.dark .data-grid tbody tr:nth-child(even) td {
    background: #2d3748;
}

.data-grid tbody tr:hover td {
    background: #e0f2fe;
    cursor: pointer;
}

.dark .data-grid tbody tr:hover td {
    background: #1e3a8a;
}

/* Excel-like Selection Effect */
.data-grid tbody tr.selected td {
    background: #dbeafe;
}

.dark .data-grid tbody tr.selected td {
    background: #1e40af;
}

/* Number cell alignment */
.data-grid tbody td.number-cell {
    text-align: right;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8125rem;
}

/* Symbol/Company name styling */
.data-grid tbody td.symbol-cell {
    font-weight: 600;
    color: #1e40af;
}

.dark .data-grid tbody td.symbol-cell {
    color: #60a5fa;
}

/* Financial Data Presentation */
.data-positive { color: var(--accent-positive); font-weight: 600; }
.data-negative { color: var(--accent-negative); font-weight: 600; }
.number-cell {
    font-family: 'JetBrains Mono', monospace, 'SF Mono', Monaco;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
}
.symbol-cell {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
}
.symbol-cell a {
    color: var(--accent-primary); text-decoration: none;
}
.symbol-cell a:hover {
    text-decoration: underline; color: var(--accent-primary-hover);
}
.dark .symbol-cell a { color: var(--accent-primary-hover); }
.dark .symbol-cell a:hover { color: var(--accent-primary); }

/* Enhanced styling for company links */
.company-link {
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.company-link:hover {
    background-color: rgba(0, 112, 216, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 112, 216, 0.2);
}

.company-link:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 112, 216, 0.3);
}

/* Tooltip-like enhancement */
.company-link::before {
    content: '👤 View Profile';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.company-link:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 4px);
}
.sector-badge {
    padding: 2px 8px; border-radius: 9999px; font-size: 10px; font-weight: 500;
    display: inline-flex; align-items: center; line-height: 1.2; border: 1px solid;
}
.sector-technology { background-color: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }
.dark .sector-technology { background-color: #3730a3; color: #e0e7ff; border-color: #4338ca; }
.sector-healthcare { background-color: #dcfce7; color: #166534; border-color: #a7f3d0; }
.dark .sector-healthcare { background-color: #14532d; color: #86efac; border-color: #166534; }
.sector-financials { background-color: #fef9c3; color: #854d0e; border-color: #fde68a; }
.dark .sector-financials { background-color: #713f12; color: #fde047; border-color: #854d0e; }
.sector-default { background-color: var(--bg-tertiary); color: var(--text-secondary); border-color: var(--border-primary); }

.btn-icon { padding: 0.5rem; }

/* Enhanced Search Input Styling */
.input-pro.search-input {
    height: 64px; 
    padding: 0 24px 0 56px;
    font-size: 1.125rem; 
    border: 2px solid var(--border-primary);
    border-radius: 16px; 
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(248, 250, 252, 0.8) 100%);
    color: var(--text-primary); 
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    font-weight: 400;
    letter-spacing: 0.025em;
    backdrop-filter: blur(8px);
}

.input-pro.search-input::placeholder { 
    color: var(--text-tertiary); 
    opacity: 0.7;
    font-weight: 400;
}

.input-pro.search-input:focus {
    outline: none; 
    border-color: var(--accent-primary);
    box-shadow: 0 12px 32px rgba(0, 112, 216, 0.2);
    background: var(--bg-primary);
    transform: translateY(-2px);
}

.dark .input-pro.search-input {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(30, 41, 59, 0.8) 100%);
}

.dark .input-pro.search-input:focus {
    background: var(--bg-primary);
}

/* Login Modal Styles */
/* Landing Page Integration Styles */
.landing-restricted {
    opacity: 0.5;
    pointer-events: none;
}

.landing-restricted::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.landing-upgrade-prompt {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.landing-transition {
    transition: opacity 0.5s ease-in-out;
}

.login-modal {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.login-form {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Enhanced Input Field Styling - REFINED */
.input-field {
    width: 100%; 
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md); 
    background: var(--bg-primary);
    color: var(--text-primary); 
    transition: all var(--duration-fast) var(--ease-in-out);
    font-size: 0.9375rem;
    font-weight: 400;
    letter-spacing: var(--letter-spacing-normal);
    box-shadow: var(--shadow-xs);
}

.input-field::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.input-field:hover {
    border-color: var(--text-quaternary);
}

.input-field:focus {
    outline: none; 
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-focus), var(--shadow-sm);
}

.dark .input-field {
    background: var(--bg-secondary);
    border-color: rgba(51, 65, 85, 0.6);
}

.dark .input-field:hover {
    border-color: rgba(71, 85, 105, 0.8);
}

.dark .input-field:focus {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

/* Large input variant */
.input-field-lg {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* Auth Loading Screen */
#authLoadingScreen {
    position: fixed;
    inset: 0;
    background-color: var(--bg-primary);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Multi-sheet export dropdown */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-primary);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    z-index: 1000;
    padding: 8px 0;
}

.export-dropdown.active .export-dropdown-content {
    display: block;
}

.export-option {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
}

.export-option:hover {
    background-color: var(--bg-secondary);
}

.export-option i {
    width: 16px;
    margin-right: 8px;
}

/* Chart Icon Styles */
.chart-icon {
    font-size: 16px;
    margin-right: 4px;
}

/* Better chart container sizing - SCALED DOWN */
.chart-container {
    height: 320px;
    position: relative;
}

@media (min-width: 1024px) {
    .chart-container {
        height: 360px;
    }
}

@media (min-width: 1280px) {
    .chart-container {
        height: 400px;
    }
}

/* Chart modal improvements */
#chartModalContent {
    max-width: 90vw;
    max-height: 90vh;
}

/* Export button in chart modal */
#exportModalChartBtn {
    padding: 4px 12px;
    font-size: 13px;
}

/* SEC SOURCES MODAL STYLING */
.sec-sources-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sec-sources-modal.hidden {
    display: none;
}

.sec-sources-modal-content {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 50rem;
    max-height: 70vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sec-sources-modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-primary);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: between;
}

.sec-sources-modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.sec-sources-modal-footer {
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    display: flex;
    justify-content: flex-end;
}

.view-sources-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    text-decoration: none;
}

.view-sources-btn:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 112, 216, 0.3);
}

.view-sources-btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sources-table th {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-primary);
}

.sources-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-secondary);
}

.sources-table tr:hover {
    background: var(--bg-tertiary);
}

.close-modal-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* MODAL CONTENT STYLING */
.filing-source-card {
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.filing-source-card:hover {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 112, 216, 0.1);
}

.filing-link {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.filing-link:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 112, 216, 0.3);
    color: white !important;
    text-decoration: none;
}

.filing-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.filing-metadata-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filing-metadata-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.filing-metadata-value {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    word-break: break-word;
}

/* Style for clickable links in filing metadata */
.filing-metadata-value a {
    color: #2563eb;
    text-decoration: underline;
    transition: all 0.2s ease;
}

.filing-metadata-value a:hover {
    color: #1d4ed8;
    text-decoration: none;
}

/* Dark mode support for metadata links */
.dark .filing-metadata-value a {
    color: #60a5fa;
}

.dark .filing-metadata-value a:hover {
    color: #93c5fd;
}

/* =============================================================================
 * NEW CLEAN SIDEBAR LAYOUT
 * ============================================================================= */

/* App Layout Grid */
.app-layout {
    display: grid;
    grid-template-columns: 16rem 1fr;
    grid-template-areas: "sidebar main";
    height: calc(100vh - 4rem); /* Full height minus header */
}

/* Sidebar */
.app-sidebar {
    grid-area: sidebar;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
}

.dark .app-sidebar {
    background: var(--bg-primary);
}

/* Main Content */
.app-main {
    grid-area: main;
    overflow-y: auto;
    padding: 2rem;
}

/* Remove padding and overflow when chat section is active - chat has its own scrolling */
.app-main:has(#chatSection.active) {
    padding: 0;
    overflow: hidden; /* Prevent page scrollbar when chat is active */
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 1rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
}

/* Mobile Layout */
@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "main";
    }
    
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 16rem;
        height: 100vh;
        z-index: 50;
        transition: left 0.3s ease;
    }
    
    .app-sidebar.open {
        left: 0;
    }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        display: none;
    }
    
    .sidebar-backdrop.open {
        display: block;
    }
    
    .app-main {
        padding: 1rem;
    }
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--duration-normal) var(--ease-out-expo);
    position: relative;
    margin: 0.125rem 0.5rem;
    overflow: hidden;
    border: 1px solid transparent;
}

.sidebar-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-primary);
    transition: height var(--duration-normal) var(--ease-out-expo);
    border-radius: 0 3px 3px 0;
}

.sidebar-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-menu-item:hover::before {
    height: 60%;
}

.sidebar-menu-item.active {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
    font-weight: 600;
}

.sidebar-menu-item.active::before {
    background: var(--accent-primary);
    height: 70%;
}

.sidebar-menu-item.active:hover {
    background: var(--accent-primary-light);
}

.sidebar-menu-item i {
    width: 1.125rem;
    text-align: center;
    font-size: 0.9375rem;
    transition: all var(--duration-normal) var(--ease-out-expo);
    opacity: 0.7;
}

.sidebar-menu-item:hover i,
.sidebar-menu-item.active i {
    opacity: 1;
}

.sidebar-menu-item.active i {
    color: var(--accent-primary);
}

.sidebar-menu-item span {
    flex: 1;
    font-weight: inherit;
    letter-spacing: var(--letter-spacing-normal);
}

/* Hide desktop authenticated controls on mobile */
@media (max-width: 1024px) {
    #authenticatedControls {
        display: none !important;
    }
}

/* Mobile navbar buttons */
@media (max-width: 1024px) {
    .user-section {
        display: flex;
        align-items: center;
    }
    
    /* Mobile button styles */
    #mobileSignInBtn,
    #mobileGetStartedBtn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        border-radius: 0.5rem;
        transition: all 0.2s ease-in-out;
    }
    
    #mobileSignInBtn {
        background-color: transparent;
        border: 1px solid var(--border-primary);
        color: var(--text-primary);
    }
    
    #mobileSignInBtn:hover {
        background-color: var(--bg-tertiary);
        border-color: var(--accent-primary);
    }
    
    #mobileGetStartedBtn {
        background-color: var(--accent-primary);
        border: 1px solid var(--accent-primary);
        color: white;
    }
    
    #mobileGetStartedBtn:hover {
        background-color: #0052cc;
        border-color: #0052cc;
    }
}

/* Dark mode adjustments for sidebar */
.dark .sidebar {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
}

.dark .sidebar-menu-item:hover {
    background-color: var(--bg-tertiary);
}

/* Animation for sidebar items */
.sidebar-menu-item {
    transform: translateX(0);
    transition: all 0.2s ease-in-out;
}

.sidebar-menu-item:hover {
    transform: translateX(4px);
}

.sidebar-menu-item.active:hover {
    transform: translateX(4px);
}

/* =============================================================================
 * CHARTING SECTION STYLING
 * =============================================================================
 */

/* Stock search suggestions */
#chartingStockSuggestions {
    z-index: 9999 !important;
    position: absolute !important;
}

.stock-suggestion-item {
    transition: all 0.2s ease-in-out;
}

.stock-suggestion-item:hover {
    background-color: var(--bg-tertiary);
}

.stock-suggestion-item:last-child {
    border-bottom: none !important;
}

/* Selected stocks display */
.stock-tag {
    transition: all 0.2s ease-in-out;
    border: 1px solid color-mix(in srgb, var(--accent-primary) 20%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 8%, var(--bg-primary));
}

.stock-tag:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 30%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 12%, var(--bg-primary));
}

.remove-stock-btn {
    transition: all 0.2s ease-in-out;
}

.remove-stock-btn:hover {
    background-color: color-mix(in srgb, red 10%, transparent);
    color: red;
    transform: scale(1.1);
}

/* Chart container styling */
#chartingChartContainer {
    transition: all 0.3s ease-in-out;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-primary);
}

/* Enhanced chart area styling */
#chartingChartArea {
    position: relative;
    padding: 20px;
    padding-bottom: 60px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    min-height: 450px;
}

/* Zoom controls */
.chart-zoom-controls {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.zoom-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.zoom-btn:active {
    transform: translateY(0);
}

.dark .zoom-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
}

.dark .zoom-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

#chartingChartArea {
    position: relative;
}

/* Fullscreen chart functionality */
.fullscreen-chart {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: var(--bg-primary) !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 2rem !important;
}

.fullscreen-chart canvas {
    max-height: calc(100vh - 8rem) !important;
}

/* Chart loading and error states */
#chartingChartError {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Chart controls styling */
#chartingFullscreenBtn, #chartingRefreshBtn {
    transition: all 0.2s ease-in-out;
}

#chartingFullscreenBtn:hover, #chartingRefreshBtn:hover {
    transform: scale(1.05);
}

/* Empty state styling */
#chartingEmptyState {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--accent-primary) 3%, var(--bg-primary)),
        var(--bg-primary)
    );
}

#chartingEmptyState .w-16 {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--accent-primary) 15%, transparent),
        color-mix(in srgb, var(--accent-primary) 8%, transparent)
    );
}

/* Responsive adjustments for charting */
@media (max-width: 768px) {
    .fullscreen-chart {
        padding: 1rem !important;
    }
    
    .fullscreen-chart canvas {
        max-height: calc(100vh - 4rem) !important;
    }
    
    .stock-tag {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .remove-stock-btn {
        align-self: flex-end;
        margin-top: -1.5rem;
    }
    
    /* Make charting controls more mobile-friendly */
    .charting-stock-container input {
        width: 100% !important;
        max-width: none !important;
    }
    
    #chartingStockSuggestions {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Dark mode adjustments for charting */
.dark .stock-suggestion-item:hover {
    background-color: var(--bg-tertiary);
}

.dark .stock-tag {
    border-color: color-mix(in srgb, var(--accent-primary) 25%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 10%, var(--bg-primary));
}

.dark .stock-tag:hover {
    border-color: color-mix(in srgb, var(--accent-primary) 35%, transparent);
    background: color-mix(in srgb, var(--accent-primary) 15%, var(--bg-primary));
}

.dark #chartingEmptyState {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--accent-primary) 5%, var(--bg-primary)),
        var(--bg-primary)
    );
}

/* Chart metric selection styling */
#chartingMetricSelect optgroup {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

#chartingMetricSelect option {
    padding: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dark #chartingMetricSelect optgroup {
    background: var(--bg-secondary);
}

.dark #chartingMetricSelect option {
    background: var(--bg-primary);
}

/* =============================================================================
 * NAVIGATION SECTIONS STYLING
 * =============================================================================
 */

/* Main section switching */
.main-section {
    display: none;
}

.main-section.active {
    display: block;
}

/* Chat section needs flex display when active */
#chatSection.active {
    display: flex;
}

/* =============================================================================
 * ENHANCED SCREENER & SCREENS FUNCTIONALITY STYLING
 * =============================================================================
 */

/* Professional Screener Container */
.screener-container {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-primary);
    overflow: hidden;
}

.dark .screener-container {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced Screener Header */
.screener-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 1.5rem;
}

.dark .screener-header {
    background: var(--bg-tertiary);
}

.screener-header .screener-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.screener-header .screener-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 600px;
}

/* Enhanced Screener Categories */
.screener-categories {
    padding: 1.5rem;
    background: var(--bg-primary);
}

.category-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.category-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--accent-primary);
}

.dark .category-card {
    background: var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.category-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.category-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.suggestion-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-block;
}

.suggestion-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.dark .suggestion-btn {
    background: var(--bg-tertiary);
    border-color: var(--border-primary);
    color: var(--text-primary);
}

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

/* Enhanced Search Input */
.screener-search-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.screener-search-input {
    width: 100%;
    height: 64px;
    padding: 0 24px 0 64px;
    font-size: 1.125rem;
    border: 2px solid var(--border-primary);
    border-radius: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    font-weight: 400;
    letter-spacing: 0.025em;
}

.screener-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 8px 32px rgba(0, 112, 216, 0.15);
    background: var(--bg-primary);
}

.screener-search-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.screener-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.screener-search-input:focus + .screener-search-icon {
    color: var(--accent-primary);
}

/* Professional Screens Table */
.screens-table-wrapper {
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.screens-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    font-size: 0.875rem;
}

/* Table Header */
.screens-table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border-primary);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dark .screens-table thead th {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-tertiary);
    border-color: var(--border-primary);
}

/* Column Widths */
.screen-name-col { width: 35%; min-width: 220px; }
.screen-type-col { width: 20%; min-width: 160px; }
.screen-labels-col { width: 18%; min-width: 130px; }
.screen-updated-col { width: 12%; min-width: 110px; }
.screen-actions-col { width: 15%; min-width: 140px; text-align: center; }

/* Table Rows */
.screens-table tbody tr {
    border-bottom: 1px solid var(--border-secondary);
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    opacity: 0;
    animation: fadeInRow 0.3s ease-out forwards;
}

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

.screens-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.screens-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.screens-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.screens-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.screens-table tbody tr:nth-child(5) { animation-delay: 0.25s; }
.screens-table tbody tr:nth-child(n+6) { animation-delay: 0.3s; }

.screens-table tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f7ff 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 82, 204, 0.08);
}

.dark .screens-table tbody tr:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(0, 112, 216, 0.05) 100%);
}

.screens-table tbody tr:last-child {
    border-bottom: none;
}

/* Table Cells */
.screens-table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    color: var(--text-primary);
}

/* Screen Name Cell */
.screen-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.1) 0%, rgba(0, 82, 204, 0.05) 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.screen-name {
    font-size: 0.9rem;
    line-height: 1.3;
}

.screen-description {
    line-height: 1.4;
    opacity: 0.8;
}

/* Screen Type Badges */
.screen-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px solid;
}

.screen-type-badge.multi-sheet {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: #1e40af;
    border-color: rgba(59, 130, 246, 0.2);
}

.screen-type-badge.single-sheet {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(22, 163, 74, 0.05) 100%);
    color: #166534;
    border-color: rgba(34, 197, 94, 0.2);
}

.dark .screen-type-badge.multi-sheet {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
}

.dark .screen-type-badge.single-sheet {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2) 0%, rgba(22, 163, 74, 0.1) 100%);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.3);
}

/* Collections Navigation */
.collections-nav {
    background: var(--bg-tertiary);
}

.collection-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    border-bottom: 2px solid transparent;
    position: relative;
}

.collection-nav-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 112, 216, 0.05);
}

.collection-nav-btn.active {
    color: var(--accent-primary);
    background: var(--bg-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: 600;
}

.collection-count {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    min-width: 1.25rem;
    text-align: center;
    line-height: 1;
}

.collection-nav-btn.active .collection-count {
    background: rgba(0, 112, 216, 0.1);
    color: var(--accent-primary);
}

.coming-soon-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.25rem;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.2);
}

/* Type Info */
.type-info {
    line-height: 1.3;
}

.type-details {
    font-weight: 500;
    opacity: 0.8;
}

/* Labels Cell */
.labels-container {
    min-height: 2rem;
    display: flex;
    align-items: center;
}

.add-label-btn {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
    border: 1px dashed var(--border-primary);
    background: var(--bg-secondary);
    opacity: 0.6;
}

.add-label-btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Updated Time Cell */
.updated-time {
    font-weight: 500;
    color: var(--text-secondary);
}

.updated-date {
    opacity: 0.7;
    margin-top: 0.125rem;
}

.text-text-quaternary {
    color: var(--text-quaternary);
}

/* Action Buttons */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: 1px solid;
    white-space: nowrap;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #0052cc 100%);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 1px 3px rgba(0, 82, 204, 0.2);
}

.action-btn.primary:hover {
    background: linear-gradient(135deg, #0052cc 0%, #003d99 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 82, 204, 0.3);
}

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

.action-btn.secondary:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.dark .action-btn.secondary:hover {
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.2);
}


.action-btn.charting {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 1px 3px rgba(0, 112, 216, 0.2);
}

.action-btn.charting:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 112, 216, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .screens-table-wrapper {
        overflow-x: auto;
    }
    
    .screens-table {
        min-width: 800px;
    }
    
    .action-btn .action-text {
        display: none;
    }
    
    .action-btn {
        padding: 0.5rem;
        min-width: 2.25rem;
        justify-content: center;
    }
    
    .screen-actions-col {
        width: 12%;
        min-width: 100px;
    }
    
    .collection-nav-btn span:not(.collection-count):not(.coming-soon-badge) {
        display: none;
    }
    
    .collection-nav-btn {
        padding: 0.875rem 0.75rem;
        justify-content: center;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .coming-soon-badge {
        font-size: 0.5rem;
        padding: 0.0625rem 0.25rem;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .screens-table thead th,
    .screens-table tbody td {
        padding: 0.75rem 0.875rem;
    }
    
    .screen-name-col { min-width: 180px; }
    .screen-type-col { min-width: 140px; }
    .screen-labels-col { min-width: 110px; }
    .screen-updated-col { min-width: 90px; }
    .screen-actions-col { min-width: 90px; }
}

/* Small button styling for backwards compatibility */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-height: auto;
    height: auto;
}

.btn-sm i {
    font-size: 0.75rem;
}

/* Screen modal styling */
#screensViewModal .card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
}

/* Loading states for screens */
#screensLoadingContainer {
    color: var(--text-secondary);
}

#screensErrorContainer {
    color: var(--accent-negative);
}

#screensEmptyContainer {
    color: var(--text-tertiary);
}

/* Enhanced Empty State */
.screens-empty-state {
    max-width: 32rem;
    margin: 0 auto;
    padding: 2rem;
}

.empty-icon-container {
    width: 5rem;
    height: 5rem;
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.1) 0%, rgba(0, 82, 204, 0.05) 100%);
    border: 2px solid rgba(0, 112, 216, 0.15);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    color: var(--accent-primary);
    position: relative;
}

.empty-icon-container::before {
    content: '';
    position: absolute;
    inset: -0.5rem;
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.05) 0%, transparent 100%);
    border-radius: 2rem;
    z-index: -1;
}

/* Screen save modal styling */
#saveScreenModal .card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

#saveScreenModal .input-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#saveScreenModal .input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 112, 216, 0.1);
}

#saveScreenModal textarea.input-field {
    resize: vertical;
    min-height: 80px;
}

/* Screen filters */
#screensFilterType {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

#screensFilterType:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 112, 216, 0.1);
}

/* Dark mode adjustments for screens */
.dark .screen-card {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

.dark .screen-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 112, 216, 0.2);
}

.dark #saveScreenModal .card {
    background: var(--bg-primary);
}

.dark #screensViewModal .card {
    background: var(--bg-primary);
}

/* =============================================================================
 * EXPAND VALUE FUNCTIONALITY STYLES
 * ============================================================================= */

/* Expand value button styles */
.expand-value-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.expand-value-btn:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.1);
}

.expand-value-btn:active {
    transform: scale(0.95);
}

.truncated-value {
    display: inline;
}

/* Modal styles for expand value */
#expandValueModal {
    backdrop-filter: blur(4px);
}

#expandValueContent {
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Dark mode support for expand functionality */
.dark .expand-value-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

.dark #expandValueContent {
    background-color: var(--bg-tertiary);
    border-color: var(--border-primary);
}

/* =============================================================================
 * USAGE MODAL STYLES
 * ============================================================================= */

/* Usage Modal Styles */
#usageModal .card {
    max-width: 800px;
    width: 100%;
}

#usageLoading {
    min-height: 200px;
}

#usageContent {
    animation: fadeIn 0.3s ease-in-out;
}

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

#usageError {
    min-height: 200px;
}

/* Rate limit cards */
#usageModal .bg-blue-50 {
    background-color: #eff6ff;
}

#usageModal .bg-green-50 {
    background-color: #f0fdf4;
}

.dark #usageModal .bg-blue-50 {
    background-color: rgba(59, 130, 246, 0.1);
}

.dark #usageModal .bg-green-50 {
    background-color: rgba(34, 197, 94, 0.1);
}

/* Usage statistics cards */
#usageModal .bg-bg-tertiary {
    transition: all 0.2s ease-in-out;
}

#usageModal .bg-bg-tertiary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark #usageModal .bg-bg-tertiary:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* =============================================================================
 * RATE LIMIT ERROR STYLES
 * ============================================================================= */

/* Rate Limit Error Container */
.rate-limit-error-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark .rate-limit-error-container {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-color: var(--border-primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* Rate Limit Header */
.rate-limit-header {
    text-align: center;
    margin-bottom: 2rem;
}

.rate-limit-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.rate-limit-icon i {
    font-size: 1.5rem;
    color: white;
}

.rate-limit-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.rate-limit-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* Rate Limit Details Grid */
.rate-limit-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.rate-limit-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rate-limit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-primary);
}

.dark .rate-limit-card {
    background: var(--bg-secondary);
    border-color: var(--border-primary);
}

.dark .rate-limit-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rate-limit-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.1) 0%, rgba(0, 82, 204, 0.05) 100%);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rate-limit-card-icon i {
    font-size: 1rem;
    color: var(--accent-primary);
}

.rate-limit-card-content h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.rate-limit-card-content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.3;
}

/* Rate Limit Actions */
.rate-limit-actions {
    border-top: 1px solid var(--border-primary);
    padding-top: 1.5rem;
}

.rate-limit-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(37, 99, 235, 0.02) 100%);
    border: 1px solid rgba(59, 130, 246, 0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.rate-limit-info i {
    color: var(--accent-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

.dark .rate-limit-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.rate-limit-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.rate-limit-buttons .btn {
    min-width: 160px;
    justify-content: center;
}

/* Responsive Design */
@media (max-width: 640px) {
    .rate-limit-error-container {
        padding: 1.5rem;
        margin: 0 1rem;
    }
    
    .rate-limit-details {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .rate-limit-card {
        padding: 1rem;
    }
    
    .rate-limit-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .rate-limit-buttons .btn {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .rate-limit-title {
        font-size: 1.25rem;
    }
    
    .rate-limit-description {
        font-size: 0.875rem;
    }
    
    .rate-limit-icon {
        width: 3rem;
        height: 3rem;
    }
    
    .rate-limit-icon i {
        font-size: 1.25rem;
    }
}

/* Animation for rate limit error appearance */
.rate-limit-error-container {
    animation: slideInUp 0.4s ease-out;
}

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

/* Enhanced hover effects for cards */
.rate-limit-card {
    position: relative;
    overflow: hidden;
}

.rate-limit-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 112, 216, 0.05), transparent);
    transition: left 0.5s ease;
}

.rate-limit-card:hover::before {
    left: 100%;
}

/* Professional color scheme for different card types */
.rate-limit-card:nth-child(1) .rate-limit-card-icon {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.1) 0%, rgba(0, 92, 182, 0.05) 100%);
}

.rate-limit-card:nth-child(1) .rate-limit-card-icon i {
    color: var(--accent-primary);
}

.rate-limit-card:nth-child(2) .rate-limit-card-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
}

.rate-limit-card:nth-child(2) .rate-limit-card-icon i {
    color: #f59e0b;
}

.rate-limit-card:nth-child(3) .rate-limit-card-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(124, 58, 237, 0.05) 100%);
}

.rate-limit-card:nth-child(3) .rate-limit-card-icon i {
    color: #8b5cf6;
}

/* ================================================
 * ENHANCED ENTERPRISE CHAT INTERFACE STYLES
 * ================================================ */

/* Chat Container - POLISHED */
#chatSection {
    background: var(--bg-primary);
    height: 100%;
    flex-direction: column;
    overflow: hidden;
}

.dark #chatSection {
    background: var(--bg-primary);
}

/* Enhanced Chat Header - REFINED */
.chat-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.dark .chat-header {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: rgba(51, 65, 85, 0.5);
}

.chat-header h2 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: var(--letter-spacing-tight);
}

.chat-header .chat-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-header .btn {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
}

/* Enhanced Chat Messages Container - POLISHED MODERN STYLE */
#chatMessages,
.chat-messages-full {
    scroll-behavior: smooth;
    padding: 0;
    flex: 1;
    overflow-y: auto;
    background: var(--bg-primary);
    max-width: none;
    margin: 0;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Refined Custom Scrollbar */
#chatMessages::-webkit-scrollbar {
    width: 6px;
}

#chatMessages::-webkit-scrollbar-track {
    background: transparent;
}

#chatMessages::-webkit-scrollbar-thumb {
    background: var(--text-quaternary);
    border-radius: var(--radius-full);
    opacity: 0.6;
}

#chatMessages::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Firefox scrollbar */
#chatMessages {
    scrollbar-width: thin;
    scrollbar-color: var(--text-quaternary) transparent;
}

/* Modern Chat Messages */
.chat-message {
    width: 100%;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    margin: 0;
    opacity: 0;
    animation: messageSlideIn 0.35s var(--ease-out-expo) forwards;
    position: relative;
}

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

/* Clean alternating backgrounds */
.chat-message.user {
    background: var(--bg-primary);
}

.chat-message.assistant {
    background: var(--bg-secondary);
}

/* Chat progress indicator styles */
.chat-progress-indicator {
    margin: 10px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.3s ease-out;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 4px;
    transition: width 0.3s ease-out;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
    text-align: center;
    margin: 0;
}

/* Dark mode progress indicator */
.dark .chat-progress-indicator {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    border-color: #4a5568;
}

.dark .progress-bar {
    background-color: #4a5568;
}

.dark .progress-fill {
    background: linear-gradient(90deg, #3182ce 0%, #2c5aa0 100%);
}

.dark .progress-text {
    color: #e2e8f0;
}

/* Chat Avatars - REFINED MINIMAL STYLE */
.chat-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
    transition: transform var(--duration-fast) var(--ease-out-expo);
}

.chat-avatar:hover {
    transform: scale(1.05);
}

.chat-avatar.user {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.chat-avatar.assistant {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

/* Chat Content Container - REFINED SPACING */
.chat-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    width: 100%;
}

/* Message Text Wrapper - Contains message text and citations */
.message-text-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Message Content - Now takes full available width */
.chat-bubble {
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 0;
    word-wrap: break-word;
    line-height: 1.7;
    font-size: 0.95rem;
    max-width: none;
    color: var(--text-primary);
    width: 100%;
}

/* Remove all bubble styling - messages are now just text blocks */
.chat-bubble:hover {
    transform: none;
    box-shadow: none;
}

.chat-message.user .chat-bubble {
    background: transparent;
    color: var(--text-primary);
    border: none;
    margin: 0;
}

.chat-message.assistant .chat-bubble {
    background: transparent;
    border: none;
    color: var(--text-primary);
}

.chat-message.assistant .chat-bubble::before {
    display: none;
}

/* Dark mode adjustments with blue theme */
.dark .chat-message.user {
    background: var(--slate-900);
}

.dark .chat-message.assistant {
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.05) 0%, rgba(0, 92, 182, 0.03) 100%);
}

.dark .chat-bubble {
    color: var(--text-primary);
}

/* Citations styling with blue theme */
.message-text-wrapper .citations {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.03) 0%, rgba(0, 92, 182, 0.02) 100%);
    border-radius: 8px;
    border: 1px solid rgba(0, 131, 241, 0.15);
    width: 100%;
}

.dark .message-text-wrapper .citations {
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.08) 0%, rgba(0, 92, 182, 0.05) 100%);
    border-color: rgba(0, 131, 241, 0.25);
}

/* Ensure citations don't interfere with flex layout */
.chat-message .citations {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.03) 0%, rgba(0, 92, 182, 0.02) 100%);
    border-radius: 8px;
    border: 1px solid rgba(0, 131, 241, 0.15);
    width: 100%;
}

.dark .chat-message .citations {
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.08) 0%, rgba(0, 92, 182, 0.05) 100%);
    border-color: rgba(0, 131, 241, 0.25);
}

/* Improved typography for Claude-style messages */
.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3,
.chat-bubble h4,
.chat-bubble h5,
.chat-bubble h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-bubble h1:first-child,
.chat-bubble h2:first-child,
.chat-bubble h3:first-child,
.chat-bubble h4:first-child,
.chat-bubble h5:first-child,
.chat-bubble h6:first-child {
    margin-top: 0;
}

.chat-bubble p {
    margin-bottom: 1rem;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble ul,
.chat-bubble ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.chat-bubble li {
    margin-bottom: 0.5rem;
}

.chat-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.dark .chat-bubble code {
    background: rgba(255, 255, 255, 0.1);
}

.chat-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-primary);
}

.dark .chat-bubble pre {
    background: rgba(255, 255, 255, 0.05);
}

.chat-bubble blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Clean Welcome Message Styling */
.welcome-content {
    text-align: center;
    padding: 1rem 0;
}

.welcome-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #005cb6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.quick-suggestions-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    text-align: center;
    opacity: 0.8;
}

.quick-examples {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.example-btn {
    padding: 1.25rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: left;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.example-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary) 0%, #005cb6 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.example-btn:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.05) 0%, rgba(0, 92, 182, 0.03) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 131, 241, 0.15);
}

.example-btn:hover::before {
    opacity: 1;
}

/* Dark mode adjustments with blue theme */
.dark .example-btn {
    background: var(--slate-800);
    border-color: var(--slate-600);
}

.dark .example-btn:hover {
    background: linear-gradient(135deg, rgba(0, 131, 241, 0.1) 0%, rgba(0, 92, 182, 0.08) 100%);
    border-color: var(--accent-primary);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .welcome-content h2 {
        font-size: 1.25rem;
    }
    
    .quick-examples {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 400px;
    }
    
    .example-btn {
        font-size: 0.8rem;
        padding: 1rem 1.25rem;
    }
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
    .quick-examples {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        max-width: 750px;
    }
    
    .example-btn {
        padding: 1rem 1.25rem;
        font-size: 0.8rem;
    }
}

/* Enhanced Chat Input Area with blue theme */
.chat-input-container {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(0, 131, 241, 0.01) 100%);
    border-top: 1px solid rgba(0, 131, 241, 0.15);
    padding: 1.5rem;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 131, 241, 0.08);
    overflow: visible !important;
    z-index: 100 !important;
}

.dark .chat-input-container {
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(0, 131, 241, 0.02) 100%);
    border-top-color: rgba(0, 131, 241, 0.25);
    box-shadow: 0 -2px 8px rgba(0, 131, 241, 0.12);
}

/* Modern Input Container - REFINED */
.modern-input-container {
    max-width: 900px;
    margin: 0 auto !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    overflow: visible !important;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02) !important;
}

.modern-input-container:hover {
    border-color: #cbd5e1 !important;
}

.modern-input-container:focus-within {
    border-color: #0066cc !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1), 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02) !important;
}

.dark .modern-input-container {
    background: var(--bg-secondary) !important;
    border-color: rgba(51, 65, 85, 0.5) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

.dark .modern-input-container:hover {
    border-color: rgba(71, 85, 105, 0.7) !important;
}

.dark .modern-input-container:focus-within {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15), 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

/* Input Main Area */
.input-main-area {
    padding: 0 !important;
    margin: 0 !important;
}

.input-main-area textarea {
    width: 100% !important;
    min-height: 54px !important;
    max-height: 200px !important;
    padding: 16px 18px !important;
    border: none !important;
    background: transparent !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    color: #1e293b !important;
    font-family: 'Inter', sans-serif !important;
    resize: none !important;
}

.input-main-area textarea:focus {
    outline: none !important;
    box-shadow: none !important;
}

.input-main-area textarea::placeholder {
    color: #94a3b8 !important;
}

.dark .input-main-area textarea {
    color: var(--text-primary) !important;
}

.dark .input-main-area textarea::placeholder {
    color: var(--text-tertiary) !important;
}

/* Input Footer Bar */
.input-footer-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    margin: 0 !important;
    position: relative !important;
    overflow: visible !important;
    z-index: 10 !important;
}

.dark .input-footer-bar {
    background: rgba(255, 255, 255, 0.03) !important;
    border-top-color: var(--border-primary) !important;
}

.char-count-text {
    font-size: 12px !important;
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

.footer-right-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    position: relative !important;
    z-index: 10001 !important;
}

/* Mode Selector */
.mode-selector-compact {
    position: relative !important;
    z-index: 10001 !important;
}

.mode-btn {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 7px 12px !important;
    background: transparent !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    height: 34px !important;
}

.mode-btn:hover {
    background: #f1f5f9 !important;
}

.mode-btn i:first-child {
    font-size: 13px !important;
    color: #0083f1 !important;
}

.mode-btn i:last-child {
    font-size: 10px !important;
    color: #94a3b8 !important;
    transition: transform 0.2s !important;
}

.mode-btn[aria-expanded="true"] i:last-child {
    transform: rotate(180deg) !important;
}

.dark .mode-btn {
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* Mode Menu */
.mode-menu {
    position: absolute !important;
    bottom: calc(100% + 10px) !important;
    right: 0 !important;
    width: fit-content !important;
    background: #ffffff !important;
    border: 2px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1) !important;
    padding: 8px !important;
    display: none !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
}

.mode-menu.show {
    display: block !important;
    animation: popUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dark .mode-menu {
    background: #1e293b !important;
    border-color: #475569 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

/* Mode Items */
.mode-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    background: transparent !important;
    margin-bottom: 4px !important;
    white-space: nowrap !important;
}

.mode-item:last-child {
    margin-bottom: 0 !important;
}

.mode-item:hover {
    background: #f1f5f9 !important;
    transform: translateX(2px) !important;
}

.dark .mode-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}

.mode-item.active {
    background: #e0f2fe !important;
    border: 1px solid #0083f1 !important;
}

.dark .mode-item.active {
    background: rgba(0, 131, 241, 0.2) !important;
    border-color: #0083f1 !important;
}

.mode-item > i:first-child {
    font-size: 14px !important;
    color: #0083f1 !important;
    width: 20px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
}

.mode-info {
    flex: 1 !important;
    min-width: 0 !important;
}

.mode-name {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    margin-bottom: 2px !important;
    line-height: 1.2 !important;
}

.mode-hint {
    font-size: 10px !important;
    color: #64748b !important;
    line-height: 1.3 !important;
}

.dark .mode-name {
    color: #f1f5f9 !important;
}

.dark .mode-hint {
    color: #94a3b8 !important;
}

.mode-check {
    display: none !important;
    color: #0083f1 !important;
    font-size: 12px !important;
    flex-shrink: 0 !important;
    font-weight: bold !important;
}

.mode-item.active .mode-check {
    display: block !important;
}

/* Disabled Mode Item */
.mode-item.mode-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

.mode-item.mode-disabled > i:first-child {
    color: #94a3b8 !important;
}

.mode-item.mode-disabled:hover {
    background: transparent !important;
    transform: none !important;
}

/* Send Button */
.send-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    background: #0083f1 !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    padding: 0 !important;
    margin: 0 !important;
}

.send-btn:hover:not(:disabled) {
    background: #0070d8 !important;
    transform: translateY(-1px) !important;
}

.send-btn:active:not(:disabled) {
    transform: translateY(0) !important;
}

.send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.send-btn i {
    font-size: 13px !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modern-input-container {
        border-radius: 12px;
    }
    
    .input-main-area textarea {
        min-height: 48px;
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .input-footer-bar {
        padding: 8px 12px;
    }
    
    .char-count-text {
        font-size: 11px;
    }
    
    .mode-btn {
        padding: 6px 10px;
        font-size: 12px;
        height: 32px;
        gap: 5px;
    }
    
    .mode-btn i:first-child {
        font-size: 12px;
    }
    
    .mode-btn i:last-child {
        font-size: 9px;
    }
    
    .send-btn {
        width: 32px;
        height: 32px;
    }
    
    .send-btn i {
        font-size: 12px;
    }
    
    .mode-menu {
        width: fit-content !important;
        border-width: 1.5px !important;
    }
    
    .mode-item {
        padding: 10px 18px !important;
        gap: 12px !important;
    }
    
    .mode-item > i:first-child {
        font-size: 13px !important;
        width: 18px !important;
    }
    
    .mode-name {
        font-size: 12px !important;
    }
    
    .mode-hint {
        font-size: 10px !important;
    }
    
    .mode-check {
        font-size: 12px !important;
    }
}

.dark .character-counter.warning {
    color: #fbbf24;
}

.dark .character-counter.error {
    color: #f87171;
}

#sendChatButton {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-button {
    background: var(--accent-primary) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0, 112, 216, 0.2) !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10 !important;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 112, 216, 0.3);
}

.send-button:active {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: var(--text-tertiary);
}

.stop-button {
    background: #dc2626 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2) !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 10 !important;
}

.stop-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
    background: #b91c1c;
}

.stop-button:active {
    transform: translateY(0);
}

.stop-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: var(--text-tertiary);
}

/* Cancelled message styling */
.chat-message.assistant.cancelled .chat-bubble {
    background: rgba(220, 38, 38, 0.1);
    border-left: 3px solid #dc2626;
    color: #dc2626;
    font-style: italic;
}

/* Quick Action Buttons */
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 112, 216, 0.1);
    border: 1px solid rgba(0, 112, 216, 0.2);
    border-radius: 1rem;
    color: var(--accent-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    margin: 0.25rem;
}

.quick-action-btn:hover {
    background: rgba(0, 112, 216, 0.15);
    border-color: rgba(0, 112, 216, 0.3);
    color: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 112, 216, 0.15);
}

.dark .quick-action-btn {
    background: rgba(0, 112, 216, 0.15);
    border-color: rgba(0, 112, 216, 0.3);
    color: #60a5fa;
}

.dark .quick-action-btn:hover {
    background: rgba(0, 112, 216, 0.25);
    border-color: rgba(0, 112, 216, 0.4);
    color: #93c5fd;
}

/* Chat Loading States */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.75rem;
}

.typing-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-ring {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.typing-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.8;
    transition: opacity 0.3s ease-in-out;
    min-width: 200px;
}

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

/* Legacy typing dots (kept for backward compatibility) */
.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: typing 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 {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Message Timestamps */
.chat-timestamp {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
    text-align: right;
    font-weight: 400;
}

.chat-message.user .chat-timestamp {
    text-align: left;
}

/* Chat Error States */
.chat-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.chat-error::before {
    content: '⚠️';
    font-size: 1.25rem;
}

.dark .chat-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* Chat Welcome Message */
.chat-welcome {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.chat-welcome h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.chat-welcome p {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.chat-welcome .welcome-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

/* Chat Export Modal */
.chat-export-modal {
    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;
}

.chat-export-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.dark .chat-export-content {
    background: #1e293b;
    color: #f1f5f9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-bubble {
        max-width: 90%;
    }
    
    .quick-action-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        margin: 0.125rem;
    }
    
    #chatInput {
        font-size: 1rem; /* Prevent zoom on iOS */
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .chat-header h2 {
        font-size: 1.25rem;
    }
    
    #chatMessages {
        padding: 0; /* Consistent with desktop - messages handle spacing */
    }
    
    /* Mobile responsive chat content */
    .chat-content {
        padding: 0 1rem; /* Reduced padding for mobile */
        gap: 0.75rem;
    }
    
    .chat-message {
        padding: 1.5rem 0; /* Reduced padding for mobile */
    }
    
    .chat-avatar {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }
    
    /* Keep reasoning steps uniform with desktop */
    .reasoning-step {
        padding: 0.625rem 0.75rem;
        border-radius: 0.5rem;
        line-height: 1.65;
        font-size: inherit;
    }
    
    .reasoning-trace-container {
        margin-bottom: 1rem;
    }
    
    .reasoning-trace-header {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .reasoning-trace-content {
        padding-left: 1rem;
    }
}

/* Professional Chat Enhancements */
.chat-bubble ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chat-bubble li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.chat-bubble p {
    margin-bottom: 0.75rem;
}

.chat-bubble p:last-child {
    margin-bottom: 0;
}

.chat-bubble .font-medium {
    font-weight: 600;
    color: var(--text-primary);
}

.chat-bubble .mb-2 {
    margin-bottom: 0.5rem;
}

.chat-bubble .mb-3 {
    margin-bottom: 0.75rem;
}

.chat-bubble .space-y-1 > * + * {
    margin-top: 0.25rem;
}

/* Markdown Content Styling */
.chat-bubble .markdown-content {
    line-height: 1.6;
    color: inherit;
}

.chat-bubble .markdown-content h1,
.chat-bubble .markdown-content h2,
.chat-bubble .markdown-content h3,
.chat-bubble .markdown-content h4,
.chat-bubble .markdown-content h5,
.chat-bubble .markdown-content h6 {
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: inherit;
}

.chat-bubble .markdown-content h1 { font-size: 1.5rem; }
.chat-bubble .markdown-content h2 { font-size: 1.25rem; }
.chat-bubble .markdown-content h3 { font-size: 1.125rem; }
.chat-bubble .markdown-content h4 { font-size: 1rem; }
.chat-bubble .markdown-content h5 { font-size: 0.875rem; }
.chat-bubble .markdown-content h6 { font-size: 0.75rem; }

.chat-bubble .markdown-content p {
    margin-bottom: 0.75rem;
}

.chat-bubble .markdown-content p:last-child {
    margin-bottom: 0;
}

.chat-bubble .markdown-content ul,
.chat-bubble .markdown-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.chat-bubble .markdown-content li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.chat-bubble .markdown-content blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: var(--text-secondary);
    background: rgba(0, 112, 216, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
}

.chat-bubble .markdown-content code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875em;
    color: var(--accent-primary);
    border: 1px solid var(--border-primary);
}

.chat-bubble .markdown-content pre {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-primary);
}

.chat-bubble .markdown-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chat-bubble .markdown-content strong {
    font-weight: 600;
    color: inherit;
}

.chat-bubble .markdown-content em {
    font-style: italic;
}

.chat-bubble .markdown-content a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-decoration-color: rgba(0, 112, 216, 0.3);
}

.chat-bubble .markdown-content a:hover {
    color: var(--accent-primary-hover);
    text-decoration-color: var(--accent-primary-hover);
}

.chat-bubble .markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
}

.chat-bubble .markdown-content th,
.chat-bubble .markdown-content td {
    border: 1px solid var(--border-primary);
    padding: 0.5rem;
    text-align: left;
}

.chat-bubble .markdown-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.chat-bubble .markdown-content tr:nth-child(even) {
    background: var(--bg-secondary);
}

.chat-bubble .markdown-content hr {
    border: none;
    border-top: 1px solid var(--border-primary);
    margin: 1.5rem 0;
}

/* Dark mode adjustments for markdown */
.dark .chat-bubble .markdown-content blockquote {
    background: rgba(0, 112, 216, 0.1);
    color: var(--text-secondary);
}

.dark .chat-bubble .markdown-content code {
    background: var(--bg-tertiary);
    color: #60a5fa;
}

.dark .chat-bubble .markdown-content pre {
    background: var(--bg-tertiary);
}

.dark .chat-bubble .markdown-content th {
    background: var(--bg-tertiary);
}

.dark .chat-bubble .markdown-content tr:nth-child(even) {
    background: var(--bg-secondary);
}

/* Financial data specific markdown styling */
.chat-bubble .markdown-content .financial-table {
    font-size: 0.8rem;
    margin: 1rem 0;
}

.chat-bubble .markdown-content .financial-table th {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    text-align: center;
}

.chat-bubble .markdown-content .financial-table td {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

.chat-bubble .markdown-content .financial-table td:first-child {
    text-align: left;
    font-weight: 500;
}

/* Code highlighting for financial metrics */
.chat-bubble .markdown-content .metric {
    background: rgba(0, 112, 216, 0.1);
    color: var(--accent-primary);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.dark .chat-bubble .markdown-content .metric {
    background: rgba(0, 112, 216, 0.2);
    color: #60a5fa;
}

/* Responsive markdown tables */
@media (max-width: 768px) {
    .chat-bubble .markdown-content table {
        font-size: 0.75rem;
    }
    
    .chat-bubble .markdown-content th,
    .chat-bubble .markdown-content td {
        padding: 0.25rem;
    }
    
    .chat-bubble .markdown-content pre {
        font-size: 0.75rem;
        padding: 0.75rem;
    }
}

/* ================================================
 * CHAT HISTORY MODAL STYLING
 * ================================================ */

/* Chat History Modal Container */
#chatHistoryModal {
    backdrop-filter: blur(8px);
}

#chatHistoryModal .card {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Chat History List Container */
#chatHistoryList {
    background: var(--bg-primary);
}

/* Individual Chat Conversation Items */
.chat-conversation-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.chat-conversation-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 112, 216, 0.1);
}

.chat-conversation-item:active {
    transform: translateY(0);
}

/* Conversation Header */
.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.conversation-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    word-break: break-word;
}

.conversation-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    background: var(--bg-tertiary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-primary);
}

/* Conversation Meta */
.conversation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.conversation-created {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.conversation-created::before {
    content: '📅';
    font-size: 0.875rem;
}

/* Chat Statistics Modal Styling */
.conversation-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.conversation-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.conversation-preview {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Dark mode adjustments */
.dark .chat-conversation-item {
    background: var(--bg-tertiary);
}

.dark .chat-conversation-item:hover {
    background: var(--bg-secondary);
}

.dark .conversation-date {
    background: var(--bg-primary);
}

/* ================================================
 * TRANSCRIPT MODAL STYLING (Professional Design)
 * ================================================ */

/* Transcript Modal - Ensure highest z-index and proper stacking */
#transcriptModal {
    z-index: 2147483647 !important; /* Maximum possible z-index */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    isolation: isolate !important;
    overflow: visible !important;
}

#transcriptModal > .card,
#transcriptModal > div:not(.fixed) {
    z-index: 2147483647 !important;
    position: relative !important;
    max-height: 90vh !important;
    overflow: auto !important;
}

/* Chat Reasoning Steps */
.reasoning-step {
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.25s ease;
    animation: fadeInUp 0.35s ease-out;
    line-height: 1.65;
}

.reasoning-step.active {
    background: rgba(59, 130, 246, 0.03);
}

.reasoning-step.completed {
    background: transparent;
}

.reasoning-step.failed {
    background: rgba(239, 68, 68, 0.03);
}

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

/* Reasoning Trace Container in Message */
.reasoning-trace-container {
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.reasoning-trace-header {
    transition: all 0.2s ease;
}

.reasoning-trace-header:hover {
    transform: translateX(2px);
}

.reasoning-trace-container.collapsed .toggle-icon {
    transform: rotate(-90deg);
    transition: transform 0.3s ease;
}

.reasoning-trace-container:not(.collapsed) .toggle-icon {
    transform: rotate(0deg);
    transition: transform 0.3s ease;
}

.reasoning-trace-container:not(.collapsed) .reasoning-trace-content {
    display: block !important;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* Chat Progress Steps (fallback) */
.chat-progress-steps {
    margin: 1rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.progress-step {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.progress-step:last-child {
    margin-bottom: 0;
}

.progress-step.active {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.progress-step.completed {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid #22c55e;
}

.progress-step-icon {
    font-size: 1.25rem;
    color: #3b82f6;
    min-width: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-step.completed .progress-step-icon {
    color: #22c55e;
}

.progress-step-content {
    flex: 1;
}

.progress-step-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.progress-step-details {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.4;
}

/* Dark mode support for progress steps */
.dark-mode .chat-progress-steps {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.2);
}

.dark-mode .progress-step {
    background: rgba(30, 41, 59, 0.5);
}

.dark-mode .progress-step.active {
    background: rgba(59, 130, 246, 0.15);
}

.dark-mode .progress-step.completed {
    background: rgba(34, 197, 94, 0.15);
}

.dark-mode .progress-step-title {
    color: #e2e8f0;
}

.dark-mode .progress-step-details {
    color: #94a3b8;
}

/* Professional transcript modal styling - using Tailwind classes */
.card {
    background: var(--bg-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);
    border: 1px solid var(--border-primary);
}

/* Transcript text styling */
.prose {
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
}

.prose-sm {
    font-size: 0.875rem;
}

.prose .whitespace-pre-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Highlighted text in transcripts */
.transcript-text mark {
    background: rgba(0, 112, 216, 0.15);
    color: var(--text-primary);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 500;
}

.dark .transcript-text mark {
    background: rgba(0, 112, 216, 0.25);
}

/* ================================================
 * HIGHLIGHTED CHUNKS STYLING
 * ================================================ */

/* Professional highlighting for relevant chunks */
.highlighted-chunk {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.15) 0%, rgba(0, 92, 182, 0.1) 100%);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid rgba(0, 112, 216, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    margin: 0.125rem 0.125rem;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 112, 216, 0.1);
}

/* Hover effect for highlighted chunks */
.highlighted-chunk:hover {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.25) 0%, rgba(0, 92, 182, 0.2) 100%);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 112, 216, 0.2);
    z-index: 10;
}

/* Active/clicked state */
.highlighted-chunk:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 112, 216, 0.3);
}

/* Dark mode adjustments */
.dark .highlighted-chunk {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.25) 0%, rgba(0, 92, 182, 0.15) 100%);
    border-color: rgba(0, 112, 216, 0.3);
    color: var(--text-primary);
}

.dark .highlighted-chunk:hover {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.35) 0%, rgba(0, 92, 182, 0.25) 100%);
    border-color: var(--accent-primary);
}

/* Different colors for different chunk types (if needed) */
.highlighted-chunk.chunk-0 { border-left: 3px solid var(--accent-primary); }
.highlighted-chunk.chunk-1 { border-left: 3px solid var(--accent-primary-hover); }
.highlighted-chunk.chunk-2 { border-left: 3px solid #004a8a; }
.highlighted-chunk.chunk-3 { border-left: 3px solid #1e40af; }
.highlighted-chunk.chunk-4 { border-left: 3px solid #3730a3; }

/* Animation for highlighting appearance */
@keyframes highlightAppear {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.highlighted-chunk {
    animation: highlightAppear 0.3s ease-out;
}

/* Focus state for accessibility */
.highlighted-chunk:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Chunk tooltip styling */
.chunk-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    animation: tooltipAppear 0.2s ease-out;
}

.chunk-tooltip-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 0;
    max-width: 300px;
    font-size: 0.875rem;
    overflow: hidden;
}

.chunk-tooltip-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.chunk-tooltip-header i {
    font-size: 1rem;
}

.chunk-tooltip-body {
    padding: 1rem;
    color: var(--text-primary);
}

.chunk-tooltip-body p {
    margin: 0.5rem 0;
    line-height: 1.4;
}

.chunk-tooltip-body p:first-child {
    margin-top: 0;
}

.chunk-tooltip-body p:last-child {
    margin-bottom: 0;
}

.chunk-tooltip-body strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Dark mode for tooltip */
.dark .chunk-tooltip-content {
    background: var(--bg-primary);
    border-color: var(--border-primary);
}

.dark .chunk-tooltip-body {
    color: var(--text-primary);
}

/* Tooltip animation */
@keyframes tooltipAppear {
    0% {
        opacity: 0;
        transform: translateY(-5px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}



/* Transcript scrollbar */
.transcript-text::-webkit-scrollbar {
    width: 8px;
}

.transcript-text::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.transcript-text::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

.transcript-text::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Transcript Modal Footer */
.transcript-modal-footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
    padding: 1.5rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Dark mode adjustments */
.dark .transcript-modal {
    background: var(--bg-primary);
}

.dark .transcript-modal-content {
    background: var(--bg-secondary);
}

.dark .transcript-text {
    background: var(--bg-primary);
}

/* ================================================
 * CITATION STYLING IN CHAT
 * ================================================ */

/* Enhanced Prominent Citations Container */
.citations-container {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.04) 0%, rgba(16, 185, 129, 0.02) 100%);
    border: 1px solid rgba(0, 112, 216, 0.12);
    border-radius: 12px;
    position: relative;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.citations-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
    border-radius: 12px 12px 0 0;
}

.citations-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.citations-header i {
    color: var(--accent-primary);
    font-size: 1.125rem;
    background: rgba(0, 112, 216, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
}

.dark .citations-container {
    background: linear-gradient(135deg, rgba(0, 112, 216, 0.08) 0%, rgba(16, 185, 129, 0.04) 100%);
    border-color: rgba(0, 112, 216, 0.2);
}

/* Enhanced Individual Citation */
.citation {
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
}

.citation::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-primary-hover) 100%);
}

.citation:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 24px rgba(0, 112, 216, 0.15);
    transform: translateY(-2px);
}

.citation:hover::before {
    width: 6px;
}

/* Enhanced Citation Header */
.citation-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.citation-header:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.citation-info {
    flex: 1;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.citation-company {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.citation-company::before {
    content: '🏢';
    font-size: 0.875rem;
}

.citation-source {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: rgba(0, 112, 216, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.citation-toggle {
    color: var(--accent-primary);
    transition: all 0.3s ease;
    background: rgba(0, 112, 216, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 1rem;
}

.citation-toggle:hover {
    background: rgba(0, 112, 216, 0.15);
    transform: scale(1.1);
}

.citation.expanded .citation-toggle {
    transform: rotate(180deg) scale(1.1);
    background: var(--accent-primary);
    color: white;
}

/* Citation Content */
.citation-content {
    display: none;
    padding: 1rem;
    background: var(--bg-primary);
}

.citation.expanded .citation-content {
    display: block;
}

/* Citation Actions */
.citation-actions {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.citation-expand-btn {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.citation-expand-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 112, 216, 0.3);
}

.citation-preview {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(0, 112, 216, 0.02) 100%);
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
    border: 1px solid rgba(0, 112, 216, 0.1);
    position: relative;
    font-style: italic;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.citation-preview::before {
    content: '"';
    position: absolute;
    top: 0.5rem;
    left: 0.75rem;
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.3;
    font-family: serif;
}

.citation-preview::after {
    content: '"';
    position: absolute;
    bottom: 0.25rem;
    right: 0.75rem;
    font-size: 2rem;
    color: var(--accent-primary);
    opacity: 0.3;
    font-family: serif;
}

/* View Transcript Button */
.view-transcript-btn {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.view-transcript-btn:hover {
    background: linear-gradient(135deg, var(--accent-primary-hover) 0%, #004a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 112, 216, 0.2);
}

.view-transcript-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dark mode adjustments for citations */
.dark .citation {
    background: var(--bg-secondary);
}

.dark .citation-header {
    background: var(--bg-tertiary);
}

.dark .citation-content {
    background: var(--bg-primary);
}

.dark .citation-preview {
    background: var(--bg-tertiary);
}

/* ================================================
 * WEB SOURCES (NEWS CITATIONS) STYLING
 * ================================================ */

/* News citation container with distinctive green accent */
.citation.news-citation {
    background: var(--bg-primary);
    border: 2px solid rgba(16, 185, 129, 0.15);
    position: relative;
}

.citation.news-citation::before {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.citation.news-citation:hover {
    border-color: #10b981;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15);
}

/* News citation header with green accent */
.citation.news-citation .citation-header {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.04) 0%, rgba(16, 185, 129, 0.02) 100%);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
}

.citation.news-citation .citation-header:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.04) 100%);
}

/* Citation marker badge */
.citation-marker {
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Citation title */
.citation-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.4;
    flex: 1;
}

/* Published date badge */
.citation-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-primary);
    white-space: nowrap;
    font-weight: 500;
}

/* Citation URL display */
.citation-url {
    padding: 0.75rem 1.25rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

.citation-url a {
    color: #10b981;
    text-decoration: none;
    font-size: 0.75rem;
    word-break: break-all;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.citation-url a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* View article button */
.view-article-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.view-article-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.view-article-btn i {
    font-size: 0.75rem;
}

/* Citations section header for web sources */
.citations-section-header {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dark mode adjustments for news citations */
.dark .citation.news-citation {
    background: var(--bg-secondary);
    border-color: rgba(16, 185, 129, 0.2);
}

.dark .citation.news-citation:hover {
    border-color: #10b981;
}

.dark .citation-marker {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.dark .citation-url {
    background: rgba(0, 0, 0, 0.2);
}

.dark .citation-url a {
    color: #34d399;
}

/* ================================================
 * PROFESSIONAL QUERY CATEGORIES - CLEAN & MINIMAL
 * ================================================ */

/* Screener Categories Container */
.screener-categories {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-primary);
    padding: 2rem;
}

/* Individual Category Cards */
.category-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    overflow: hidden;
}

/* Category Header */
.category-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-primary);
}

/* Category Title and Subtitle */
.category-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.category-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Query Buttons Container */
.category-queries {
    padding: 0;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
}

/* Individual Query Buttons */
.query-suggestion-btn {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-primary);
    padding: 1rem 2rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
}

.query-suggestion-btn:last-child {
    border-bottom: none;
}

.query-suggestion-btn:hover {
    background: var(--bg-tertiary);
}

/* Query Text */
.query-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Query Arrow */
.query-suggestion-btn i.fa-arrow-right {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.query-suggestion-btn:hover i.fa-arrow-right {
    opacity: 1;
}

/* ================================================
 * NAVBAR CHAT CONTROLS STYLING
 * ================================================ */

/* Chat Navigation Controls Container */
.chat-nav-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Individual Chat Navigation Buttons */
.nav-chat-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-chat-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Primary Chat Button (New Chat) */
.nav-chat-btn.primary {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.nav-chat-btn.primary:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
}

/* Chat Button Icons */
.nav-chat-btn i {
    font-size: 0.875rem;
    opacity: 0.9;
}

.nav-chat-btn:hover i {
    opacity: 1;
}

/* Mobile responsive for chat nav buttons */
@media (max-width: 640px) {
    .nav-chat-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .nav-chat-btn i {
        font-size: 0.8rem;
    }
}

/* ================================================
 * RESPONSIVE STYLING FOR CHAT MODALS
 * ================================================ */

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    /* Professional Query Categories on Mobile */
    .screener-categories {
        padding: 1rem;
    }
    
    .screener-categories .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-header {
        padding: 1rem 1.5rem;
    }
    
    .category-title {
        font-size: 0.9rem;
    }
    
    .category-subtitle {
        font-size: 0.8rem;
    }
    
    .query-suggestion-btn {
        padding: 0.875rem 1.5rem;
    }
    
    .query-text {
        font-size: 0.85rem;
    }

    /* Chat History Modal */
    #chatHistoryModal .card {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
        height: calc(100vh - 1rem);
    }
    
    .chat-conversation-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .conversation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .conversation-date {
        align-self: flex-end;
    }
    
    .transcript-meta {
        padding: 0.75rem 1rem;
        gap: 1rem;
    }
    
    /* Transcript Modal */
    .transcript-modal-overlay {
        padding: 0.5rem;
    }
    
    .transcript-modal {
        max-width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
    }
    
    .transcript-modal-header {
        padding: 1rem 1.5rem;
    }
    
    .transcript-modal-header h3 {
        font-size: 1.125rem;
    }
    
    .transcript-text {
        padding: 1.5rem;
        font-size: 0.875rem;
    }
    
    .transcript-modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }
    
    .transcript-modal-footer .btn {
        width: 100%;
    }
    
    /* Citations */
    .citation-header {
        padding: 0.625rem 0.75rem;
    }
    
    .citation-content {
        padding: 0.75rem;
    }
    
    .citation-preview {
        padding: 0.625rem;
        font-size: 0.8125rem;
    }
    
    .view-transcript-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .conversation-title {
        font-size: 0.9rem;
    }
    
    .transcript-modal-header h3 {
        font-size: 1rem;
    }
    
    .transcript-text {
        padding: 1rem;
        font-size: 0.8125rem;
        line-height: 1.6;
    }
    
    .citation-company {
        font-size: 0.8125rem;
    }
    
    .citation-source {
        font-size: 0.6875rem;
    }
}

/* Chat Message Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.chat-message {
    animation: slideInUp 0.4s ease-out forwards;
}

/* Token Streaming - Typing Cursor */
.typing-cursor {
    display: inline-block;
    margin-left: 2px;
    animation: blink 1s infinite;
    color: var(--accent-primary);
    font-weight: bold;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

.typing-indicator .chat-avatar {
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    color: white;
    border: 2px solid rgba(99, 102, 241, 0.2);
}

.typing-indicator .typing-bubble {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 1.25rem;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dark .typing-indicator .typing-bubble {
    background: #1f2937;
    border-color: #374151;
}

/* Chat Input Character Count */
#chatCharCount {
    transition: color 0.2s ease-in-out;
}

#chatCharCount.warning {
    color: #f59e0b;
}

#chatCharCount.error {
    color: #ef4444;
}

/* ================================================
 * AGENTIC MODE ITERATION STYLING
 * ================================================ */

/* Iteration Section Container */
.iteration-section {
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.iteration-section:hover {
    background-color: rgba(147, 51, 234, 0.02);
    border-radius: 0.5rem;
    margin-left: -0.5rem;
    padding-left: 0.5rem;
}

.dark .iteration-section:hover {
    background-color: rgba(147, 51, 234, 0.05);
}

/* Iteration Steps Container */
.iteration-steps {
    padding-left: 0.5rem;
    margin-top: 0.5rem;
}

.iteration-steps > div {
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease;
}

.iteration-steps > div:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark .iteration-steps > div:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Iteration Icons */
.iteration-section .fa-brain {
    font-size: 0.875rem;
}

.iteration-section .fa-question-circle,
.iteration-section .fa-search {
    font-size: 0.875rem;
}

/* Strengths and Weaknesses Lists */
.iteration-section ul {
    margin-top: 0.25rem;
}

.iteration-section li {
    margin-bottom: 0.125rem;
    line-height: 1.4;
}

/* Follow-up Question Styling */
.iteration-section .italic {
    font-style: italic;
    padding: 0.5rem;
    background-color: rgba(59, 130, 246, 0.05);
    border-radius: 0.375rem;
    border-left: 2px solid #3b82f6;
}

.dark .iteration-section .italic {
    background-color: rgba(59, 130, 246, 0.1);
}

/* Purple Theme for Iterations */
.iteration-section .bg-purple-100 {
    transition: all 0.3s ease;
}

.iteration-section.completed .bg-purple-100 {
    background-color: rgba(147, 51, 234, 0.15) !important;
}

/* Animate iteration appearance */
.iteration-section {
    animation: slideInFromRight 0.4s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}