/* * META-MIND UI COMPONENTS v3.1
 * Includes Tabs, Sidebar Layouts, View Modes, and Radial Menu.
 */

/* --- VIEWPORT & STAGE --- */
#stage {
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    height: calc(100vh - 3.5rem);
}

@media (max-width: 768px) {
    #stage {
        flex-direction: column;
    }
}

#viewport {
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    flex: 1;
    display: flex;
    /* For centering content in non-map modes */
    flex-direction: column;
}

/* --- MAP LAYERS --- */
.view-layer-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* --- OTHER VIEW LAYERS --- */
.view-layer-content {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: white;
    padding: 2rem;
    display: none;
    /* Hidden by default */
}

.view-layer-content.active {
    display: block;
}

/* --- SIDEBAR TABS --- */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.sidebar-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    background: #f8fafc;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.sidebar-tab:hover {
    background: #f1f5f9;
}

.sidebar-tab.active {
    background: white;
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.sidebar-panel {
    display: none;
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
}

.sidebar-panel.active {
    display: block;
}

/* --- PHASE VIEW CARDS --- */
.view-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    transition: all 0.2s;
}

.view-card:hover {
    border-color: var(--accent);
    transform: translateX(2px);
}

.view-card.active {
    background: #fff7ed;
    border-color: var(--accent);
}

/* --- NODES & EDGES --- */
#edge-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.edge-vis {
    stroke: #94a3b8;
    stroke-width: 2px;
    fill: none;
    pointer-events: none;
    transition: stroke 0.2s;
}

.edge-vis:hover {
    stroke: var(--accent);
    stroke-width: 4px;
    pointer-events: auto;
    cursor: pointer;
}

.node {
    position: absolute;
    width: 72px;
    height: 72px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10;
    cursor: pointer;
    user-select: none;
}

.node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.2);
    z-index: 20;
}

.node-icon {
    font-size: 24px;
    pointer-events: none;
}

.node-label {
    position: absolute;
    top: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.node:hover .node-label,
.node.selected .node-label {
    opacity: 1;
}

/* --- RADIAL MENU (CRITICAL RESTORATION) --- */
#radial-menu {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
    /* Container lets clicks pass */
    z-index: 100;
    display: none;
    /* No background on container, it's invisible bounds */
}

.radial-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    pointer-events: auto;
    /* Buttons catch clicks */
    font-size: 16px;
    transition: all 0.2s;
}

.radial-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: scale(1.1);
}

/* Satellite Positions (Relative to 200x200 container) */
.r-top {
    top: 10px;
    left: 80px;
}

.r-right {
    top: 80px;
    right: 10px;
}

.r-bottom {
    bottom: 10px;
    left: 80px;
}

.r-left {
    top: 80px;
    left: 10px;
}

/* --- TREE EDITOR STYLES --- */
.tree-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}

.tree-row input {
    width: 100%;
    border: none;
    background: transparent;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.tree-row input:focus {
    outline: none;
    color: var(--accent);
}