/* Relation Page Layout */
.graph-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr);
    gap: 24px;
    align-items: start;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.95rem;
    margin-top: 8px;
}

.back-link:hover {
    color: var(--accent);
}

.graph-card {
    transition: none;
}

.graph-container {
    max-width: 1120px;
}

.graph-card:hover {
    transform: none;
    border-color: transparent;
}

.graph-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.graph-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 220px;
    position: relative;
}

.graph-search-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

#graph-search-input {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-main);
}

#graph-search-input:focus {
    outline: 2px solid rgba(56, 189, 248, 0.6);
    outline-offset: 2px;
    border-color: transparent;
}

.graph-search-results {
    list-style: none;
    display: grid;
    gap: 8px;
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 2;
    padding: 12px;
    border-radius: 0 0 14px 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.45);
}

.graph-search-results:empty {
    display: none;
}

.graph-search-results button {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-main);
    cursor: pointer;
}

.graph-search-results button:hover {
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(56, 189, 248, 0.15);
}

#graph {
    height: 420px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.6);
}

.graph-hint {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.details-panel {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    padding: 20px;
}

.details-panel h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}

#details {
    color: var(--text-main);
    overflow-wrap: anywhere;
}

.details-empty {
    color: var(--text-dim);
}

.details-relationship {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
}

.details-type {
    text-transform: capitalize;
    color: var(--accent);
    margin-bottom: 6px;
}

.details-date {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.details-description {
    line-height: 1.5;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.details-description a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legend {
    margin-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 16px;
}

.legend-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.legend ul {
    list-style: none;
    display: grid;
    gap: 10px;
}

.legend li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    display: inline-block;
}

.legend-dot.spinout {
    background: #38bdf8;
}

.legend-dot.subsidiary {
    background: #f59e0b;
}

.legend-dot.acquired {
    background: #ef4444;
}

.legend-dot.backed {
    background: #22c55e;
}

.legend-dot.common {
    background: #a855f7;
}

.legend-dot.alum {
    background: #f472b6;
}

@media (max-width: 600px) {
    .graph-layout {
        grid-template-columns: 1fr;
    }

    #graph {
        height: 360px;
    }
}
