/* Root Variables for Consistent Theming */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #ec4899;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background-color: var(--light-bg);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.navbar {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    padding: 1rem 0;
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff !important;
    display: flex;
    align-items: center;
}

.brand-text {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

/* Master Gene Selector in Header */
.master-gene-selector-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.master-gene-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
}

.master-gene-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.875rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border-radius: 0.375rem;
    min-width: 180px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba(255,255,255,0.8)' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px 12px;
    appearance: none;
}

.master-gene-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.master-gene-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.master-gene-select option {
    background: #1e293b;
    color: white;
    padding: 0.5rem;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: 500;
    margin-left: 1.5rem;
    transition: var(--transition);
    position: relative;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #fff !important;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after {
    width: 100%;
}

/* Compact navigation spacing */
.compact-nav .nav-link {
    margin-left: 0.75rem !important;
}

/* Navbar dropdown styling */
.navbar .dropdown-menu {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.navbar .dropdown-item {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
}

.navbar .dropdown-item:hover {
    background: rgba(99, 102, 241, 0.2);
    color: white;
}

.navbar .dropdown-item:active {
    background: var(--primary-color);
    color: white;
}

.navbar .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.navbar .nav-item {
    margin-left: 1rem;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #e2e8f0 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Hero section text styling */
.hero-section .text-muted {
    color: var(--text-secondary) !important;
}

.hero-section .lead {
    color: var(--text-primary);
    font-weight: 400;
}

.hero-section h1, 
.hero-section h2, 
.hero-section h3 {
    color: var(--text-primary);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.03) 0%, transparent 50%);
}

.hero-visual {
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-animation {
    width: 100%;
    height: 100%;
    max-width: 600px;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
}

.btn-outline-light {
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    background: transparent;
}

.btn-outline-light:hover {
    background: var(--light-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

/* Ensure buttons are clickable */
.btn {
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

/* Hero section button container */
.hero-section .d-flex {
    position: relative;
    z-index: 20;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Main Content */
.main-content {
    opacity: 1;
    transition: opacity 0.3s ease;
    padding-top: 80px;
}

/* Category Sections */
.category-section {
    padding: 6rem 0;
    position: relative;
    transition: all 0.3s ease;
}

.category-section:nth-child(even) {
    background-color: #dbe2e9;  /* Purple gray */
}

.category-section:nth-child(odd) {
    background-color: #fefefe;  /* Off-white */
}

/* Section separators with dashed lines */
.category-section:not(:last-child) {
    border-bottom: 2px dashed rgba(99, 102, 241, 0.5);
}

/* Hover effects for sections removed for cleaner design */

.section-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    padding: 2rem 0;
}

.section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.2), transparent);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    position: relative;
    padding: 1rem 0;
}

.section-title::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.6;
}

.section-title::after {
    content: '';
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.6;
}

.section-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    padding: 1rem 0;
}

.section-description::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
    border-radius: 1px;
}

.section-subheader {
    text-align: center;
    margin-bottom: 2rem;
}

