/**
 * ONYXVECTOR MARROWLINK GRAPH SYSTEM
 * ONYXBONE-themed styling for consciousness network visualizer
 */

/* Import monospace font */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&display=swap');

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    background: #fdf6e3; /* Bone-hued beige */
    color: #2e2e2e;
    overflow: hidden;
    user-select: none;
}

/* Main container */
.marrowlink-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #fdf6e3 0%, #f8f1db 100%);
}

/* Header section */
.marrowlink-header {
    background: rgba(46, 46, 46, 0.95);
    color: #fdf6e3;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #d4a574; /* Marrow tone */
    position: relative;
    z-index: 1000;
}

.marrowlink-title {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(212, 165, 116, 0.5);
}

.marrowlink-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 300;
    letter-spacing: 1px;
}

.admin-status {
    display: flex;
    align-items: center;
}

.admin-badge {
    background: #d4a574;
    color: #2e2e2e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    animation: pulse-glow 2s infinite;
}

.readonly-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fdf6e3;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 300;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(212, 165, 116, 0.5); }
    50% { box-shadow: 0 0 15px rgba(212, 165, 116, 0.8); }
}

/* Controls section */
.marrowlink-controls {
    background: rgba(46, 46, 46, 0.1);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(212, 165, 116, 0.3);
    position: relative;
    z-index: 999;
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 300px;
}

#userSearch {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d4a574;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

#userSearch:focus {
    border-color: #d4a574;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
    background: #fff;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d4a574;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(212, 165, 116, 0.2);
    transition: background 0.2s ease;
}

.search-result-item:hover {
    background: rgba(212, 165, 116, 0.1);
}

.search-result-item:last-child {
    border-bottom: none;
}

.graph-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 6px 12px;
    background: rgba(212, 165, 116, 0.8);
    color: #2e2e2e;
    border: none;
    border-radius: 15px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #d4a574;
    box-shadow: 0 0 8px rgba(212, 165, 116, 0.5);
}

/* Physics toggle button specific styles */
.control-btn.physics-enabled {
    background: rgba(76, 175, 80, 0.8);
    color: #fff;
}

.control-btn.physics-disabled {
    background: rgba(244, 67, 54, 0.8);
    color: #fff;
}

.control-btn.physics-enabled:hover {
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.control-btn.physics-disabled:hover {
    background: #f44336;
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
}

.physics-icon {
    margin-right: 4px;
    font-size: 0.9em;
}

/* Admin panel */
.admin-panel {
    position: fixed;
    top: 80px;
    right: 0;
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background: rgba(46, 46, 46, 0.95);
    color: #fdf6e3;
    border: 1px solid #d4a574;
    border-radius: 10px 0 0 10px;
    padding: 15px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.admin-panel h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #d4a574;
}

.selected-user {
    margin-bottom: 15px;
    padding: 8px;
    background: rgba(212, 165, 116, 0.1);
    border-radius: 5px;
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn.connect {
    background: #4CAF50;
    color: white;
}

.action-btn.disconnect {
    background: #f44336;
    color: white;
}

.action-btn.cancel {
    background: #666;
    color: white;
}

.action-btn:hover {
    opacity: 0.8;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Graph container */
.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.graph-canvas {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #fdf6e3 0%, #f0e9d2 100%);
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(253, 246, 227, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 165, 116, 0.3);
    border-top: 3px solid #d4a574;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.9rem;
    color: #2e2e2e;
    opacity: 0.8;
}

/* Status bar */
.status-bar {
    background: rgba(46, 46, 46, 0.9);
    color: #fdf6e3;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.8rem;
    border-top: 1px solid rgba(212, 165, 116, 0.3);
}

.status-bar span {
    opacity: 0.8;
}

/* Connected node tooltips panel styles */
#connectedTooltipsPanel {
    position: absolute; /* Changed from fixed to absolute */
    left: 0;
    top: 120px; /* Lowered to clear controls/search */
    width: 240px;
    z-index: 1001;
    background: rgba(253,246,227,0.97);
    border-right: 1px solid #d4a574;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.08);
    padding: 10px 0 10px 10px;
    max-height: 80vh;
    overflow-y: auto;
    pointer-events: none;
    display: none;
}

.connected-tooltip-panel {
    background: rgba(253, 246, 227, 0.95);
    border: 1px solid #d4a574;
    border-radius: 4px;
    margin-bottom: 10px;
    padding: 6px 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #2e2e2e;
    max-width: 210px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .marrowlink-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px;
    }
    
    .marrowlink-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .search-container {
        max-width: none;
    }
    
    .admin-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 300px;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 5px;
        font-size: 0.7rem;
    }
}

/* Custom vis-network node styles (applied via JavaScript) */
.vis-network-node-selected {
    box-shadow: 0 0 20px rgba(212, 165, 116, 0.8) !important;
}

/* Tooltip styles */
.marrowlink-tooltip {
    position: absolute;
    background: rgba(46, 46, 46, 0.95);
    color: #fdf6e3;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    pointer-events: none;
    z-index: 2000;
    border: 1px solid #d4a574;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.tooltip-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: #d4a574;
}

.tooltip-bio {
    font-size: 0.7rem;
    opacity: 0.8;
    font-style: italic;
}

.tooltip-follows {
    font-size: 0.7rem;
    margin-top: 4px;
    color: #d4a574;
    font-weight: 500;
}

.vis-network:focus .vis-active, .vis-network .vis-active, .vis-network .vis-hover, .vis-network .vis-selected, .vis-network .vis-hover:active {
    box-shadow: none !important;
    border-color: #d4a574 !important;
    background: #fdf6e3 !important;
}

.vis-network .vis-node:hover, .vis-network .vis-node:focus {
    border-color: #d4a574 !important;
    background: #fdf6e3 !important;
    box-shadow: none !important;
}

/* Hide native vis.js tooltip */
.vis-network-tooltip, .vis-tooltip, [class*="vis-tooltip"] {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    z-index: -9999 !important;
    width: 0 !important;
    height: 0 !important;
    position: fixed !important;
    left: -9999px !important;
    top: -9999px !important;
}