/* Enhanced NeuralChat Styles - Complete CSS File */

/* Root Variables - Enhanced Theme */
:root {
    /* Primary Color Scheme */
    --primary-bg: #0a0e1a;
    --secondary-bg: #1a2332;
    --card-bg: #243447;
    --accent-color: #43cea2;
    --accent-hover: #359f84;
    
    /* Text Colors */
    --text-color: #e8f4f8;
    --text-secondary: #b0c4de;
    --text-muted: #8fa3b8;
    
    /* UI Colors */
    --border-color: #3a4f66;
    --border-light: #4a5f76;
    --button-hover-bg: #2b3b4f;
    --message-bg: #2a3f56;
    
    /* Glass Effects */
    --glass-bg: rgba(67, 206, 162, 0.08);
    --glass-border: rgba(67, 206, 162, 0.2);
    
    /* Status Colors */
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    /* Model-specific Colors */
    --grok1-bg: #2d5a3d;
    --grok2-bg: #3d4a5a;
    --claude-bg: #4a2d5a;
    --chatgpt-bg: #2d4a5a;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.3);
}

/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, var(--primary-bg) 0%, #0f1419 50%, var(--primary-bg) 100%);
    background-attachment: fixed;
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Loading and Animations */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-bg), #0f1419);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.6s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    filter: drop-shadow(0 0 20px rgba(67, 206, 162, 0.3));
}

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

.content-container {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.content-container.loaded {
    opacity: 1;
}

/* Header Styles */
.site-header {
    text-align: center;
    padding: 40px 20px 30px 20px;
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.1) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(67, 206, 162, 0.05) 50%, 
        transparent 70%);
    animation: shimmer 8s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.site-header h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-color), #6ee7b7, var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 8px rgba(67, 206, 162, 0.3));
    letter-spacing: -0.02em;
}

.site-header p {
    position: relative;
    z-index: 1;
    margin: 15px 0 0;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Container Styles */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px 20px 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 25px;
    min-height: 0;
}

.card {
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 900px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--accent-color), 
        transparent);
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 900px;
    padding: 8px;
}

.mode-button {
    position: relative;
    padding: 25px 20px;
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    font-size: 15px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
}

.mode-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(67, 206, 162, 0.1), 
        transparent);
    transition: left 0.6s ease;
}

.mode-button:hover::before {
    left: 100%;
}

.mode-button:hover {
    border-color: var(--accent-color);
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--button-hover-bg), var(--card-bg));
}

.mode-button.active {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.4);
}

.mode-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.mode-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.mode-description {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
    max-width: 240px;
}

/* Output Selector */
.output-selector {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-sm);
}

.output-button {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    color: var(--text-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 13px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.output-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.output-button:hover::before {
    opacity: 0.1;
}

.output-button.active::before {
    opacity: 1;
}

.output-button:hover {
    transform: scale(1.05);
    color: var(--accent-color);
}

.output-button.active {
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(67, 206, 162, 0.3);
}

.output-button span {
    position: relative;
    z-index: 1;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 0.9rem;
    width: 100%;
    max-width: 900px;
    box-shadow: var(--shadow-sm);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* Progress Container */
.progress-container {
    display: none;
    width: 100%;
    max-width: 900px;
    animation: fadeIn 0.4s ease-out;
}

.progress-container.active {
    display: block;
}

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

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success-color));
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Research Controls */
.research-controls {
    display: none;
    animation: slideIn 0.4s ease-out;
}

.research-controls.active {
    display: block;
}

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

.research-controls h3 {
    margin: 0 0 25px 0;
    color: var(--accent-color);
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* UPDATED FILE UPLOAD STYLES - Replace the existing file upload section */

/* File Upload - ENHANCED WITH FIXES */
.file-upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    margin-bottom: 25px;
    transition: all 0.4s ease;
    cursor: pointer;
    position: relative;
    background: linear-gradient(135deg, 
        rgba(67, 206, 162, 0.02), 
        rgba(67, 206, 162, 0.05));
    backdrop-filter: blur(10px);
    /* CRITICAL FIXES */
    user-select: none; /* Prevent text selection during drag/drop */
}

.file-upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(67, 206, 162, 0.1) 50%, 
        transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.file-upload-area:hover::before {
    opacity: 1;
}

.file-upload-area:hover {
    border-color: var(--accent-color);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(67, 206, 162, 0.15);
    /* ENHANCED HOVER STATE */
    background: rgba(67, 206, 162, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--success-color);
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.1), 
        rgba(16, 185, 129, 0.05));
    transform: scale(1.02);
    box-shadow: 0 16px 48px rgba(16, 185, 129, 0.2);
}

/* ENHANCED DRAG OVER STATE */
.file-upload-area.dragover .upload-icon {
    transform: scale(1.2);
    filter: brightness(1.2);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(67, 206, 162, 0.2));
    /* CRITICAL FIX: Prevent click events on icon */
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
}

