/* static/css/styles_bnn.css */
:root {
    --repo-bg: var(--color-neutral-100, #fafafa);
    --repo-surface: var(--color-white, #ffffff);
    --repo-surface-muted: var(--color-blue-100, #eef2ff);
    --repo-border: var(--color-neutral-300, #d9d9d9);
    --repo-border-strong: var(--color-neutral-400, #bfbfbf);
    --repo-text: var(--color-neutral-800, #262626);
    --repo-text-soft: var(--color-neutral-600, #595959);
    --repo-primary: var(--color-blue-600, #0025a9);
    --repo-primary-hover: var(--color-blue-500, #325fff);
    --repo-purple: var(--color-purple-600, #6930bb);
    --repo-error: var(--color-red-600, #bf1919);
    --cert-low: var(--color-red-600, #bf1919);
    --cert-mid: var(--color-orange-500, #f5a300);
    --cert-high: var(--color-green-600, #007f1c);
}

html {
    min-height: 100%;
    background: var(--repo-bg);
}

body.repo4eu-tool {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    background:
        linear-gradient(180deg, rgba(238, 242, 255, 0.92) 0%, rgba(250, 250, 250, 1) 44%),
        var(--repo-bg);
    color: var(--repo-text);
    font-family: "Rubik", var(--font-sans, ui-sans-serif, system-ui, sans-serif);
}

.repo4eu-tool *,
.repo4eu-tool *::before,
.repo4eu-tool *::after {
    letter-spacing: 0;
}

.app-container {
    display: grid;
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 24px;
    min-height: 100vh;
    padding: 24px;
}

.tool-panel {
    background: var(--repo-surface);
    border: 1px solid var(--repo-border);
    border-radius: 8px;
    box-shadow: 0 16px 42px rgba(0, 19, 85, 0.08);
}

.sidebar {
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px;
}

.tool-header {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    background: var(--repo-primary);
    color: var(--color-blue-600-contrast, #ffffff);
}

.brand-mark i {
    font-size: 28px;
    line-height: 1;
}

.brand-copy {
    min-width: 0;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--repo-text-soft);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.tool-header h1 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    color: var(--repo-text);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.14;
}

.bnn-badge,
.mc-chip,
.graph-badge {
    cursor: default;
    white-space: nowrap;
}

.subtitle {
    margin-top: 6px;
    color: var(--repo-text-soft);
    font-size: 0.92rem;
    line-height: 1.45;
}

.query-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.form-group label,
.mc-label {
    color: var(--repo-text);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
}

.input-shell {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 14px;
    background: var(--repo-surface);
    border: 1px solid var(--repo-border);
    border-radius: 4px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.input-shell:focus-within {
    background: var(--color-blue-100, #eef2ff);
    border-color: var(--repo-primary);
    box-shadow: 0 0 0 3px rgba(0, 37, 169, 0.12);
}

.input-shell i {
    display: flex;
    color: var(--repo-primary);
    font-size: 20px;
    line-height: 1;
}

.input-shell input {
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--repo-text);
    font-size: 0.95rem;
    line-height: 1.4;
}

.input-shell input::placeholder {
    color: var(--color-neutral-500, #7f7f7f);
}

.mc-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    background: var(--color-neutral-100, #fafafa);
    border: 1px solid var(--repo-border);
    border-radius: 4px;
}

.submit-btn.btn {
    width: 100%;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1.2;
}

.submit-btn .btn-label {
    display: inline-flex;
    align-items: center;
}

.submit-btn:focus-visible {
    outline: 3px solid rgba(50, 95, 255, 0.32);
    outline-offset: 2px;
}

.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: var(--color-white, #ffffff);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--color-red-100, #ffeeee);
    border: 1px solid var(--color-red-400, #ff7777);
    border-radius: 4px;
    color: var(--repo-error);
    font-size: 0.88rem;
    line-height: 1.45;
}

.error-box i {
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: 18px;
}

.metric-panel {
    padding-top: 18px;
    border-top: 1px solid var(--repo-border);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--repo-text);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.35;
}

.section-heading i {
    color: var(--repo-purple);
    font-size: 18px;
}

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

.confidence-card .section-heading {
    justify-content: center;
    margin-bottom: 14px;
}

.confidence-ring-wrap {
    position: relative;
    display: inline-block;
    width: 88px;
    height: 88px;
}

.confidence-ring {
    width: 88px;
    height: 88px;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--color-neutral-200, #f2f2f2);
    stroke-width: 7;
}

.ring-fill {
    fill: none;
    stroke: var(--repo-primary);
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dasharray 0.8s ease, stroke 0.8s ease;
}

.confidence-pct {
    position: absolute;
    top: 50%;
    left: 50%;
    color: var(--repo-text);
    font-size: 1.12rem;
    font-weight: 700;
    transform: translate(-50%, -50%);
}

.confidence-sub {
    margin-top: 10px;
    color: var(--repo-text-soft);
    font-size: 0.78rem;
    line-height: 1.45;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend-bar {
    display: grid;
    grid-template-columns: auto minmax(72px, 1fr) auto;
    align-items: center;
    gap: 10px;
    color: var(--repo-text-soft);
    font-size: 0.8rem;
}

.leg-gradient {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--cert-low), var(--cert-mid), var(--cert-high));
}

.legend-title {
    margin-top: 4px;
    color: var(--repo-text);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.35;
}

.legend-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    color: var(--repo-text-soft);
    font-size: 0.82rem;
    line-height: 1.35;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--color-white, #ffffff), 0 0 0 3px var(--repo-border);
}

.dot.drug {
    background: var(--color-blue-600, #0025a9);
}

.dot.disorder {
    background: var(--color-red-600, #bf1919);
}

.dot.gene {
    background: var(--color-green-600, #007f1c);
}

.dot.protein {
    background: var(--color-orange-500, #f5a300);
}

.dot.go {
    background: var(--color-purple-600, #6930bb);
}

.graph-container {
    min-width: 0;
}

.graph-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 48px);
    overflow: hidden;
}

.graph-toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--repo-border);
}

.graph-toolbar h2 {
    color: var(--repo-text);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
}

.graph-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 620px;
    background:
        linear-gradient(to right, rgba(217, 217, 217, 0.7) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(217, 217, 217, 0.7) 1px, transparent 1px),
        linear-gradient(180deg, var(--color-white, #ffffff), var(--color-neutral-100, #fafafa));
    background-size: 36px 36px, 36px 36px, auto;
}

#networkWrapper {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 15;
    width: min(320px, calc(100% - 48px));
    color: var(--repo-text-soft);
    text-align: center;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
}

.empty-state i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: var(--color-blue-100, #eef2ff);
    color: var(--repo-primary);
    font-size: 32px;
}

.empty-state h3 {
    color: var(--repo-text);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.25;
}

.empty-state p {
    margin-top: 8px;
    color: var(--repo-text-soft);
    font-size: 0.92rem;
    line-height: 1.45;
}

.edge-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 260px;
    padding: 12px 14px;
    background: var(--repo-surface);
    border: 1px solid var(--repo-primary);
    border-radius: 4px;
    box-shadow: 0 12px 28px rgba(0, 19, 85, 0.16);
    color: var(--repo-text);
    font-size: 0.82rem;
    line-height: 1.45;
    pointer-events: none;
}

.tt-rel {
    margin-bottom: 6px;
    color: var(--repo-primary);
    font-weight: 700;
}

.tt-cert {
    display: grid;
    grid-template-columns: auto minmax(72px, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.tt-bar-bg {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--color-neutral-200, #f2f2f2);
}

.tt-bar-fill {
    height: 6px;
    border-radius: 999px;
}

div.vis-tooltip {
    padding: 8px 10px !important;
    background: var(--repo-surface) !important;
    border: 1px solid var(--repo-primary) !important;
    border-radius: 4px !important;
    box-shadow: 0 10px 24px rgba(0, 19, 85, 0.14) !important;
    color: var(--repo-text) !important;
    font-family: "Rubik", var(--font-sans, ui-sans-serif, system-ui, sans-serif) !important;
    font-size: 12px !important;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .app-container {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .graph-panel {
        min-height: 620px;
    }

    .graph-stage {
        min-height: 520px;
    }
}

@media (max-width: 560px) {
    .app-container {
        gap: 16px;
        padding: 12px;
    }

    .sidebar {
        padding: 18px;
    }

    .tool-header {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 12px;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    .tool-header h1 {
        font-size: 1.45rem;
    }

    .mc-group,
    .graph-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .graph-toolbar {
        padding: 16px;
    }

    .graph-panel {
        min-height: 540px;
    }

    .graph-stage {
        min-height: 430px;
    }

    .tt-cert {
        grid-template-columns: 1fr;
    }
}
