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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #4fc3f7, #29b6f6, #0288d1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

select, button, input[type="range"] {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(79, 195, 247, 0.5);
    border-radius: 10px;
    color: rgb(255, 255, 255);
    padding: 8px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
}

select, button {
    cursor: pointer;
}

select:hover, button:hover {
    background: rgba(79, 195, 247, 0.3);
    border-color: #4fc3f7;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

input[type="range"] {
    width: 120px;
    height: 8px;
    background: rgba(79, 195, 247, 0.3);
    outline: none;
    border-radius: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4fc3f7;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4fc3f7;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 25px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4fc3f7;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 5px;
}

.visualization-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 30px;
    min-height: 400px;
    display: flex;
    align-items: end;
    justify-content: center;
    overflow: hidden;
}

.bar {
    margin: 0 1px;
    background: linear-gradient(180deg, #4fc3f7 0%, #29b6f6 50%, #0288d1 100%);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 10px rgba(79, 195, 247, 0.4);
}

.bar.comparing {
    background: linear-gradient(180deg, #ff6b6b 0%, #ee5a52 50%, #e53935 100%);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.6);
    transform: scale(1.05);
}

.bar.swapping {
    background: linear-gradient(180deg, #ffd93d 0%, #ffc107 50%, #ff9800 100%);
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.6);
    transform: scale(1.1) translateY(-10px);
}

.bar.sorted {
    background: linear-gradient(180deg, #4caf50 0%, #43a047 50%, #388e3c 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.6);
}

.bar.pivot {
    background: linear-gradient(180deg, #9c27b0 0%, #8e24aa 50%, #7b1fa2 100%);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.6);
    transform: scale(1.1);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.bar.active {
    animation: pulse 0.6s infinite;
}

.algorithm-info {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    text-align: center;
}

.algorithm-info h3 {
    color: #4fc3f7;
    margin-bottom: 10px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .legend {
        gap: 15px;
    }
    
    .visualization-container {
        padding: 20px;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .control-group {
        flex-direction: column;
        text-align: center;
    }
    
    .legend {
        flex-direction: column;
        gap: 10px;
    }
}