/*
 * overlays.css — visual styling for the overlay system (Sprint 2 Phase 6).
 *
 * Covers everything the overlay JS emits:
 *   - GtexTissuePanel.render() output (.gtex-tissue-panel and children)
 *   - <source-chip> custom element
 *   - NotForClinicalUseBanner auto-mounted node
 *   - ProvenanceStore.renderCitationModal() output
 *
 * Loaded by web/app/index.html AFTER style.css so overlay selectors take
 * precedence on the rare class overlap. The palette mirrors chromly's
 * existing dark theme: slate-900 backgrounds, violet accents, slate-200
 * text. Color contrast targets WCAG AA on the slate-900 background.
 *
 * Sprint 2 Phase 6 — Phase 4/5 emit the DOM; this file styles it.
 */

/* ──────────────────────────────────────────────────────────────────────
 * GTEx tissue panel
 * ────────────────────────────────────────────────────────────────────── */

.gtex-tissue-panel {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 8px;
    padding: 14px 16px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

.gtex-tissue-panel-empty {
    text-align: left;
}

.gtex-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.4);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.gtex-panel-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.gtex-tau-line {
    font-size: 13px;
    color: #cbd5e1;
    margin: 8px 0 6px;
}

.gtex-tau-line a {
    color: #a78bfa;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gtex-tau-line a:hover {
    color: #c4b5fd;
}

.gtex-axis-label {
    font-size: 12px;
    color: #94a3b8;
    margin: 6px 0 2px;
}

.gtex-bar-caveat {
    font-size: 11px;
    /* Was #64748b (~3.4:1 on slate-900, fails WCAG AA). #94a3b8 reaches
       ~6:1. Codex + Gemini convergent Sprint 2 Phase 6 HIGH finding. */
    color: #94a3b8;
    font-style: italic;
    margin: 0 0 10px;
}

.gtex-empty-text {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    margin: 8px 0 0;
}

/* Tissue list as a scrollable bar chart */

.gtex-tissue-list {
    list-style: none;
    padding: 0;
    margin: 6px 0;
    max-height: 380px;
    overflow-y: auto;
}

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

.gtex-tissue-list::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.5);
    border-radius: 3px;
}

.gtex-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 3px 2px;
    font-size: 12px;
}

.gtex-row + .gtex-row {
    border-top: 1px solid rgba(71, 85, 105, 0.15);
}

.gtex-tissue-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #cbd5e1;
}

.gtex-bar {
    display: block;
    background: rgba(71, 85, 105, 0.35);
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
}

.gtex-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #c4b5fd);
    /* width is set inline by the JS as a per-row percentage */
}

@media (prefers-reduced-motion: no-preference) {
    .gtex-bar-fill {
        transition: width 0.2s ease;
    }
}

.gtex-tpm {
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
}

/* EBV cell-line artifact footnote — amber warning callout */

.gtex-ebv-footnote {
    background: rgba(217, 119, 6, 0.12);
    border-left: 3px solid #d97706;
    color: #fcd34d;
    padding: 8px 12px;
    margin: 12px 0 4px;
    font-size: 11px;
    line-height: 1.5;
    border-radius: 4px;
}

/* Not-measured pills — muted, low-emphasis */

.gtex-not-measured-wrap {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(71, 85, 105, 0.25);
}

.gtex-not-measured-label {
    font-size: 11px;
    /* Was #64748b (fails WCAG AA on slate-900). Same fix as .gtex-bar-caveat. */
    color: #94a3b8;
    margin: 0 0 6px;
}

.gtex-not-measured {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gtex-not-measured-pill {
    background: rgba(71, 85, 105, 0.4);
    color: #94a3b8;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    cursor: help;
}

/* ──────────────────────────────────────────────────────────────────────
 * Source-chip custom element
 * ────────────────────────────────────────────────────────────────────── */

source-chip {
    display: inline-block;
}

.source-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #c4b5fd;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.source-chip-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.6);
}

.source-chip-btn .chip-version {
    font-weight: 600;
}

.source-chip-btn .chip-build {
    color: #94a3b8;
    font-size: 10px;
}

.source-chip-btn .chip-cite {
    color: #a78bfa;
    font-size: 10px;
}

/* ──────────────────────────────────────────────────────────────────────
 * Not-for-clinical-use banner (auto-mounted)
 * ────────────────────────────────────────────────────────────────────── */

.not-for-clinical-use-banner {
    background: rgba(220, 38, 38, 0.12);
    border-left: 3px solid #dc2626;
    color: #fca5a5;
    padding: 8px 36px 8px 12px;
    font-size: 11px;
    line-height: 1.5;
    border-radius: 4px;
    margin-bottom: 10px;
    position: relative;
}