.file-upload-area p {
    margin: 12px 0;
    font-weight: 600;
    font-size: 1.1rem;
    /* CRITICAL FIX: Prevent click events on descriptive text */
    pointer-events: none;
}

.file-upload-area p:last-child {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 12px;
    font-weight: 400;
    /* CRITICAL FIX: Prevent click events on descriptive text */
    pointer-events: none;
}

/* ENHANCED FILE LIST */
.file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 20px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.1);
    /* CRITICAL FIX: Allow interactions with file list */
    pointer-events: auto;
}

.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

/* ENHANCED FILE ITEM WITH FIXES */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease-out;
    /* CRITICAL FIX: Ensure file items can be interacted with */
    pointer-events: auto;
    position: relative;
}

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

.file-item:hover {
    background: var(--button-hover-bg);
    border-color: var(--accent-color);
    transform: translateX(4px);
}

/* ENHANCED FILE INFO */
.file-info {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

/* ENHANCED FILE REMOVE BUTTON WITH FIXES */
.file-remove {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    /* CRITICAL FIXES */
    pointer-events: auto; /* Ensure remove button works */
    flex-shrink: 0;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.file-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.file-remove:active {
    transform: scale(0.95);
}

.file-remove:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ENHANCED RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .file-upload-area {
        padding: 30px 20px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .file-item {
        padding: 10px 12px;
        margin-bottom: 6px;
        font-size: 12px;
    }
    
    .file-info {
        font-size: 0.85rem;
    }
    
    .file-remove {
        width: 22px;
        height: 22px;
        font-size: 10px;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .file-upload-area {
        padding: 25px 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .file-upload-area p {
        font-size: 1rem;
    }
    
    .file-upload-area p:last-child {
        font-size: 0.8rem;
    }
    
    .file-item {
        padding: 8px 10px;
        flex-direction: row;
        align-items: center;
    }
    
    .file-info {
        font-size: 0.8rem;
        margin-right: 8px;
    }
}

/* ACCESSIBILITY IMPROVEMENTS */
.file-upload-area:focus-within {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.file-item:focus-within {
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
    .file-upload-area {
        border-width: 3px;
    }
    
    .file-item {
        border-width: 2px;
    }
    
    .file-remove {
        border: 2px solid white;
    }
}

/* REDUCED MOTION SUPPORT */
@media (prefers-reduced-motion: reduce) {
    .upload-icon {
        animation: none;
    }
    
    .file-item {
        animation: none;
    }
    
    .file-upload-area,
    .file-item,
    .file-remove {
        transition: none;
    }
}

/* Analysis Type Grid */
.analysis-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 25px;
}

.analysis-option {
    padding: 20px;
    background: linear-gradient(135deg, var(--secondary-bg), var(--card-bg));
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.analysis-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(67, 206, 162, 0.1), 
        transparent);
    transition: left 0.5s ease;
}

.analysis-option:hover::before {
    left: 100%;
}

.analysis-option:hover {
    border-color: var(--accent-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.analysis-option.selected {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, 
        rgba(67, 206, 162, 0.15), 
        rgba(67, 206, 162, 0.1));
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.2);
}

.analysis-option h4 {
    margin: 0 0 12px 0;
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: 700;
}

.analysis-option p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Form Elements */
.chat-form {
    width: 100%;
    max-width: 900px;
}

.input-group {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: stretch;
}

.main-input {
    flex: 1;
    padding: 18px 24px;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.main-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(67, 206, 162, 0.15);
    background: var(--secondary-bg);
    transform: translateY(-2px);
}

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

.submit-btn {
    padding: 18px 32px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(67, 206, 162, 0.3);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.4);
    filter: brightness(1.1);
}

.submit-btn:active {
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-field input,
.form-field select {
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.15);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.checkbox-field input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-color);
}

.reference-url-field {
    margin-top: 16px;
    padding: 20px;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

/* Advanced Controls */
.details-section {
    margin-top: 24px;
}

.details-section summary {
    cursor: pointer;
    color: var(--accent-color);
    font-weight: 700;
    padding: 16px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.details-section summary:hover {
    color: var(--accent-hover);
}

.details-content {
    padding: 24px;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-top: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 16px;
}

/* Enhanced Temperature Slider */
#temperature {
    width: 100%;
    vertical-align: middle;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#temperature:hover {
    opacity: 1;
}

#temperature::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(67, 206, 162, 0.3);
    transition: all 0.3s ease;
}

#temperature::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(67, 206, 162, 0.5);
}

#temperature::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(67, 206, 162, 0.3);
}

#temperatureValue {
    margin-left: 10px;
    font-size: 12px;
    vertical-align: middle;
    color: var(--accent-color);
    font-weight: 600;
}

/* Enhanced Checkboxes */
input[type="checkbox"] {
    margin-right: 8px;
    background-color: var(--secondary-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    position: relative;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.3s ease;
}

input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 2px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

input[type="checkbox"]:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(67, 206, 162, 0.2);
}

