#searchInput {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
    transition: border-color 0.3s ease;
    background: var(--bg-white);
    color: var(--text-dark);
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Tree View Styles */
.tree-container {
    overflow-x: auto;
    overflow-y: visible;
}

.tree-view {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 80px;
    min-width: fit-content;
}

.layer {
    display: flex;
    justify-content: center;
    gap: 60px;
    position: relative;
}

.node {
    position: relative;
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 30px;
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 10;
}

.node:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    border-color: var(--primary-color);
}

.node.highlighted {
    background: #ffffff !important;
    border-color: var(--primary-color) !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 4px rgba(137, 186, 23, 0.4), 0 8px 24px rgba(137, 186, 23, 0.5) !important;
    animation: pulse 2s ease-in-out infinite;
    transform: scale(1.05);
}

.node.highlighted .rank-number,
.node.highlighted .player-name {
    color: #333 !important;
}

.node.connected {
    border-color: var(--primary-color) !important;
    border-width: 2px !important;
    box-shadow: 0 0 0 4px rgba(137, 186, 23, 0.2) !important;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(137, 186, 23, 0.4), 0 8px 24px rgba(137, 186, 23, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(137, 186, 23, 0.3), 0 12px 32px rgba(137, 186, 23, 0.6);
    }
}

.node.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border-color: #daa520;
    font-weight: bold;
}

.node.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    border-color: #a9a9a9;
}

.node.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e9a96e 100%);
    border-color: #b87333;
}

.rank-number {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
    font-weight: 600;
}

.rank-1 .rank-number {
    color: #8b6914;
}

.rank-2 .rank-number {
    color: #666;
}

.rank-3 .rank-number {
    color: #7d5625;
}

.player-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.rank-1 .player-name,
.rank-2 .player-name,
.rank-3 .player-name {
    color: #333;
}

.tree-view > svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    stroke: var(--connection-line);
    stroke-width: 2;
    fill: none;
    opacity: 0.6;
}

/* List View Styles */
.list-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.list-item:hover {
    background: var(--bg-gray);
}

.list-item.highlighted {
    background: rgba(137, 186, 23, 0.15);
    border-left: 4px solid var(--primary-color);
    padding-left: 16px;
}

.list-rank {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 60px;
}

.list-name {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    color: var(--text-dark);
}

.list-matches {
    font-size: 14px;
    color: var(--text-light);
}

/* Modal for match history */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-dark);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 32px;
}

.close-btn:hover {
    color: var(--text-dark);
    transform: none;
    box-shadow: none;
}

.match-item {
    padding: 15px;
    margin-bottom: 10px;
    background: var(--bg-gray);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.open-matches-view .match-item.highlighted {
    background: rgba(137, 186, 23, 0.15);
    border-left: 4px solid var(--primary-color);
}

.match-item.win {
    border-left-color: #27ae60;
}

.match-item.loss {
    border-left-color: #e74c3c;
}

.match-item.open {
    border-left-color: var(--text-light);
}

.match-opponent {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.match-details {
    font-size: 14px;
    color: var(--text-light);
}

.no-matches {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
    font-style: italic;
}

@media (max-width: 1000px) {
    #searchInput {
        width: 100%;
        min-width: 100%;
        flex: 1 1 100%;
    }

    .layer {
        gap: 40px;
    }

    .node {
        min-width: 80px;
        padding: 15px 20px;
    }

    .player-name {
        font-size: 14px;
    }
}