.not-for-clinical-use-banner strong {
    color: #fecaca;
    font-weight: 600;
}

.banner-dismiss {
    position: absolute;
    top: 4px;
    right: 6px;
    background: transparent;
    border: none;
    color: #fca5a5;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
}

.banner-dismiss:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #fee2e2;
}

/* ──────────────────────────────────────────────────────────────────────
 * Citation modal (ProvenanceStore.renderCitationModal output)
 * ────────────────────────────────────────────────────────────────────── */

.overlay-citation-modal {
    position: fixed;
    inset: 0;
    z-index: 500; /* above chromly's educational modal (z-index 400) */
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-citation-modal .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.overlay-citation-modal .modal-body {
    position: relative;
    background: rgba(15, 23, 42, 0.98);
    color: #e2e8f0;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 10px;
    padding: 20px 24px;
    max-width: 540px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.overlay-citation-modal h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(71, 85, 105, 0.4);
    padding-bottom: 8px;
}

.overlay-citation-modal dl {
    margin: 0 0 16px;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 12px;
}

.overlay-citation-modal dt {
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 2px;
}

.overlay-citation-modal dd {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
}

.overlay-citation-modal a {
    color: #a78bfa;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.overlay-citation-modal a:hover {
    color: #c4b5fd;
}

.overlay-citation-modal button {
    margin-top: 4px;
    padding: 6px 16px;
    background: rgba(71, 85, 105, 0.4);
    color: #e2e8f0;
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s;
}

.overlay-citation-modal button:hover {
    background: rgba(71, 85, 105, 0.6);
}

/* ──────────────────────────────────────────────────────────────────────
 * gnomAD population-frequency panel (roadmap 2.1)
 * Mirrors the GTEx panel palette; reuses .source-chip-btn and
 * .not-for-clinical-use-banner. All selectors namespaced .gnomad-*.
 * ────────────────────────────────────────────────────────────────────── */

.gnomad-panel {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 8px;
    padding: 14px 16px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.5;
}

.gnomad-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.4);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.gnomad-panel-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.gnomad-verdict {
    font-size: 13px;
    color: #e2e8f0;
    margin: 8px 0 2px;
}

.gnomad-tag {
    font-weight: 700;
}

.gnomad-tag.common { color: #cbd5e1; }
.gnomad-tag.low { color: #a78bfa; }
.gnomad-tag.rare { color: #fcd34d; }
.gnomad-tag.veryrare { color: #fca5a5; }

.gnomad-submeta {
    font-size: 11px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
    margin: 0 0 10px;
}

/* Founder-effect callout — violet accent (distinct from the amber EBV note) */
.gnomad-founder {
    background: rgba(139, 92, 246, 0.12);
    border-left: 3px solid #8b5cf6;
    color: #c4b5fd;
    padding: 8px 12px;
    margin: 8px 0 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 4px;
}

.gnomad-founder strong { color: #e9d5ff; }

.gnomad-axis-label {
    font-size: 12px;
    color: #94a3b8;
    margin: 8px 0 6px;
}

.gnomad-pop-list {
    list-style: none;
    padding: 0;
    margin: 6px 0;
}

.gnomad-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 3px 4px;
    font-size: 12px;
}

.gnomad-row + .gnomad-row {
    border-top: 1px solid rgba(71, 85, 105, 0.15);
}

.gnomad-pop-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #cbd5e1;
}

/* the user's own population row */
.gnomad-row.mine {
    background: rgba(139, 92, 246, 0.10);
    border-radius: 4px;
}

.gnomad-row.mine .gnomad-pop-name {
    color: #e9d5ff;
    font-weight: 600;
}

.gnomad-row.mine .gnomad-bar-fill {
    background: linear-gradient(90deg, #a78bfa, #f0abfc);
}

.gnomad-star { color: #c4b5fd; }

.gnomad-bar {
    display: block;
    background: rgba(71, 85, 105, 0.35);
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
}

.gnomad-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #c4b5fd);
}

@media (prefers-reduced-motion: no-preference) {
    .gnomad-bar-fill { transition: width 0.2s ease; }
}

.gnomad-pop-af {
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
    font-size: 11px;
    text-align: right;
    white-space: nowrap;
}

.gnomad-view3d {
    margin-top: 12px;
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #c4b5fd;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.gnomad-view3d:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.7);
}

.gnomad-foot {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
    margin: 12px 0 0;
}

.gnomad-empty-text {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    margin: 8px 0 0;
}
