/* ============================================================
   IDRR - Integrated Drug Response Resource
   Dark Theme Stylesheet
   ============================================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(18, 18, 26, 0.9);
    --bg-hover: rgba(255, 255, 255, 0.03);
    
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    
    --gradient-primary: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    --shadow-glow: 0 0 40px rgba(168, 85, 247, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Better SVG text rendering for charts */
svg text {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.js-plotly-plot .plotly .main-svg {
    shape-rendering: geometricPrecision;
}

.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: 
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(168, 85, 247, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 60%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

/* ============================================================
   NAVIGATION
   ============================================================ */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--text-primary);
}

.logo span {
    font-weight: 400;
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a.active::after {
    content: '';
    display: block;
    height: 2px;
    background: var(--gradient-primary);
    margin-top: 4px;
    border-radius: 1px;
}

/* ============================================================
   HERO / INDEX PAGE
   ============================================================ */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    padding: 6rem 5% 3rem;
}

.hero-content {
    max-width: 600px;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.visual-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    overflow: hidden;
}

#hero-plot {
    height: 350px;
    width: 100%;
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.7;
}

/* ============================================================
   DUAL SEARCH
   ============================================================ */
.search-section {
    max-width: 700px;
    margin: 0 auto 3rem;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.search-box-wrapper {
    text-align: left;
    position: relative;
}

.search-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.search-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.search-box input {
    flex: 1;
    padding: 0.875rem 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

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

.suggestion-name {
    font-weight: 500;
}

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

.suggestion-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* Selected items */
.selected-item {
    margin-top: 0.75rem;
    min-height: 2rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.selected-tag.drug {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.selected-tag.cell {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.tag-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Explore button */
.search-btn {
    width: 100%;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

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

.search-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.3);
}

.search-btn .arrow {
    transition: transform 0.2s;
}

.search-btn:not(:disabled):hover .arrow {
    transform: translateX(4px);
}

.search-hint {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.search-hint.ready {
    color: var(--accent-green);
}

/* Quick stats */
.quick-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Stats Section - Large animated counters */
.stats-section {
    padding: 3rem 5%;
    background: linear-gradient(180deg, transparent 0%, rgba(168, 85, 247, 0.03) 100%);
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 4rem;
    max-width: 900px;
    margin: 0 auto;
}

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

.stat-item .stat-number {
    font-size: 3rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
}

.stat-item .stat-label-suffix {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline;
}

.stat-item .stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-top: 0.5rem;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.search-btn.primary {
    flex: 1;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.search-btn.primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.3);
}

.search-btn.secondary {
    flex: 1;
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius-md);
    color: var(--accent-purple);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.search-btn.secondary:not(:disabled):hover {
    background: rgba(168, 85, 247, 0.1);
}

/* ============================================================
   FEATURES SECTION
   ============================================================ */
.features-section {
    padding: 4rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

.dataset-showcase {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.dataset-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

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

/* Quick Links */
.quick-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.quick-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.2s;
    min-width: 200px;
}

.quick-link-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}

.quick-link-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.quick-link-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.quick-link-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.25rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.gdsc1 { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.badge.gdsc2 { background: rgba(22, 163, 74, 0.2); color: #16a34a; }
.badge.prism { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.badge.ctrpv2 { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge.nci60 { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.badge.gcsi { background: rgba(236, 72, 153, 0.2); color: #ec4899; }

/* Footer */
footer {
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-logo {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================================
   EXPLORER PAGE
   ============================================================ */
.explorer-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1.5rem;
    padding: 5rem 1.5rem 2rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.filter-panel,
.metrics-panel {
    position: sticky;
    top: 5rem;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.filter-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-purple);
    margin-bottom: 1rem;
}

/* Selection info */
.selection-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.info-label {
    color: var(--text-muted);
}

.info-value {
    font-weight: 500;
    text-align: right;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.change-btn {
    display: block;
    margin-top: 1rem;
    padding: 0.5rem;
    text-align: center;
    color: var(--accent-purple);
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.change-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: var(--accent-purple);
}

/* Dataset toggles */
.dataset-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dataset-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.dataset-toggle:hover {
    background: var(--bg-hover);
}

.dataset-toggle input {
    accent-color: var(--accent-purple);
}

.toggle-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.toggle-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toggle options */
.toggle-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 0.85rem;
}

.toggle-option input {
    accent-color: var(--accent-purple);
}

/* Export buttons */
.export-btn {
    width: 100%;
    padding: 0.625rem;
    margin-bottom: 0.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.export-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.export-btn:last-child {
    margin-bottom: 0;
}

/* Main content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.plot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.plot-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.plot-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.dataset-badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Plot container */
.plot-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-glow);
    position: relative;
    min-height: 500px;
    overflow: hidden;
}

#main-plot {
    height: 480px;
    width: 100%;
}

/* Loading */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border-radius: var(--radius-lg);
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Comparison section */
.comparison-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.comparison-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.dataset-metric-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.ds-header {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.ds-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4rem 0.5rem;
}

.ds-metric {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

.ds-label {
    color: var(--text-muted);
}

.ds-value {
    font-weight: 500;
    font-family: 'Monaco', monospace;
}

/* Primary metric card */
.primary-metric {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
}

.primary-metric-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.primary-metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0.5rem 0;
}

.primary-metric-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Metric cards */
.metric-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.metric-card-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.metric-card-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.25rem;
    font-family: 'Monaco', monospace;
}

/* Metrics table */
.metrics-table {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.metrics-table-header {
    padding: 1rem;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-purple);
}

.metrics-table-row {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.metrics-table-row:last-child {
    border-bottom: none;
}

.metrics-table-row .label {
    color: var(--text-secondary);
}

.metrics-table-row .value {
    font-family: 'Monaco', monospace;
    font-weight: 500;
}

/* Error modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
}

.no-data {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem;
}

/* ============================================================
   HEATMAP PAGE
   ============================================================ */
.heatmap-page {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    padding: 5rem 1.5rem 2rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.heatmap-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.heatmap-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.heatmap-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.heatmap-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    min-height: 500px;
    position: relative;
}

#heatmap-plot {
    height: 500px;
    width: 100%;
}

.heatmap-stats {
    display: flex;
    gap: 1rem;
}

.stat-box {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.stat-box .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-box .stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.chip-remove {
    cursor: pointer;
    opacity: 0.6;
    margin-left: 0.25rem;
}

.chip-remove:hover {
    opacity: 1;
}

.tissue-filters {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 200px;
    overflow-y: auto;
}

.tissue-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    cursor: pointer;
    font-size: 0.85rem;
}

.tissue-option input {
    accent-color: var(--accent-purple);
}

.metric-select {
    width: 100%;
    padding: 0.625rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* ============================================================
   COMPARE PAGE
   ============================================================ */
.compare-page {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    padding: 5rem 1.5rem 2rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.compare-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.compare-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.compare-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.compare-stats {
    display: flex;
    gap: 1rem;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: rgba(255,255,255,0.06);
}

.mode-btn.active {
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.filter-section {
    display: block;
}

.mechanism-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 250px;
    overflow-y: auto;
}

.mechanism-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    cursor: pointer;
    font-size: 0.8rem;
}

.mechanism-option input {
    accent-color: var(--accent-purple);
}

#main-plot, #secondary-plot {
    height: 350px;
    width: 100%;
}

/* ============================================================
   ANALYSIS PAGE
   ============================================================ */
.analysis-page {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    padding: 5rem 1.5rem 2rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.analysis-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.analysis-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.analysis-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.analysis-stats {
    display: flex;
    gap: 1rem;
}

.plot-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.plot-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.plot-section .plot-container {
    min-height: 300px;
}

#heatmap-plot {
    height: 400px;
    width: 100%;
}

#barplot {
    height: 300px;
    width: 100%;
}

/* Full width search input for filter panel */
.search-input-full {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-left: 2.5rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.search-input-full:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}

.filter-card .search-box {
    position: relative;
}

.filter-card .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    z-index: 1;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content {
        max-width: 700px;
        margin: 0 auto;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .explorer-container {
        grid-template-columns: 1fr;
    }
    
    .filter-panel,
    .metrics-panel {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .filter-card {
        flex: 1;
        min-width: 250px;
    }
    
    .analysis-page,
    .heatmap-page,
    .compare-page {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .search-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .quick-stats,
    .stats-grid {
        flex-wrap: wrap;
        gap: 1.5rem;
    }
    
    .stats-grid {
        gap: 2rem;
    }
    
    .stat-item .stat-number {
        font-size: 2rem;
    }
    
    nav {
        flex-direction: column;
        gap: 1rem;
    }
}
