/* PhosphoLink Router — vertical layout, agent-adjacent styling */
.router-panel {
    position: fixed;
    bottom: 24px;
    left: var(--network-sidebar-panel-left, 210px);
    right: auto;
    width: 440px;
    max-width: calc(100vw - 48px);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid #ced4da;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    z-index: 45;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.router-panel.has-results {
    max-height: 85vh;
    overflow: hidden;
}
.router-panel.hidden {
    display: none;
}

/* ---- Header ---- */
.router-panel-header {
    padding: 12px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #ced4da;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    flex-shrink: 0;
}
.router-panel-title {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #212529;
}
.router-panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.router-panel-settings,
.router-panel-toggle {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid #ced4da;
    color: #8793a1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.router-panel-settings:hover,
.router-panel-toggle:hover {
    background: #f0f4fa;
    border-color: #4b85c7;
    color: #0d47a1;
}
.router-panel-settings.is-open {
    background: #eef4ff;
    border-color: #0d47a1;
    color: #0d47a1;
}
.router-icon-svg {
    width: 16px;
    height: 16px;
    display: block;
}
.panel-icon-stroke,
.panel-icon-stroke path,
.panel-icon-stroke circle {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.router-icon-settings {
    width: 16px;
    height: 16px;
    opacity: 0.9;
    transition: opacity 0.15s ease;
}
.router-panel-settings:hover .router-icon-settings,
.router-panel-settings.is-open .router-icon-settings {
    opacity: 1;
}

/* ---- Body: stacks vertically ---- */
.router-panel-body {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: #212529;
    font-size: 13px;
    line-height: 1.55;
}

/* ---- Settings panel ---- */
.router-settings {
    flex-shrink: 0;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #ced4da;
}
.router-settings[hidden] {
    display: none !important;
}
.router-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.router-settings-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.router-settings-label {
    font-size: 12px;
    font-weight: 700;
    color: #243140;
}
.router-settings-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #ffffff;
    color: #212529;
    font-size: 13px;
    font-family: inherit;
}
.router-settings-input:focus {
    outline: none;
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.12);
}
.router-settings-group {
    margin-top: 12px;
    padding-top: 12px;
    padding-bottom: 8px;
    border-top: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.router-settings-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.router-settings-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    color: #243140;
    cursor: pointer;
    user-select: none;
}
.router-settings-check input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #0d47a1;
    cursor: pointer;
    flex-shrink: 0;
}
.router-settings-check-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.router-settings-check-label {
    line-height: 1.2;
}
.router-settings-arrow {
    width: 22px;
    height: 12px;
    margin: 0;
    flex-shrink: 0;
}
.router-settings-arrow svg {
    width: 22px;
    height: 12px;
}

/* ---- Query section (top, always visible) ---- */
.router-query {
    flex-shrink: 0;
    padding: 14px 16px 16px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.router-endpoints {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: end;
}
.router-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.router-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.router-field-label label {
    font-size: 12px;
    font-weight: 700;
    color: #243140;
    letter-spacing: 0.01em;
}
.router-route-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 10px;
    color: #adb5bd;
    flex-shrink: 0;
}
.router-route-arrow svg {
    width: 20px;
    height: 20px;
    display: block;
}
.router-select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #ffffff;
    color: #212529;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.router-select:focus {
    outline: none;
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.12);
}

/* Bubble button beside From / To labels */
.router-bubble-btn {
    position: relative;
    width: 14px;
    height: 14px;
    padding: 0;
    border: 1px solid #ced4da;
    border-radius: 50%;
    background: #ffffff;
    color: #0d47a1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.router-bubble-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
}
.router-bubble-btn:hover {
    background: #eef4ff;
    border-color: #4b85c7;
    transform: scale(1.08);
}
.router-bubble-btn::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    transform: translateX(-50%) scale(0.95);
    padding: 4px 8px;
    border-radius: 6px;
    background: #212529;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 2;
}
.router-bubble-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.router-find-btn {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #ffffff;
    color: #0d47a1;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.router-find-btn:hover:not(:disabled) {
    background: #f0f4fa;
    border-color: #4b85c7;
}
.router-find-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.router-footer {
    flex-shrink: 0;
    padding: 10px 16px;
    border-top: 1px solid #ced4da;
    background: #f8f9fa;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.router-footer[hidden] {
    display: none !important;
}
.router-footer-status {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #6c757d;
}
.router-panel:not(.has-results) .router-footer .router-add-btn {
    display: none;
}
.router-footer-status.is-error {
    color: #b91c1c;
}

/* ---- Results section (bottom, expands downward) ---- */
.router-panel.has-results .router-results-section {
    border-top: 1px solid #ced4da;
}
.router-results-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    flex-shrink: 0;
}
.router-results-section[hidden] {
    display: none !important;
}
.router-add-btn {
    padding: 7px 14px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #ffffff;
    color: #0d47a1;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.router-add-btn:hover:not(:disabled) {
    background: #f0f4fa;
    border-color: #4b85c7;
}
.router-add-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.router-results {
    overflow-y: auto;
    padding: 10px 12px 14px;
}
.router-panel.has-results .router-results {
    max-height: min(380px, 52vh);
}
.router-empty {
    color: #6c757d;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 4px;
    text-align: center;
}

/* ---- Path cards ---- */
.router-path-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.router-path-item:last-child {
    margin-bottom: 0;
}
.router-path-item:hover {
    border-color: #4b85c7;
    background: #f0f4fa;
}
.router-path-item.is-selected {
    border-color: #0d47a1;
    background: #eef4ff;
    box-shadow: 0 0 0 1px rgba(13, 71, 161, 0.08);
}
.router-path-line {
    display: block;
    line-height: 1.65;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.router-gene {
    font-weight: 600;
}
.router-gene.role-kinase { color: #3b82f6; }
.router-gene.role-phosphatase { color: #dc2626; }
.router-gene.role-substrate { color: #64748b; }
.router-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 0 3px;
    flex-shrink: 0;
}
.router-arrow svg {
    width: 26px;
    height: 14px;
    display: block;
}
.router-arrow.role-kinase { color: #2563eb; }
.router-arrow.role-phosphatase { color: #b91c1c; }
