* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-section, .action-section, .traversal-section {
    margin-bottom: 15px;
}

.input-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

#nodeValue {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#nodeValue:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-info {
    background-color: #2ecc71;
    color: white;
}

.btn-info:hover {
    background-color: #27ae60;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-traverse {
    background-color: #9b59b6;
    color: white;
    margin-right: 10px;
}

.btn-traverse:hover {
    background-color: #8e44ad;
}

.traversal-section h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.info-panel {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.tree-info, .traversal-result {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tree-info p, .traversal-result p {
    margin-bottom: 8px;
    color: #555;
}

.tree-info span {
    font-weight: bold;
    color: #2c3e50;
}

#traversalOutput {
    font-family: monospace;
    font-size: 18px;
    color: #2c3e50;
    margin-top: 10px;
    padding: 10px;
    background-color: #ecf0f1;
    border-radius: 4px;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.tree-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 400px;
    overflow: auto;
}

#treeSvg {
    width: 100%;
    min-height: 400px;
}

.node {
    cursor: pointer;
}

.node circle {
    fill: #3498db;
    stroke: #2980b9;
    stroke-width: 2px;
    transition: all 0.3s;
}

.node:hover circle {
    fill: #2980b9;
    transform: scale(1.1);
}

.node.highlight circle {
    fill: #e74c3c;
    stroke: #c0392b;
}

.node.found circle {
    fill: #2ecc71;
    stroke: #27ae60;
}

.node.traverse circle {
    fill: #f39c12;
    stroke: #e67e22;
    animation: pulse 0.5s ease-in-out;
}

.node text {
    fill: white;
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.edge {
    stroke: #95a5a6;
    stroke-width: 2px;
    fill: none;
}

.message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s;
}

.message.show {
    transform: translateX(0);
}

.message.success {
    background-color: #2ecc71;
}

.message.error {
    background-color: #e74c3c;
}

.message.info {
    background-color: #3498db;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .info-panel {
        grid-template-columns: 1fr;
    }
    
    .input-section {
        flex-wrap: wrap;
    }
    
    #nodeValue {
        width: 100%;
        margin-bottom: 10px;
    }
}