/* Enhanced Number Inputs */
#maxMessages {
    width: 80px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--secondary-bg);
    color: var(--text-color);
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

#maxMessages:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}

/* Conversation Area */
.conversation {
    width: 100%;
    max-width: 900px;
    min-height: 400px;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: linear-gradient(135deg, 
        rgba(26, 35, 50, 0.8), 
        rgba(36, 52, 71, 0.6));
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

/* Messages */
.message {
    background: linear-gradient(135deg, var(--message-bg), var(--card-bg));
    border: 1px solid var(--border-color);
    padding: 24px;
    margin: 0;
    border-radius: 16px;
    max-width: 85%;
    font-family: inherit;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    animation: messageSlideIn 0.5s ease-out;
    position: relative;
    overflow: hidden;
    word-wrap: break-word;
    white-space: pre-wrap;
}

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

.message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    border-radius: 16px 16px 0 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
}

.message-content {
    line-height: 1.7;
    font-size: 15px;
}

.message-content h2, 
.message-content h3, 
.message-content h4 {
    color: var(--accent-color);
    margin: 15px 0 10px 0;
}

.message-content ul, 
.message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 5px 0;
}

.message-content strong {
    color: var(--accent-color);
}

.message-content em {
    color: var(--info-color);
}

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

/* Model-specific message styles */
.grok-1, .grok-2 {
    background: linear-gradient(135deg, var(--grok1-bg), var(--message-bg));
    border-left: 4px solid #4caf50;
}

.grok-2 {
    background: linear-gradient(135deg, var(--grok2-bg), var(--message-bg));
}

.claude {
    background: linear-gradient(135deg, var(--claude-bg), var(--message-bg));
    border-left: 4px solid #7b1fa2;
}

.chatgpt {
    background: linear-gradient(135deg, var(--chatgpt-bg), var(--message-bg));
    border-left: 4px solid #1565c0;
}

/* Message Alignment */
.left-aligned {
    align-self: flex-start;
    text-align: left;
}

.right-aligned {
    align-self: flex-end;
    text-align: right;
}

.center-aligned {
    align-self: center;
    text-align: center;
}

/* Special Message Types */
.initial-question {
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    width: 100%;
    color: var(--accent-color);
    background: linear-gradient(135deg, 
        rgba(67, 206, 162, 0.1), 
        rgba(67, 206, 162, 0.05));
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.2);
    animation: questionPulse 2s ease-in-out infinite;
}

@keyframes questionPulse {
    0%, 100% {
        text-shadow: 0 0 5px rgba(67, 206, 162, 0.5);
    }
    50% {
        text-shadow: 0 0 15px rgba(67, 206, 162, 0.8);
    }
}

.final-thoughts {
    align-self: center;
    background: linear-gradient(135deg, var(--secondary-bg), rgba(67, 206, 162, 0.1));
    border: 2px solid var(--accent-color);
    color: var(--text-color);
    font-style: italic;
    text-align: center;
    max-width: 85%;
    margin: 20px auto;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(67, 206, 162, 0.2);
    animation: finalThoughtsGlow 3s ease-in-out infinite alternate;
}

@keyframes finalThoughtsGlow {
    from {
        box-shadow: 0 0 30px rgba(67, 206, 162, 0.2);
    }
    to {
        box-shadow: 0 0 40px rgba(67, 206, 162, 0.4);
    }
}

.final-thoughts::before {
    background: linear-gradient(90deg, var(--accent-color), var(--warning-color), var(--accent-color));
}

/* Image Generation Messages */
.image-generator {
    background: linear-gradient(135deg, var(--secondary-bg), rgba(59, 130, 246, 0.1));
    border: 2px solid var(--info-color);
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: center;
    max-width: 85%;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
    animation: imageGlow 3s ease-in-out infinite alternate;
}

@keyframes imageGlow {
    from {
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
    }
    to {
        box-shadow: 0 0 40px rgba(59, 130, 246, 0.4);
    }
}

.image-generator img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease;
}

.image-generator img:hover {
    transform: scale(1.02);
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    padding: 60px 40px;
    border-radius: 20px;
    background: linear-gradient(135deg, 
        rgba(67, 206, 162, 0.1), 
        rgba(59, 130, 246, 0.05));
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 0 auto;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 24px;
    display: block;
    animation: float 6s ease-in-out infinite;
    filter: drop-shadow(0 8px 16px rgba(67, 206, 162, 0.3));
}

.welcome-section h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 32px;
    text-align: left;
}

.feature-item {
    padding: 20px;
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.feature-item strong {
    color: var(--accent-color);
    font-weight: 700;
}

.performance-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, 
        rgba(67, 206, 162, 0.15), 
        rgba(67, 206, 162, 0.1));
    border: 1px solid rgba(67, 206, 162, 0.3);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 16px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 900px;
}

