/* ==================== NONLINEAR PAGE STYLES ==================== */

/* Tree Visualization */
.tree-visual {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
    position: relative;
}

.tree-node {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
    position: absolute;
    transition: all var(--transition-base);
    animation: fadeIn 0.3s ease;
}

.tree-node:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.tree-node.highlight {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    animation: pulse 0.5s ease;
}

.tree-line {
    position: absolute;
    height: 2px;
    background: var(--text-secondary);
    transform-origin: left center;
}

/* Graph Visualization */
.graph-visual {
    min-height: 400px;
    position: relative;
}

.graph-node {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: var(--shadow-md);
    position: absolute;
    transition: all var(--transition-base);
    cursor: pointer;
}

.graph-node:hover {
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

.graph-node.visited {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
}

.graph-edge {
    position: absolute;
    height: 3px;
    background: var(--text-secondary);
    transform-origin: left center;
    z-index: -1;
}

.graph-edge.directed::after {
    content: '▶';
    position: absolute;
    right: 0;
    top: -8px;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Hash Table Visualization */
.hash-visual {
    flex-direction: column;
    align-items: stretch;
    min-height: 300px;
}

.hash-bucket {
    display: flex;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    background: white;
    border-radius: var(--radius-md);
    border: 2px solid var(--light-border);
    min-height: 60px;
}

.hash-index {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 1rem;
    flex-shrink: 0;
}

.hash-items {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.hash-item {
    background: var(--light-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease;
}

.hash-item strong {
    color: var(--primary-color);
}

/* Heap Visualization */
.heap-visual {
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
}

.heap-level {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.heap-node {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease;
}

.heap-node.max {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

/* Responsive */
@media (max-width: 768px) {
    .tree-node,
    .heap-node {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }
    
    .graph-node {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .hash-bucket {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hash-index {
        margin-bottom: 0.5rem;
    }
}