/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 100%);
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 40px;
    text-align: center;
    position: relative;
    z-index: 100;
}

.header h1 {
    font-size: 2.5em;
    font-weight: 300;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #3498db, #2ecc71, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease-in-out infinite alternate;
}

.header p {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

@keyframes gradientShift {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(45deg); }
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 140px);
    position: relative;
}

/* Graph Container */
.graph-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(52, 152, 219, 0.1) 0%, transparent 70%);
}

#graph-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#graph-svg:active {
    cursor: grabbing;
}

/* Graph Controls */
.graph-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

/* Stats Panel */
.stats-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ff88;
    border-radius: 8px;
    padding: 12px 16px;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    min-width: 120px;
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: #888;
    margin-right: 8px;
}

.stat-value {
    color: #00ff88;
    font-weight: bold;
    min-width: 30px;
    text-align: right;
}

.control-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    background: rgba(46, 138, 200, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Graph Nodes */
.node {
    cursor: pointer;
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.node:hover {
    stroke-width: 3px;
    filter: brightness(1.3) drop-shadow(0 0 10px currentColor);
}

.node.selected {
    stroke: #fff;
    stroke-width: 4px;
    filter: brightness(1.5) drop-shadow(0 0 15px currentColor);
}

/* Graph Links */
.link {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 2px;
    fill: none;
    transition: all 0.3s ease;
}

.link.highlighted {
    stroke: rgba(52, 152, 219, 0.8);
    stroke-width: 3px;
    filter: drop-shadow(0 0 5px rgba(52, 152, 219, 0.6));
}

/* Node Labels */
.node-label {
    fill: white;
    font-size: 12px;
    font-weight: 500;
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transition: all 0.3s ease;
}

.node-label.large {
    font-size: 14px;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 50;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
}

.sidebar-header h3 {
    font-size: 1.4em;
    font-weight: 300;
    color: #3498db;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.sidebar-content {
    padding: 25px;
    line-height: 1.7;
}

.sidebar-content h1 {
    color: #3498db;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 300;
}

.sidebar-content h2 {
    color: #2ecc71;
    margin: 25px 0 15px;
    font-size: 1.4em;
    font-weight: 400;
}

.sidebar-content h3 {
    color: #f39c12;
    margin: 20px 0 12px;
    font-size: 1.2em;
    font-weight: 500;
}

.sidebar-content p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 15px;
}

.sidebar-content ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.sidebar-content li {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.sidebar-content strong {
    color: #e74c3c;
    font-weight: 600;
}

.sidebar-content a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sidebar-content a:hover {
    color: #5dade2;
    text-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.sidebar-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    margin: 25px 0;
}

.placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    text-align: center;
    margin-top: 50px;
}

/* Footer */
.footer {
    background: rgba(0, 0, 0, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 40px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 350px;
    }
    
    .header h1 {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
    
    .header p {
        font-size: 1em;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
    }
    
    .graph-controls {
        top: 10px;
        left: 10px;
    }
    
    .control-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .footer {
        padding: 12px 20px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    .main-container {
        height: calc(100vh - 120px);
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .sidebar-content {
        padding: 20px;
    }
    
    .sidebar-header {
        padding: 20px;
    }
}

/* Animation для входа узлов */
@keyframes nodeAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.node {
    animation: nodeAppear 0.6s ease-out;
}

/* Анимация для связей */
@keyframes linkAppear {
    0% {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    100% {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
    }
}

.link {
    animation: linkAppear 1s ease-out;
} 