/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Typography */
h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

label {
    font-weight: bold;
    font-size: 1.1em;
}

/* Controls Section */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Form Elements */
select, input, button {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

select, input {
    background: rgba(255,255,255,0.9);
    color: #333;
}

button {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

button:disabled {
    background: #666;
    transform: none;
    cursor: not-allowed;
}

/* Visualizer Section */
.visualizer {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.array-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 400px;
    gap: 2px;
    margin: 20px 0;
}

/* Bar Animations */
.bar {
    background: linear-gradient(to top, #4facfe, #00f2fe);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s ease;
    position: relative;
    min-width: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.bar.comparing {
    background: linear-gradient(to top, #ff9a9e, #fecfef);
    transform: scale(1.1);
}

.bar.swapping {
    background: linear-gradient(to top, #ffeaa7, #fdcb6e);
    transform: scale(1.2);
}

.bar.sorted {
    background: linear-gradient(to top, #00b894, #55efc4);
}

/* Statistics Section */
.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 20px;
}

.stat {
    text-align: center;
    background: rgba(255,255,255,0.1);
    padding: 15px 25px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #ffeaa7;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Algorithm Information */
.algorithm-info {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    backdrop-filter: blur(5px);
}

.info-title {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: #ffeaa7;
}

.complexity {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.complexity-item {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        gap: 15px;
    }

    .array-container {
        height: 300px;
    }

    h1 {
        font-size: 2em;
    }

    .stats {
        flex-direction: column;
        gap: 15px;
    }

    .complexity {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .visualizer {
        padding: 20px;
    }
    
    .control-group {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }
    
    button {
        width: 100%;
        max-width: 200px;
    }
}