body {
    margin: 0;
    padding: 0;
    background: radial-gradient(ellipse at bottom, #0d1b2a, #000);
    color: white;
    font-family: 'Orbitron', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

#controls {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    gap: 10px;
    margin: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 229, 0.5);
    flex-wrap: wrap;
}

#main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    width: 100%;
    overflow: auto;
}

#treeWrapper {
    flex: 1;
    position: relative;
    overflow: auto;
    width: 100%;
    min-height: 300px;
}

#treeContainer {
    position: relative;
    min-height: 100%;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

#svgContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#infoPanel {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    box-shadow: 0 0 15px rgba(0, 255, 229, 0.5);
    max-height: 150px;
    overflow: hidden;
}

.tree-node {
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #1e3c72, #2a5298);
    border-radius: 50%;
    color: #fff;
    text-align: center;
    line-height: 40px;
    font-weight: bold;
    border: 2px solid #ccc;
    transition: all 0.3s ease;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 12px;
}

.balance-factor {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: #000;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid #fff;
}

.height-display {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #000;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid #fff;
    color: #ff9d00;
}

#controls button, #controls input {
    padding: 10px 30px;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #1e3c72, #2a5298);
    color: white;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 5px #00ffe5;
    font-size: 12px;
}

#controls button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px #00ffe5;
}

#controls input {
    width: 100px;
    padding: 8px;
}

#operationLog {
    max-height: 100px;
    overflow-y: auto;
    font-size: 12px;
    scrollbar-width: none; 
    -ms-overflow-style: none;
}

.log-entry {
    margin-bottom: 5px;
    padding: 3px;
    border-left: 2px solid #00ffe5;
    padding-left: 5px;
    font-size: 11px;
}

.highlight {
    animation: highlight 0.5s ease;
}

.rotation-highlight {
    background-color: #ff5722 !important;
    box-shadow: 0 0 20px #ff5722 !important;
    transition: all 0.3s ease;
}

.tree-connection {
    stroke: #4a8eff;
    stroke-width: 2;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.tree-node.unbalanced {
    box-shadow: 0 0 8px #ff0000;
}

.tree-node.balanced {
    box-shadow: 0 0 5px #00ffe5;
}

@keyframes highlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}
#operationLog::-webkit-scrollbar {
    display: none;
}

/* Desktop styles */
@media (min-width: 768px) {
    #controls {
        position: fixed;
        top: 20px;
        left: 20px;
        width: auto;
        flex-wrap: nowrap;
        z-index: 100;
        margin: 0;
    }
    
    #main-content {
        margin-top: 80px;
        margin-bottom: 20px;
        margin-left: 20px;
        margin-right: 320px;
        width: 100%;
    }
    
    #treeWrapper {
        margin-right: 0;
    }
    
    #infoPanel {
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 280px;
        max-height: 200px;
        margin: 0;
    }
    
    .tree-node {
        width: 50px;
        height: 50px;
        line-height: 50px;
        font-size: 12px;
    }
    
    .balance-factor, .height-display {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    #operationLog {
        max-height: 150px;
        font-size: 14px;
    }
    
    .log-entry {
        font-size: 14px;
    }
}