.action-btn {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.action-btn:hover {
    background: linear-gradient(135deg, var(--button-hover-bg), var(--card-bg));
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-action {
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.quick-action:hover {
    border-color: var(--accent-color);
    background: rgba(67, 206, 162, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* Navigation Bar */
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, 
        rgba(26, 35, 50, 0.95), 
        rgba(36, 52, 71, 0.95));
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
    z-index: 1000;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
}

.footer-nav-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 20px;
    background: transparent;
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.nav-btn:hover {
    background: var(--button-hover-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
    margin: 5px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background-color: var(--button-hover-bg);
    color: var(--accent-color);
    transform: translateY(-2px);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 10001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    word-wrap: break-word;
}

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

.toast.success {
    background: linear-gradient(135deg, var(--success-color), #059669);
}

.toast.error {
    background: linear-gradient(135deg, var(--error-color), #dc2626);
}

.toast.warning {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
}

.toast.info {
    background: linear-gradient(135deg, var(--info-color), #2563eb);
}

/* Modal System */
/* FIXED: Modal CSS with proper animations and positioning */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg, #1a1a1a);
    border: 2px solid var(--border-color, #333);
    border-radius: 16px;
    max-width: 90%;
    max-height: 90%;
    width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

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

.modal-title {
    margin: 0;
    color: var(--text-color, white);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted, #999);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-color, white);
    background: var(--button-hover-bg, rgba(255, 255, 255, 0.1));
}

.modal-body {
    padding: 20px 24px;
    color: var(--text-color, white);
    line-height: 1.6;
    max-height: 60vh;
    overflow-y: auto;
}

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

.modal-footer .futuristic-button {
    min-width: 100px;
    padding: 10px 20px;
    border: 2px solid var(--border-color, #333);
    background: var(--card-bg, #1a1a1a);
    color: var(--text-color, white);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-footer .futuristic-button:hover {
    border-color: var(--accent-color, #43cea2);
    background: var(--button-hover-bg, rgba(67, 206, 162, 0.1));
    transform: translateY(-2px);
}

.modal-footer .futuristic-button.primary {
    background: var(--accent-color, #43cea2);
    color: var(--bg-color, black);
    border-color: var(--accent-color, #43cea2);
}

.modal-footer .futuristic-button.primary:hover {
    background: var(--accent-hover, #39b893);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(67, 206, 162, 0.3);
}

/* Ensure modal container exists */
.modal-overlay-container {
    position: relative;
    z-index: 9999;
}

/* Screen reader only class for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only.focus-visible:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95%;
        margin: 10px;
    }
    
    .modal-header {
        padding: 16px 20px 12px;
    }
    
    .modal-body {
        padding: 16px 20px;
        max-height: 50vh;
    }
    
    .modal-footer {
        padding: 12px 20px 16px;
        flex-direction: column;
    }
    
    .modal-footer .futuristic-button {
        width: 100%;
        min-width: auto;
    }
}

/* Enhanced Button Styles */
.futuristic-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-color), var(--info-color));
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.futuristic-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.futuristic-button:hover::before {
    left: 100%;
}

.futuristic-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    filter: brightness(1.1);
}

.futuristic-button:active {
    transform: translateY(-1px);
}

.futuristic-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.clear-button {
    margin-top: 10px;
    padding: 15px 25px;
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-button:hover {
    background: var(--button-hover-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* History Page Styles */
.container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    align-self: center;
    margin-top: 20px;
    margin-bottom: 120px;
    padding-bottom: 20px;
    box-shadow: var(--shadow-xl);
}

.nav-bar {
    width: 100vw;
    display: flex;
    opacity: 0.95;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    padding: 15px 25px;
    border-radius: 15px 15px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
}

.nav-bar #clearHistory {
    margin-left: auto;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
    table-layout: fixed;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: left;
    color: var(--text-color);
    word-break: break-word;
    vertical-align: top;
}

th {
    background-color: var(--button-hover-bg);
}

/* Error and Status Messages */
.no-history {
    text-align: center;
    margin-top: 20px;
    color: var(--text-color);
}

.error-message {
    color: var(--accent-color);
    text-align: center;
    margin-top: 10px;
}

#historicalConversation {
    width: 100%;
    min-height: 200px;
    overflow-y: auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    word-wrap: break-word;
    box-sizing: border-box;
    display: none;
}

.back-to-history {
    padding: 15px 25px;
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.back-to-history:hover {
    background: var(--button-hover-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

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

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }

.p-0 { padding: 0; }
.p-1 { padding: 5px; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        padding: 0 16px 40px 16px;
    }
    
    .mode-selector {
        grid-template-columns: 1fr;
        max-width: 600px;
    }
    
    .mode-button {
        padding: 20px 16px;
    }
    
    .container, .conversation-parameters {
        width: 95%;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 30px 16px 20px 16px;
    }
    
    .site-header h1 {
        font-size: 2.5rem;
    }
    
    .site-header p {
        font-size: 1em;
    }
    
    .main-container {
        gap: 20px;
        padding: 0 12px 60px 12px;
    }
    
    .card {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .mode-selector {
        gap: 16px;
        max-width: none;
    }
    
    .mode-button {
        padding: 20px 16px;
        font-size: 14px;
    }
    
    .mode-icon {
        font-size: 2rem;
    }
    
    .analysis-type-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .conversation {
        min-height: 300px;
        padding: 20px;
    }

    .message {
        max-width: 95%;
        padding: 20px;
        font-size: 14px;
    }

    .message.final-thoughts {
        max-width: 90%;
        padding: 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .footer-nav-content {
        gap: 12px;
    }

    .nav-btn {
        font-size: 13px;
        padding: 10px 16px;
    }

    .toast {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }

    .container, .conversation-parameters {
        width: 95%;
        margin-bottom: 120px;
        padding: 15px;
    }
    
    .nav-bar {
        width: 100vw;
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 10px;
    }

    .nav-link {
        width: 100%;
        margin: 2px 0;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .site-header h1 {
        font-size: 2rem;
    }
    
    .main-container {
        padding: 0 8px 80px 8px;
    }
    
    .card {
        padding: 20px 16px;
    }
    
    .file-upload-area {
        padding: 30px 20px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .welcome-section {
        padding: 40px 24px;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .welcome-section h3 {
        font-size: 1.5rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .footer-nav {
        padding: 12px 16px;
    }

    .footer-nav-content {
        flex-direction: column;
        gap: 8px;
    }

    .nav-btn {
        width: 100%;
        justify-content: center;
    }

    .container, .conversation-parameters {
        padding: 12px;
        margin-bottom: 140px;
    }
    
    .nav-bar {
        padding: 12px;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .upload-icon, .status-dot, .progress-fill::after {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-color: #666;
        --text-secondary: #ccc;
    }
    
    .mode-button, .output-button, .quick-action {
        border-width: 2px;
    }
}

/* Dark theme enhancements */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-bg: #0a0a0a;
        --secondary-bg: #1a1a1a;
        --text-color: #f0f0f0;
        --text-secondary: #b0b0b0;
        --border-color: #404040;
    }
}

/* Focus styles for keyboard navigation */
.mode-button:focus,
.output-button:focus,
.action-btn:focus,
.nav-btn:focus,
.main-input:focus,
.submit-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .nav-bar, .mode-selector, .output-selector, .research-controls, .quick-actions {
        display: none;
    }
    
    .container {
        background: white;
        border: none;
        box-shadow: none;
        width: 100%;
        margin: 0;
        padding: 20px;
    }
    
    .message {
        border: 1px solid #ccc;
        background: white;
        color: black;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .site-header h1 {
        color: black;
        text-shadow: none;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

/* Enhanced spinner animation */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced Reference URL Container */
.reference-url-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 15px;
    gap: 10px;
}

/* Enhanced Form Input Styles */
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
    background: rgba(30, 30, 30, 0.8);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

/* Enhanced Select Elements */
select {
    padding: 8px 12px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(67, 206, 162, 0.1);
}

select option {
    background: var(--secondary-bg);
    color: var(--text-color);
    padding: 8px;
}

/* Enhanced Status Indicator */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.current-step {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

/* Enhanced Conversation Parameters */
.conversation-parameters {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    box-sizing: border-box;
    margin-bottom: 10px;
    box-shadow: var(--shadow-xl);
}

/* Enhanced Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 15px;
}

.form-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Enhanced Message Form */
.message-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 15px;
    margin-top: 15px;
}

/* Enhanced scrollbar styles */
#conversation::-webkit-scrollbar {
    width: 8px;
}

#conversation::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 4px;
}

#conversation::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

#conversation::-webkit-scrollbar-thumb:hover {
    background: #3bb89e;
}

/* Enhanced scrollbar for file list */
.file-list::-webkit-scrollbar {
    width: 6px;
}

.file-list::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 3px;
}

.file-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

/* Final responsive adjustments */
@media (max-width: 1200px) {
    .container, .conversation-parameters {
        width: 95%;
    }
}

/* Enhanced small screen optimizations */
@media (max-width: 320px) {
    .site-header h1 {
        font-size: 1.8rem;
    }
    
    .mode-button {
        padding: 16px 12px;
        font-size: 13px;
    }
    
    .mode-icon {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 16px 12px;
    }
    
    .main-input {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 14px 20px;
        font-size: 14px;
    }
}

/* Enhanced animation performance */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* Enhanced hover effects */
.mode-button:hover,
.analysis-option:hover,
.file-upload-area:hover {
    will-change: transform;
}

/* Final enhancements for better UX */
.conversation-area {
    position: relative;
    flex: 1;
}

.enhanced-controls {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Export options styling */
.export-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Loading states */
.processing {
    opacity: 0.7;
    pointer-events: none;
}

/* Final accessibility improvements */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Ensure proper contrast for all interactive elements */
.mode-button,
.output-button,
.analysis-option,
.action-btn,
.quick-action,
.nav-btn {
    position: relative;
    isolation: isolate;
}

/* Final performance optimizations */
.conversation,
.message,
.modal-overlay,
.toast {
    will-change: auto;
}

/* High contrast mode enhancements */
@media (prefers-contrast: high) {
    .message {
        border-width: 2px;
    }
    
    .mode-button,
    .output-button {
        border-width: 3px;
    }
    
    .toast {
        border: 2px solid white;
    }
    
    /* Enhanced Styles for Simplified NeuralChat UI */

/* Auto-generated badges and indicators */
.auto-generated-badge {
    background: linear-gradient(135deg, var(--accent-color), var(--info-color));
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    animation: badge-glow 2s ease-in-out infinite alternate;
}

@keyframes badge-glow {
    from { box-shadow: 0 0 5px rgba(67, 206, 162, 0.3); }
    to { box-shadow: 0 0 15px rgba(67, 206, 162, 0.6); }
}

.quality-badge {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.analysis-type {
    background: rgba(67, 206, 162, 0.2);
    color: var(--accent-color);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    border: 1px solid rgba(67, 206, 162, 0.4);
}

/* Enhanced mode features tags */
.mode-features {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-tag {
    background: rgba(67, 206, 162, 0.15);
    color: var(--accent-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(67, 206, 162, 0.3);
    transition: all 0.3s ease;
}

.feature-tag:hover {
    background: rgba(67, 206, 162, 0.25);
    transform: scale(1.05);
}

/* Enhanced status bar with mode information */
.mode-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.mode-indicator {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 0.9rem;
}

.mode-description-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Mode-specific info banners */
.mode-info-banner {
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.1), rgba(67, 206, 162, 0.05));
    border: 1px solid rgba(67, 206, 162, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: banner-fade-in 0.5s ease-out;
}

@keyframes banner-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.info-content {
    flex: 1;
    line-height: 1.4;
}

.info-content strong {
    color: var(--accent-color);
}

/* Enhanced research header */
.research-header {
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.1), rgba(67, 206, 162, 0.05));
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.research-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.research-question {
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 12px 0;
    font-style: italic;
}

.research-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Enhanced image header */
.image-header {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border: 2px solid var(--info-color);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.image-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.image-prompt-comparison {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.original-prompt, .enhanced-prompt {
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: left;
}

.original-prompt {
    background: rgba(255, 255, 255, 0.1);
}

.enhanced-prompt {
    background: rgba(67, 206, 162, 0.1);
    border: 1px solid rgba(67, 206, 162, 0.3);
}

/* Enhanced image controls */
.image-controls {
    animation: slideIn 0.4s ease-out;
}

.image-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.image-tips {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 16px;
}

.image-tips h4 {
    margin: 0 0 10px 0;
    color: var(--info-color);
}

.image-tips ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.5;
}

.image-tips li {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* Enhanced output preview */
.output-preview {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    animation: preview-glow 3s ease-in-out infinite alternate;
}

@keyframes preview-glow {
    from {
        box-shadow: 0 0 10px rgba(67, 206, 162, 0.1);
    }
    to {
        box-shadow: 0 0 20px rgba(67, 206, 162, 0.2);
    }
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--accent-color);
}

.preview-icon {
    font-size: 1.1rem;
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.preview-item:hover {
    color: var(--accent-color);
    transform: translateX(4px);
}

.preview-bullet {
    color: var(--accent-color);
    font-weight: bold;
    flex-shrink: 0;
}

/* Enhanced message types */
.intelligent-summary {
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.15), rgba(67, 206, 162, 0.1));
    border: 2px solid var(--accent-color);
    animation: summary-pulse 3s ease-in-out infinite;
}

@keyframes summary-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(67, 206, 162, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(67, 206, 162, 0.5);
    }
}

.executive-summary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.1));
    border: 2px solid var(--info-color);
    border-left: 6px solid var(--info-color);
}

.research-analysis {
    border-left: 4px solid var(--accent-color);
    background: linear-gradient(135deg, var(--message-bg), rgba(67, 206, 162, 0.05));
}

.intelligent-image {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    border: 2px solid var(--info-color);
    text-align: center;
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

.image-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    color: var(--info-color);
    font-size: 16px;
}

.generated-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.generated-image:hover {
    transform: scale(1.02);
}

.image-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.image-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 8px;
    width: 100%;
}

.metadata-item {
    text-align: center;
    padding: 4px;
}

/* Enhanced analytics display */
.analytics {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 2px solid var(--success-color);
    border-radius: 16px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.analytics-item {
    background: rgba(16, 185, 129, 0.1);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.analytics-item strong {
    color: var(--success-color);
    display: block;
    margin-bottom: 4px;
}

/* Enhanced export options */
.export-options {
    animation: slideIn 0.4s ease-out;
    border: 2px solid var(--accent-color);
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.1), rgba(67, 206, 162, 0.05));
    position: relative;
    overflow: hidden;
}

.export-options::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(67, 206, 162, 0.1), transparent);
    animation: export-shine 3s infinite;
}

@keyframes export-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
    position: relative;
    z-index: 1;
}

.export-btn {
    padding: 12px 16px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.export-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(67, 206, 162, 0.2), transparent);
    transition: left 0.5s ease;
}

.export-btn:hover::before {
    left: 100%;
}

.export-btn:hover {
    border-color: var(--accent-color);
    background: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 206, 162, 0.3);
}

/* Enhanced report notice */
.report-notice {
    background: linear-gradient(135deg, rgba(67, 206, 162, 0.15), rgba(59, 130, 246, 0.1));
    border: 2px solid var(--accent-color);
    border-radius: 16px;
    animation: report-ready 2s ease-in-out infinite alternate;
}

@keyframes report-ready {
    from {
        border-color: var(--accent-color);
        box-shadow: 0 0 20px rgba(67, 206, 162, 0.3);
    }
    to {
        border-color: var(--info-color);
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
    }
}

/* Enhanced welcome section for mode-specific content */
.mode-preview {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
}

.mode-preview h4 {
    color: var(--accent-color);
    margin: 0 0 12px 0;
}

.mode-preview ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.mode-preview li {
    margin: 6px 0;
    position: relative;
    padding-left: 20px;
}

.mode-preview li::before {
    content: '🎯';
    position: absolute;
    left: 0;
    top: 0;
}

/* Enhanced primary button styles */
.futuristic-button.primary {
    background: linear-gradient(135deg, var(--accent-color), var(--success-color));
    box-shadow: 0 6px 20px rgba(67, 206, 162, 0.4);
    font-weight: 700;
}

.futuristic-button.primary:hover {
    background: linear-gradient(135deg, var(--success-color), var(--accent-color));
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.6);
    transform: translateY(-4px);
}

/* Mobile responsive enhancements */
@media (max-width: 768px) {
    .mode-features {
        justify-content: center;
    }
    
    .feature-tag {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .mode-status {
        align-items: center;
        text-align: center;
    }
    
    .image-options {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .preview-content {
        font-size: 0.85rem;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .export-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .image-metadata {
        grid-template-columns: 1fr 1fr;
        font-size: 0.8rem;
    }
    
    .mode-info-banner {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .research-title,
    .image-title {
        flex-direction: column;
        gap: 8px;
    }
    /* Enhanced Research Analysis Formatting */
.research-analysis-formatted {
    margin: 20px 0;
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.analysis-header {
    background: var(--accent-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.analysis-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.analysis-content {
    padding: 20px;
}

.analysis-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.analysis-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.section-content {
    line-height: 1.6;
}

.section-paragraph {
    margin-bottom: 12px;
}

.section-list {
    margin: 10px 0;
    padding-left: 20px;
}

.section-item {
    margin: 8px 0;
    line-height: 1.5;
}
/* Enhanced Research Analysis CSS Styles */
/* Add these styles to your existing styles.css file */

/* Research Results Header */
.research-results-header {
    background: linear-gradient(135deg, var(--secondary-bg), var(--card-bg));
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(67, 206, 162, 0.2);
    position: relative;
    overflow: hidden;
}

.research-results-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--info-color), var(--accent-color));
    animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.research-title-section {
    text-align: center;
}

.research-icon-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.research-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(67, 206, 162, 0.3));
}

.research-icon-title h2 {
    margin: 0;
    color: var(--accent-color);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
}

.analysis-badge {
    background: linear-gradient(135deg, var(--accent-color), var(--info-color));
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(67, 206, 162, 0.3);
}

.research-question {
    background: rgba(67, 206, 162, 0.1);
    border: 1px solid rgba(67, 206, 162, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.research-question strong {
    color: var(--accent-color);
}

/* Metadata Grid */
.research-metadata {
    margin-top: 25px;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.metadata-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(67, 206, 162, 0.15);
}

.metadata-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.metadata-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.metadata-value {
    font-weight: 700;
    color: var(--accent-color);
    margin-left: auto;
}

/* Section Dividers */
.section-divider {
    margin: 40px 0 30px 0;
    text-align: center;
}

.divider-content {
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.divider-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.divider-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.divider-content h3 {
    margin: 10px 0 5px 0;
    color: var(--accent-color);
    font-size: 1.3rem;
    font-weight: 700;
}

.divider-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Enhanced Analysis Formatting */
.research-analysis-formatted,
.research-analysis-enhanced {
    margin: 25px 0;
    background: linear-gradient(135deg, var(--card-bg), var(--secondary-bg));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    position: relative;
}

.analysis-header {
    background: linear-gradient(135deg, var(--accent-color), var(--info-color));
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.analysis-header::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.3), 
        rgba(255,255,255,0.1), 
        rgba(255,255,255,0.3));
}

.analysis-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.model-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.analysis-meta {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: 500;
}

.analysis-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
}

/* Analysis Content */
.analysis-content {
    padding: 25px 30px;
}

.analysis-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.analysis-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent-color);
    margin-bottom: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    position: relative;
}

.section-header::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    margin-left: 15px;
}

.section-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(67, 206, 162, 0.3));
}

.section-content {
    line-height: 1.7;
    font-size: 15px;
}

.section-paragraph {
    margin-bottom: 15px;
    text-align: justify;
}

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

.section-list {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
}

.section-item {
    margin: 10px 0;
    padding: 8px 0 8px 25px;
    position: relative;
    line-height: 1.6;
    border-left: 3px solid rgba(67, 206, 162, 0.3);
    padding-left: 15px;
    margin-left: 10px;
}

.section-item::before {
    content: '•';
    position: absolute;
    left: -8px;
    top: 8px;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Enhanced Message Types */
.executive-summary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.1));
    border: 2px solid var(--info-color);
    border-left: 6px solid var(--info-color);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}

.executive-content {
    font-size: 16px;
    line-height: 1.8;
    text-align: justify;
}

.comprehensive-synthesis {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.15), rgba(147, 51, 234, 0.1));
    border: 2px solid #9333ea;
    border-left: 6px solid #9333ea;
    box-shadow: 0 8px 32px rgba(147, 51, 234, 0.2);
}

.synthesis-content {
    font-size: 15px;
    line-height: 1.7;
}

.synthesis-intro {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-style: italic;
}

.synthesis-intro strong {
    color: #9333ea;
}

.synthesis-main {
    text-align: justify;
}

.error-analysis {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1));
    border: 2px solid var(--error-color);
    border-left: 6px solid var(--error-color);
}

