/**
 * 二分查找可视化样式
 * @author changyadai
 */

.container {
    max-width: 900px;
    padding: 25px;
}

.nav-link {
    position: absolute;
    top: 25px;
    left: 25px;
}

/* 目标输入 */
.target-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.target-section label {
    color: rgba(255, 255, 255, 0.7);
}

.target-section input {
    width: 100px;
    padding: 10px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
    text-align: center;
    font-weight: bold;
}

.target-section input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

/* 数组显示 */
.array-section {
    position: relative;
    margin-bottom: 20px;
    padding: 40px 20px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
}

.pointer-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 35px;
}

.pointer-label {
    position: absolute;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.3s ease;
    opacity: 0;
}

.pointer-label.left {
    background: #22c55e;
    color: #fff;
}

.pointer-label.mid {
    background: #fbbf24;
    color: #000;
}

.pointer-label.right {
    background: #ef4444;
    color: #fff;
}

.pointer-label.visible {
    opacity: 1;
}

.array-container {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.array-item {
    width: 42px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
}

.array-item.in-range {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.array-item.out-range {
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.3);
}

.array-item.left {
    border-left: 3px solid #22c55e;
}

.array-item.right {
    border-right: 3px solid #ef4444;
}

.array-item.mid {
    background: rgba(251, 191, 36, 0.4);
    border: 2px solid #fbbf24;
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

.array-item.found {
    background: #22c55e;
    color: #fff;
    transform: scale(1.3);
    animation: foundPulse 0.5s ease-in-out;
}

@keyframes foundPulse {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
}

.array-item.not-found {
    background: rgba(239, 68, 68, 0.3);
    border: 1px solid #ef4444;
}

/* 索引行 */
.index-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 5px;
}

.index-item {
    width: 42px;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

/* 比较信息 */
.comparison-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.compare-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 10px;
}

.compare-box.target {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.compare-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 5px;
}

.compare-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
}

.compare-op {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.compare-op.less { color: #3b82f6; }
.compare-op.greater { color: #ef4444; }
.compare-op.equal { color: #22c55e; }

/* 步骤信息 */
.steps-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.steps-info strong {
    color: var(--accent-cyan);
}
