/* ── Cytoscape Network Containers ─────────────────────────────────── */

.cytoscape-container {
    position: relative;
    background: linear-gradient(135deg, #FAFBFC 0%, #F0F2F5 100%);
    border-radius: 12px;
    overflow: hidden;
}

.cytoscape-container .cytoscape-graph {
    border-radius: 12px;
}

/* ── Toolbar Overlay (top-right) ─────────────────────────────────── */

.cyto-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    gap: 8px;
    align-items: center;
}

.cyto-toolbar .form-select,
.cyto-toolbar .form-control {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cyto-toolbar .form-select:focus,
.cyto-toolbar .form-control:focus {
    border-color: #9B59B6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

/* ── Search Overlay (top-left) ───────────────────────────────────── */

.cyto-search {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    width: 220px;
}

.cyto-search .form-control {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 6px 14px 6px 36px;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cyto-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #95A5A6;
    font-size: 0.85rem;
    pointer-events: none;
}

/* ── Ego Mode Banner ─────────────────────────────────────────────── */

.ego-banner {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 2px solid #FFD700;
    border-radius: 25px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2C3E50;
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.25);
    white-space: nowrap;
}

.ego-banner .ego-name {
    color: #9B59B6;
    font-weight: 700;
}

.ego-banner .btn {
    padding: 2px 10px;
    font-size: 0.75rem;
    border-radius: 15px;
}

/* ── Category Legend Overlay (bottom-left) ────────────────────────── */

.cyto-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 15;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cyto-legend .legend-title {
    font-weight: 600;
    color: #7F8C8D;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.65rem;
}

.cyto-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: #2C3E50;
}

.cyto-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Mini Network (Character Profile) ────────────────────────────── */

.mini-network-container {
    position: relative;
    background: linear-gradient(135deg, #FAFBFC 0%, #F0F2F5 100%);
    border-radius: 12px;
    border: 1px solid #E9ECEF;
    overflow: hidden;
    margin-bottom: 16px;
}

.mini-network-container .mini-legend {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.65rem;
}

/* ── Edge Tooltip ────────────────────────────────────────────────── */

.edge-tooltip {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    background: rgba(44, 62, 80, 0.92);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.8rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .cyto-toolbar {
        top: 8px;
        right: 8px;
        flex-wrap: wrap;
        max-width: 200px;
    }

    .cyto-search {
        width: 160px;
    }

    .cyto-legend {
        display: none;
    }

    .ego-banner {
        font-size: 0.75rem;
        padding: 4px 12px;
    }

    .mini-network-container .mini-legend {
        display: none;
    }
}

@media (max-width: 480px) {
    .cyto-search {
        width: 130px;
    }
    .cyto-search .form-control {
        font-size: 0.7rem;
    }
}

/* ── Connections Explorer Card ───────────────────────────────────── */

.connections-explorer-card {
    overflow: hidden;
}

.connections-explorer-header .rc-slider {
    margin-top: 4px;
}

.connections-explorer-tabs .nav-link {
    color: #7F8C8D;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 20px;
    transition: all 0.25s ease;
    font-weight: 500;
}

.connections-explorer-tabs .nav-link:hover {
    color: #9B59B6;
    background: rgba(155, 89, 182, 0.04);
    border-bottom-color: rgba(155, 89, 182, 0.3);
}

.connections-explorer-tabs .nav-link.active {
    color: #9B59B6 !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #9B59B6 !important;
    background: transparent;
}

/* ── Drill-Down Panel ────────────────────────────────────────────── */

.drilldown-panel-card {
    animation: drilldownSlideIn 0.35s ease-out;
    border-left-width: 4px !important;
    border-left-style: solid !important;
}

@keyframes drilldownSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Matrix Slider ───────────────────────────────────────────────── */

.connections-explorer-header .dash-slider .rc-slider-track {
    background-color: #9B59B6;
}

.connections-explorer-header .dash-slider .rc-slider-handle {
    border-color: #9B59B6;
}

.connections-explorer-header .dash-slider .rc-slider-handle:hover,
.connections-explorer-header .dash-slider .rc-slider-handle:active {
    border-color: #7D3C98;
    box-shadow: 0 0 0 4px rgba(155, 89, 182, 0.2);
}

/* ── Responsive: Explorer ────────────────────────────────────────── */

@media (max-width: 768px) {
    .connections-explorer-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .drilldown-panel-card .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .connections-explorer-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }

    .connections-explorer-header > div:last-child {
        width: 100% !important;
    }
}