.error-badge {
    background: var(--error-color);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Export Ready Section */
.export-ready {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.1));
    border: 2px solid var(--success-color);
    border-left: 6px solid var(--success-color);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.2);
    animation: exportPulse 3s ease-in-out infinite;
}

@keyframes exportPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 0 12px 40px rgba(16, 185, 129, 0.3);
    }
}

.ready-badge {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    animation: badgeGlow 2s ease-in-out infinite alternate;
}

@keyframes badgeGlow {
    from { box-shadow: 0 0 5px rgba(16, 185, 129, 0.5); }
    to { box-shadow: 0 0 15px rgba(16, 185, 129, 0.8); }
}

.export-info {
    font-size: 15px;
    line-height: 1.6;
}

.export-summary {
    margin-bottom: 25px;
}

.export-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.export-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.stat-icon {
    font-size: 1.1rem;
    color: var(--success-color);
}

.stat-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--success-color);
    margin-left: auto;
}

.export-formats-preview {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.export-formats-preview h4 {
    margin: 0 0 15px 0;
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.formats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.format-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.format-item:hover {
    border-color: var(--success-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.format-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

.format-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: var(--text-color);
}

.format-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Enhanced Content Formatting */
.inline-header {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.05em;
    margin: 15px 0 8px 0;
    display: block;
}

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

.message-content ul,
.message-content ol {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
}

.message-content li {
    margin: 8px 0;
    padding: 6px 0 6px 20px;
    position: relative;
    line-height: 1.6;
}

.message-content ul li::before {
    content: '▶';
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--accent-color);
    font-size: 0.8rem;
}

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

.message-content ol li {
    counter-increment: list-counter;
}

.message-content ol li::before {
    content: counter(list-counter) '.';
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Model-specific styling */
.research-analysis-enhanced.grok-1 .analysis-header {
    background: linear-gradient(135deg, #4caf50, #45a049);
}

.research-analysis-enhanced.grok-2 .analysis-header {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.research-analysis-enhanced.claude .analysis-header {
    background: linear-gradient(135deg, #7b1fa2, #6a1b9a);
}

.research-analysis-enhanced.chatgpt .analysis-header {
    background: linear-gradient(135deg, #1565c0, #1976d2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .research-results-header {
        padding: 20px;
    }
    
    .research-icon-title {
        flex-direction: column;
        gap: 10px;
    }
    
    .metadata-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .analysis-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 15px 20px;
    }
    
    .analysis-meta {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .analysis-content {
        padding: 20px;
    }
    
    .section-header {
        font-size: 1rem;
    }
    
    .section-header::after {
        display: none;
    }
    
    .export-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .formats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .export-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .stat-value {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .research-results-header {
        padding: 15px;
    }
    
    .research-question {
        padding: 15px;
        font-size: 1rem;
    }
    
    .analysis-content {
        padding: 15px;
    }
    
    .section-content {
        font-size: 14px;
    }
    
    .formats-grid {
        grid-template-columns: 1fr;
    }
    
    .format-item {
        padding: 10px;
    }
    
    .export-formats-preview {
        padding: 15px;
    }
}

/* Print Styles */
@media print {
    .research-results-header,
    .research-analysis-enhanced,
    .export-ready {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .analysis-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .export-ready {
        display: none;
    }
    
    .research-results-header::before,
    .analysis-header::after {
        display: none;
    }
}

}