.section-subtitle {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header-selector {
    min-width: 120px;
}

.header-selector .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.header-selector .form-select {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    height: 38px;
    border: 1px solid var(--border-color);
    background-color: white;
    transition: var(--transition);
}

.header-selector .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Gene Selector */
.gene-selector-container {
    margin-bottom: 3rem;
}

.gene-selector-wrapper {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.gene-selector-wrapper:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Prevent hover effects when dropdown is open */
.gene-selector-wrapper.dropdown-open:hover {
    transform: none;
}

.gene-selector {
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1.125rem;
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.gene-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Fix for gene selector dropdown z-index issues */
.enhanced-selector-wrapper {
    position: relative;
    z-index: 9999;
}

.selector-dropdown {
    z-index: 1020 !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
}

/* Ensure expression toggle doesn't interfere with dropdown */
.expression-toggle {
    position: relative;
    z-index: 1;
}

/* Enhanced selector container styling */
.enhanced-selector-container {
    position: relative;
    z-index: 9999;
}

/* Ensure all form controls have consistent styling */
.form-select, .form-control, 
.enhanced-selector-container .current-gene-value,
.enhanced-selector-container .gene-name {
    font-style: normal !important;
    font-weight: 400;
    vertical-align: middle;
    line-height: 1.4;
}

.enhanced-selector-container .selector-header {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    transition: var(--transition);
    cursor: pointer;
}

.enhanced-selector-container .selector-header:hover {
    border-color: var(--primary-color);
}

.enhanced-selector-container .current-gene-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-style: normal;
    height: 38px;
    min-height: 38px;
    line-height: 1.4;
}

.enhanced-selector-container .gene-name {
    color: var(--text-primary);
    font-weight: 400;
    font-style: normal;
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.enhanced-selector-container .selector-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhanced-selector-container .clear-btn {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.125rem;
    border-radius: 0.25rem;
    transition: var(--transition);
}

.enhanced-selector-container .clear-btn:hover {
    color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

.enhanced-selector-container .dropdown-arrow {
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: var(--transition);
}

.enhanced-selector-container .selector-header:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.selector-dropdown {
    z-index: 1020 !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

/* Add spacing to prevent overlap */
.gene-selector-container {
    margin-bottom: 2rem !important;
}

/* Data Card Captions */
.card-caption {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color-secondary, #6b7280);
    background: var(--light-bg, #f8fafc);
    padding: 1rem;
    border-radius: 6px;
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -1rem;
}

.card-caption a {
    color: var(--primary-color, #3498db);
    text-decoration: none;
    font-weight: 500;
}

.card-caption a:hover {
    color: var(--primary-color-hover, #2980b9);
    text-decoration: underline;
}

/* Data Cards */
.data-card {
    background: white;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2rem;
    contain: layout style;
}

.data-card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Download buttons container positioning */
.download-buttons-container {
    z-index: 10;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Ensure download buttons are positioned in top-right corner */
.card-header .d-flex .download-buttons-container {
    margin-left: auto;
    flex-shrink: 0;
}

/* Single cell RNA expression card headers */
#expression-scrna .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

#expression-scrna .card-header h4 {
    margin: 0;
    flex-shrink: 0;
}

#expression-scrna .card-header .d-flex {
    margin-left: auto;
}

/* Enhanced chart container for single-cell RNA expression */
#expression-scrna .card-body {
    padding: 1.5rem;
    overflow-x: auto;
}

/* Increase Tahoe100m card-body height by 10% */
#tahoe100m-table {
    min-height: 440px; /* 400px + 10% = 440px */
}

#expression-scrna .visualization-container {
    min-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

#expression-scrna .chart-container {
    min-width: 1200px;
    max-width: none;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Compact card headers for bulk expression */
.card-header .d-flex {
    width: 100%;
}

.card-header .d-flex h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-header .d-flex .d-flex {
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Responsive adjustments for compact headers */
@media (max-width: 768px) {
    .card-header .d-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .card-header .d-flex .d-flex {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .header-selector {
        min-width: 120px;
    }
}

.card-header h4 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.card-body {
    padding: 2rem;
}

/* Visualization Containers */
.visualization-container {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 0.5rem;
    padding: 2rem;
}

.table-container {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

/* Tabs */
.nav-pills {
    background: rgba(248, 250, 252, 0.8);
    padding: 0.5rem;
    border-radius: 0.75rem;
    display: inline-flex;
    gap: 0.5rem;
}

.nav-pills .nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: var(--transition);
    border: none;
}

.nav-pills .nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-pills .nav-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Expression Toggle */
.expression-toggle {
    text-align: center;
    margin-bottom: 3rem;
}

.expression-toggle .btn-group {
    background: white;
    padding: 0.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
}

/* Tables */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay.show {
    display: flex;
    opacity: 1;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Footer */
.site-footer {
    background: var(--dark-bg);
    color: rgba(255, 255, 255, 0.8);
    padding: 3rem 0;
    margin-top: 5rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .navbar-nav .nav-link {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .gene-selector-wrapper {
        padding: 1.5rem;
    }
    
    .nav-pills {
        flex-wrap: wrap;
    }
    
    .nav-pills .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Chart Container Specific Styles */
.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
    width: 100%;
}

/* Wide chart container for many x-axis items */
.chart-container.wide-chart {
    overflow-x: auto;
    overflow-y: hidden;
}

.chart-container.wide-chart canvas {
    min-width: 1200px;
}

/* Expression chart specific */
#gtex-chart, #hpa-chart, #fantom-chart, #depmap-chart, #tcga-chart {
    overflow-x: auto;
    padding-bottom: 1rem;
    width: 100%;
}

/* FIX: Ensure proper canvas rendering */
#gtex-chart canvas, #hpa-chart canvas, #fantom-chart canvas, #depmap-chart canvas, #tcga-chart canvas {
    max-width: 100%;
    height: auto !important;
    display: block !important;
}

/* Additional chart fixes */
.chart-container canvas {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-smooth: always;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chart styling - removed extra card structure for consistency */
.chart-container {
    /* Removed card-like styling to match other sections */
}

.chart-container:hover {
    /* Removed hover effects */
}

/* Expression chart containers - removed extra card structure */
#gtex-chart, #hpa-chart, #fantom-chart {
    /* Removed card-like styling to match other sections */
}

#gtex-chart:hover, #hpa-chart:hover, #fantom-chart:hover {
    /* Removed hover effects */
}

/* Search Input Styles */
.search-input {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-size: 1rem;
    font-style: normal;
    font-weight: 400;
    transition: var(--transition);
    width: 100%;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Circle Grid Visualization for scRNA */
.circle-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.circle-grid-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.circle-grid-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 150px;
    text-align: right;
    margin-right: 1rem;
}

.circle-grid-cells {
    display: flex;
    gap: 0.5rem;
}

.expression-circle {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.expression-circle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.expression-circle .inner-circle {
    border-radius: 50%;
    transition: var(--transition);
}

/* Tooltip Styles */
.tooltip-custom {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.tooltip-custom::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

/* Download Button Animation */
.btn-download {
    position: relative;
    overflow: hidden;
}

.btn-download::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-download:active::after {
    width: 300px;
    height: 300px;
}

/* Genomic Track Visualization */
.genomic-track {
    position: relative;
    height: 60px;
    margin-bottom: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    overflow: hidden;
}

.genomic-track-label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    z-index: 2;
}

.genomic-feature {
    position: absolute;
    height: 30px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 0.25rem;
    opacity: 0.8;
    transition: var(--transition);
    cursor: pointer;
}

.genomic-feature:hover {
    opacity: 1;
    transform: scaleY(1.2);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.genomic-feature.variant {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    height: 40px;
}

.genomic-feature.chip-peak {
    background: linear-gradient(135deg, #10b981, #059669);
    height: 20px;
}

/* Error State */
.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error-message i {
    color: #dc2626;
    font-size: 1.25rem;
}

/* Success State */
.success-message {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.success-message i {
    color: #10b981;
    font-size: 1.25rem;
}

/* Pulse Animation for Live Data */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.live-indicator {
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
    margin-right: 0.5rem;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Print Styles */
@media print {
    .navbar,
    .site-footer,
    .btn,
    .gene-selector-container,
    .chart-download-buttons {
        display: none !important;
    }
    
    .category-section {
        page-break-inside: avoid;
    }
    
    .data-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}



/* Chart tab functionality */
.chart-tab {
    display: none;
}

.chart-tab.active {
    display: block;
}

.btn-group .btn.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.btn-group .btn:not(.active) {
    background-color: transparent;
    border-color: #d1d5db;
    color: #374151;
}

.btn-group .btn:not(.active):hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* Ensure chart containers have proper height */
.chart-tab {
    min-height: 400px;
    position: relative;
}

/* Gene regulation specific styles */
.gene-regulation-container {
    margin-bottom: 2rem;
}

.gene-structure-container,
.chip-seq-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.gene-structure-container h5,
.chip-seq-container h5 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

#gene-structure-plot,
#chip-seq-plot {
    width: 100%;
    min-height: 350px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    padding: 1rem;
}

.gene-structure-container,
.chip-seq-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Cross References specific styles */
.cross-refs-container {
    margin-bottom: 2rem;
}

.cross-refs-grid {
    width: 100%;
}

.cross-refs-category {
    margin-bottom: 2rem;
}

.category-title {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.category-title i {
    color: var(--primary-color);
}

.cross-ref-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    height: 100%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.cross-ref-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.ref-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 8px;
    color: white;
    flex-shrink: 0;
}

.ref-content {
    min-width: 0;
}

.ref-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ref-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.ref-link:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.ref-link i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.ref-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.ref-actions {
    display: flex;
    gap: 0.5rem;
}

.copy-url-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: var(--transition);
}

.copy-url-btn:hover {
    transform: scale(1.05);
}

/* Responsive adjustments for cross refs */
@media (max-width: 768px) {
    .cross-ref-card {
        margin-bottom: 1rem;
    }
    
    .ref-icon {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
    
    .category-title {
        font-size: 1rem;
    }
    
    .ref-name {
        font-size: 0.9rem;
    }
    
    .ref-description {
        font-size: 0.8rem;
    }
}

/* Cross refs loading and success animations */
.cross-refs-container .loading-overlay {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
}

.cross-refs-container .spinner-border {
    color: var(--primary-color);
}

/* Badge styling for category counts */
.category-title .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Smooth entry animations for cross ref cards */
.cross-ref-card {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Delay animations for staggered effect */
.cross-refs-category:nth-child(1) .cross-ref-card { animation-delay: 0.1s; }
.cross-refs-category:nth-child(2) .cross-ref-card { animation-delay: 0.2s; }
.cross-refs-category:nth-child(3) .cross-ref-card { animation-delay: 0.3s; }
.cross-refs-category:nth-child(4) .cross-ref-card { animation-delay: 0.4s; }
.cross-refs-category:nth-child(5) .cross-ref-card { animation-delay: 0.5s; }
.cross-refs-category:nth-child(6) .cross-ref-card { animation-delay: 0.6s; }
.cross-refs-category:nth-child(7) .cross-ref-card { animation-delay: 0.7s; }
.cross-refs-category:nth-child(8) .cross-ref-card { animation-delay: 0.8s; }
.cross-refs-category:nth-child(9) .cross-ref-card { animation-delay: 0.9s; }
.cross-refs-category:nth-child(10) .cross-ref-card { animation-delay: 1.0s; }

/* AI Assistant Styles */
.ai-floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.25), 0 8px 8px rgba(0,0,0,0.22);
}

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

.ai-btn-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon {
    transition: var(--transition);
}

.ai-floating-btn:hover .ai-icon {
    transform: rotate(15deg);
}

.ai-status-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid white;
    background: #6b7280;
}

.ai-status-indicator.connected {
    background: #10b981;
}

.ai-status-indicator.warning {
    background: #f59e0b;
}

.ai-status-indicator.disconnected {
    background: #ef4444;
}

/* AI Modal - ensure it appears above ALL elements including sticky cards */
.ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999 !important;
    display: none;
}

/* Ensure sticky elements don't interfere with AI modal */
.ai-modal.active ~ * .sticky-top,
.ai-modal.active ~ .sticky-top,
.sticky-top {
    z-index: 1020 !important;
}

/* Override Bootstrap's sticky-top when modal is open */
body:has(.ai-modal.active) .sticky-top {
    z-index: 1020 !important;
}

/* Nuclear option - force all elements to low z-index when modal is open */
body.modal-open * {
    z-index: auto !important;
}

body.modal-open .ai-modal {
    z-index: 999999 !important;
}

/* Alternative approach - hide sticky cards when modal is open */
body.modal-open .sticky-top {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ensure modal content is visible */
body.modal-open .ai-modal,
body.modal-open .ai-modal * {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.ai-modal.active {
    display: block;
}

.ai-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.ai-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    overflow: hidden;
    max-width: 800px;
    height: 80vh;
    max-height: 700px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.ai-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.ai-logo {
    color: var(--primary-color);
    flex-shrink: 0;
}

.ai-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-model-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    margin-right: 1rem;
}

.ai-model-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ai-connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.connected {
    background: #10b981;
    animation: pulse 2s infinite;
}

.status-dot.warning {
    background: #f59e0b;
}

.status-dot.disconnected {
    background: #ef4444;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.ai-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.ai-close-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Chat Container */
.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Removed generic .ai-messages - using sidebar-specific version only */

.ai-message {
    display: flex;
    margin-bottom: 1rem;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

.ai-message-user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
}

.user-avatar {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ai-avatar.error {
    background: #fef2f2;
    border-color: #fecaca;
}

.ai-message-content {
    flex: 1;
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: calc(100% - 60px);
    font-size: 0.875rem;
    line-height: 1.4;
}

.user-message {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.error-message {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.ai-message-content p {
    margin: 0 0 0.375rem 0;
    line-height: 1.4;
}

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

/* Enhanced AI message formatting */
.ai-message-text {
    line-height: 1.6;
}

.ai-message-text .numbered-item {
    margin: 0.5rem 0;
    padding-left: 0.5rem;
    border-left: 3px solid var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.05);
    border-radius: 0 4px 4px 0;
}

.ai-message-text .bullet-item {
    margin: 0.3rem 0;
    padding-left: 0.5rem;
}

.ai-message-text .section-header {
    margin: 1.2rem 0 0.6rem 0;
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1em;
}

.ai-message-text .ai-header {
    margin: 1rem 0 0.5rem 0;
    color: var(--primary-color);
    font-weight: 600;
}

.ai-message-text h2.ai-header {
    font-size: 1.2em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
}

.ai-message-text h3.ai-header {
    font-size: 1.1em;
}

.ai-message-text h4 {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-color);
}

.ai-message-text strong {
    color: var(--text-color);
    font-weight: 600;
}

.ai-message-text em {
    font-style: italic;
    color: var(--text-color-secondary);
}

/* Paragraphs */
.ai-message-text p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

.ai-message-text p:first-child {
    margin-top: 0;
}

.ai-message-text p:last-child {
    margin-bottom: 0;
}

/* Tables from markdown */
.ai-message-text .ai-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.8125rem;
}

.ai-message-text .ai-table th,
.ai-message-text .ai-table td {
    border: 1px solid #e2e8f0;
    padding: 0.375rem 0.625rem;
    text-align: left;
    vertical-align: top;
    line-height: 1.5;
}

.ai-message-text .ai-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
    font-size: 0.75rem;
}

.ai-message-text .ai-table td {
    color: #475569;
}

.ai-message-text .ai-table tr:hover td {
    background: #f8fafc;
}

/* Lists */
.ai-message-text ul,
.ai-message-text ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.ai-message-text li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.ai-message-text ul li {
    list-style-type: disc;
}

.ai-message-text ol li {
    list-style-type: decimal;
}

/* Nested lists */
.ai-message-text ul ul,
.ai-message-text ol ul {
    margin: 0.25rem 0;
}

/* Blockquotes */
.ai-message-text blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--primary-color);
    background: rgba(var(--primary-color-rgb, 59, 130, 246), 0.05);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--text-color-secondary, #6b7280);
}

.ai-message-text blockquote p {
    margin: 0.5rem 0;
}

.ai-message-text blockquote p:first-child {
    margin-top: 0;
}

.ai-message-text blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rules */
.ai-message-text hr {
    margin: 1.5rem 0;
    border: none;
    border-top: 2px solid var(--border-color, #e5e7eb);
    opacity: 0.6;
}

/* Tables */
.ai-message-text table {
    width: 100%;
    margin: 1rem 0;
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
    font-size: 0.9em;
}

.ai-message-text table th,
.ai-message-text table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color, #e5e7eb);
}

.ai-message-text table th {
    background: var(--light-bg, #f9fafb);
    font-weight: 600;
    color: var(--text-color, #111827);
}

.ai-message-text table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

.ai-message-text table tr:hover {
    background: rgba(var(--primary-color-rgb, 59, 130, 246), 0.05);
}

/* Code blocks */
.ai-message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 0.875em;
    color: #e11d48;
}

.ai-message-text pre {
    margin: 1rem 0;
    padding: 1rem;
    background: #1e293b;
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.5;
}

.ai-message-text pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.875em;
}

.ai-confidence {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    display: inline-block;
}

.ai-confidence.high {
    background: #dcfce7;
    color: #166534;
}

.ai-confidence.medium {
    background: #fef3c7;
    color: #92400e;
}

.ai-confidence.low {
    background: #fee2e2;
    color: #991b1b;
}

.ai-sources {
    margin-top: 0.75rem;
    font-size: 0.8rem;
}

.source-tag {
    display: inline-block;
    background: var(--light-bg);
    color: var(--text-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin: 0.25rem 0.25rem 0 0;
    font-weight: 500;
    text-decoration: none;
}

.source-tag.clickable {
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-tag.clickable:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pmid-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted var(--primary-color);
}

.pmid-link:hover {
    color: var(--primary-color-dark);
    text-decoration: none;
    border-bottom: 1px solid var(--primary-color-dark);
}

/* Options Panel */
.ai-options-panel {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--light-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.ai-options-columns-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.ai-options-column {
    padding: 0 0.5rem;
    border-right: 1px solid var(--border-color);
}

.ai-options-column:last-child {
    border-right: none;
}

.ai-section-header {
    margin-bottom: 0.4rem;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-section-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.section-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.25rem 0.35rem;
    border-radius: 3px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    font-size: 0.65rem;
}

.section-checkbox:hover {
    background: var(--primary-color-light);
    border-color: var(--primary-color);
}

.section-checkbox input[type="checkbox"] {
    display: none;
}

.section-checkbox .checkmark {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    margin-right: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.section-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.section-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.section-checkbox input[type="checkbox"]:checked ~ span:not(.checkmark) {
    font-weight: 600;
    color: var(--primary-color);
}

.ai-response-header {
    margin-bottom: 0.5rem;
}

.response-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-response-options {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.response-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.response-radio:hover {
    background: #eef2ff;
    border-color: #6366f1;
}

/* RAG Alpha Parameter Control */
.ai-alpha-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 0.5rem 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.alpha-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.alpha-tooltip {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: help;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
}

.alpha-tooltip:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.ai-alpha-control {
    margin-top: 0.5rem;
}

.alpha-slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alpha-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.alpha-label-left {
    color: #4ade80; /* Green for semantic */
}

.alpha-label-right {
    color: #f59e0b; /* Orange for keyword */
}

.alpha-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, #4ade80, #f59e0b);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.alpha-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

.alpha-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

.alpha-value {
    text-align: center;
    margin-top: 0.25rem;
}

.alpha-value span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--light-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.response-radio input[type="radio"] {
    display: none;
}

.response-radio .radio-checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.response-radio input[type="radio"]:checked + .radio-checkmark {
    background: #6366f1;
    border-color: #6366f1;
}

.response-radio input[type="radio"]:checked + .radio-checkmark::after {
    content: "";
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.response-radio input[type="radio"]:checked ~ span:not(.radio-checkmark) {
    font-weight: 600;
    color: #4f46e5;
}

/* Highlight the entire selected radio label */
.response-radio:has(input:checked) {
    background: #eef2ff;
    border-color: #6366f1;
}

.response-type-note {
    font-size: 0.7em;
    color: var(--text-muted, #888);
    font-weight: 400;
    font-style: italic;
}

/* Welcome Message */
.ai-welcome-message {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--light-bg);
}

.ai-welcome-message .ai-avatar {
    margin-bottom: 1rem;
}

.ai-welcome-message .ai-message-content {
    background: transparent;
    border: none;
    padding: 0;
    max-width: none;
}

.ai-example-questions {
    margin-top: 1rem;
}

.ai-example-questions p {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.example-question {
    display: inline-block;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin: 0.25rem 0.5rem 0.25rem 0;
    cursor: pointer;
    transition: var(--transition);
}

.example-question:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Contextual Suggestions */
.contextual-header {
    font-weight: 600;
    color: var(--text-primary);
    margin: 1rem 0 0.5rem 0;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.contextual-suggestion {
    display: inline-block;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid #0ea5e9;
    color: #0369a1;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin: 0.25rem 0.5rem 0.25rem 0;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-weight: 500;
}

.contextual-suggestion::before {
    content: '💡';
    margin-right: 0.5rem;
    font-size: 0.8rem;
}

.contextual-suggestion:hover {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    border-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

/* Typing Indicator */
.ai-typing-indicator {
    display: none;
    margin: 0 2rem 1rem 2rem;
    gap: 1rem;
}

.ai-typing-indicator.visible {
    display: flex;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-dots {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Container */
.ai-input-container {
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 1.5rem 2rem;
}

.ai-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    transition: var(--transition);
}

.ai-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Detection Feedback */
.ai-detection-feedback {
    margin: 0.75rem 2rem 0 2rem;
    transition: opacity 0.3s ease;
}

.detection-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.detection-info.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.detection-info.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.detection-info i {
    flex-shrink: 0;
}

.gene-badge, .tissue-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0 0.25rem;
}

.tissue-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.ai-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 20px;
    max-height: 120px;
    overflow-y: auto;
}

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

.ai-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.ai-send-btn:hover:not(:disabled) {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.ai-send-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.ai-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.char-counter.warning {
    color: #f59e0b;
    font-weight: 500;
}

.ai-disclaimer {
    font-style: italic;
}

/* AI Configuration Panel */
.ai-config-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 0 0 1rem 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.ai-config-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.ai-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 1rem 1rem 0 0;
}

.ai-config-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.ai-config-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.ai-config-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.ai-config-content {
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.ai-config-section {
    margin-bottom: 1.5rem;
}

.ai-config-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.ai-form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.ai-form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ai-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-input-group .ai-form-control {
    flex: 1;
}

.ai-toggle-key {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.ai-toggle-key:hover {
    background: #e5e7eb;
}

.ai-help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.ai-help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.ai-help-text a:hover {
    text-decoration: underline;
}

.ai-model-display {
    background: #f3f4f6;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    word-break: break-all;
}

.ai-config-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.ai-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.ai-btn-secondary {
    background: #f3f4f6;
    color: var(--text-primary);
    border: 1px solid #d1d5db;
}

.ai-btn-secondary:hover {
    background: #e5e7eb;
}

.ai-config-status {
    margin-top: 1rem;
}

.ai-status-success {
    color: #065f46;
    background: #d1fae5;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.ai-status-error {
    color: #991b1b;
    background: #fee2e2;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.ai-status-info {
    color: #1e40af;
    background: #dbeafe;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.ai-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-config-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

.ai-config-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Connection status styles */
.status-dot.connected {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot.disconnected {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* AI Mobile Responsive */
@media (max-width: 768px) {
    .ai-floating-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .ai-modal-content {
        width: 95vw;
        height: 90vh;
        max-height: none;
    }
    
    .ai-modal-header {
        padding: 1rem 1.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .ai-model-info {
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        justify-content: space-between;
    }
    
    .ai-messages {
        padding: 1rem 1.5rem;
    }
    
    .ai-message {
        margin-bottom: 1rem;
        gap: 0.75rem;
    }
    
    .ai-input-container {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .ai-floating-btn {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .ai-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .ai-messages {
        padding: 1rem;
    }
    
    .ai-input-container {
        padding: 1rem;
    }
    
    .ai-message-content {
        max-width: calc(100% - 50px);
    }
}

/* Production configuration styles */
.ai-production-notice {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px solid #10b981;
    border-radius: 12px;
    margin: 10px 0;
}

.production-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 5px;
}

.production-text h4 {
    color: #10b981;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.production-text p {
    color: #475569;
    font-size: 14px;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.production-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 6px;
    font-size: 13px;
}

.detail-label {
    font-weight: 500;
    color: #374151;
}

.detail-value {
    color: #10b981;
    font-weight: 600;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* Production responsive styles */
@media (max-width: 768px) {
    .ai-production-notice {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

/* AI Sidebar Styles */
.ai-sidebar {
    position: fixed;
    top: 80px;
    right: 0;
    width: 1440px;
    height: calc(100vh - 80px);
    background: white;
    border-left: 1px solid var(--border-color, #e2e8f0);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.ai-sidebar.expanded {
    transform: translateX(0);
}

.ai-sidebar.collapsed {
    transform: translateX(700px);
}

/* Floating AI toggle button - always visible */
.ai-sidebar-floating-toggle {
    position: fixed !important;
    right: 16px !important;
    top: 25vh !important;
    z-index: 1001 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    background: #6366f1 !important;
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.9) !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 22px !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.ai-sidebar-floating-toggle:hover {
    background: #4f46e5 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
    transform: scale(1.08) !important;
}

.ai-sidebar-floating-toggle {
    position: relative;
}

.ai-status-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    background: #ef4444; /* Red by default */
    transition: all 0.3s ease;
}

.ai-status-indicator.connected {
    background: #22c55e; /* Green when connected */
}

.ai-status-indicator.connecting {
    background: #f59e0b; /* Orange when connecting */
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-sidebar-header {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 52px;
}

.ai-sidebar-left-controls {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.ai-sidebar-title {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex: 1;
}

.ai-sidebar-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.ai-sidebar-controls {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.ai-sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    align-self: flex-end;
}

.ai-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-sidebar .ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-sidebar .ai-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
    gap: 0.75rem;
    min-height: 0; /* Important for flex scrolling */
}

.ai-sidebar .ai-input-container {
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding: 0.75rem;
    background: var(--bg-secondary, #f8fafc);
}

/* Layout adjustments when AI sidebar is active */
/* No body adjustments needed - sidebars are hidden by default */

/* Mobile responsiveness */
@media (max-width: 1200px) {
    .ai-sidebar {
        width: 700px;
    }

    .ai-sidebar.collapsed {
        transform: translateX(600px);
    }

    body.ai-sidebar-active .ai-sidebar:not(.collapsed) ~ * {
        margin-right: 700px;
    }
}

@media (max-width: 768px) {
    .ai-sidebar {
        width: 100vw;
        right: 0;
    }
    
    .ai-sidebar.collapsed {
        transform: translateX(100%);
    }
    
    body.ai-sidebar-active {
        padding-right: 0;
    }
    
    body.ai-sidebar-active .ai-sidebar:not(.collapsed) ~ * {
        margin-right: 0;
        display: none; /* Hide main content on mobile when sidebar is open */
    }
}