body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: scroll;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0 10px 0;
    z-index: 10;
}

.site-title {
    font-size: 2.5em;
    font-weight: 700;
    color: #007bff;
    text-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
    margin-bottom: 5px;
}

.page-title {
    font-size: 1.8em;
    font-weight: 600;
    color: #f0f0f0;
    margin-bottom: 10px;
}

.description {
    font-size: 1em;
    color: #b0b0b0;
    margin-bottom: 20px;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    z-index: 10;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.control-btn:hover {
    background: linear-gradient(45deg, #0056b3, #003d80);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.5);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    background: #5a6268;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Algorithm Selector Dropdown */
.algorithm-selector {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    font-weight: 600;
    font-family: 'Inter', sans-serif;

    background: 
        url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 10px center,
        linear-gradient(45deg, #007bff, #0056b3);
    background-size: 20px, auto;
    
    color: white;
    
    /* Hide default dropdown arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 40px;
}

/* Size Controls Container */
.size-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Size Limit Text removed - now part of placeholder */

/* Preset Buttons */
.preset-btn {
    padding: 10px 15px;
    min-width: auto;
    font-size: 0.9em;
}

.preset-btn.active {
    background: linear-gradient(45deg, #28a745, #218838);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.preset-btn.active:hover {
    background: linear-gradient(45deg, #218838, #1e7e34);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.5);
}

/* Custom Size Input */
.custom-size {
    padding: 10px 15px;
    border: 2px solid #007bff;
    border-radius: 8px;
    font-size: 0.9em;
    cursor: text;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: white;
    color: #007bff;
    width: 80px;
    text-align: center;
}

/* Style for number input arrows */
.custom-size::-webkit-inner-spin-button,
.custom-size::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-size[type=number] {
    -moz-appearance: textfield;
}

/* Placeholder styling */
.custom-size::placeholder {
    color: #999;
    opacity: 1;
}

.algorithm-selector:hover:not(:disabled) {
    background: 
        url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 10px center,
        linear-gradient(45deg, #0056b3, #003d80);
    background-size: 20px, auto;

    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.5);
}

.custom-size:hover:not(:disabled) {
    border-color: #6c757d;
    color: #6c757d;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.2);
}

.custom-size:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.algorithm-selector:disabled {
    background: 
        url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 10px center,
        #5a6268;
    background-size: 20px, auto;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.preset-btn:disabled {
    background: #5a6268;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    pointer-events: none;
}

.custom-size:disabled {
    background: #f5f5f5;
    border-color: #ccc;
    color: #999;
    cursor: not-allowed;
    box-shadow: none;
}

.algorithm-selector option {
    background-color: #1a1a1a;
    color: white;
}

.algorithm-selector option:checked,
.algorithm-selector option:hover {
    background-color: #0056b3;
    color: white;
}

.algorithm-selector:focus, .size-selector:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Simulation Container */
.simulation-container {
    position: relative;
    width: 800px;
    height: 400px;
    max-width: 95vw;
    max-height: 50vh;
    border: 3px solid #007bff;
    border-radius: 12px;
    background: #1a1a1a;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.3);
    overflow: hidden;
    padding: 0 10px;
    box-sizing: border-box;
}

 /*Live Stats */
.live-stats {
    position: absolute;
    top: 10px;
    left: 10px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: 0.9em;
    font-weight: 600;
    color: #00ff88;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    box-shadow: none;
    z-index: 10;
}

/*.live-stats span {
    color: #00ff88;
    font-weight: 700;
}*/

/* Bars Container */
.bars-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Gap is now set dynamically via JavaScript */

/* Individual Bar */
.bar {
    background: linear-gradient(to top, #007bff, #00a8ff);
    border-radius: 2px 2px 0 0;
    transition: all 0.3s ease;
    box-shadow: 0 -2px 8px rgba(0, 123, 255, 0.3);
    position: relative;
    flex-shrink: 0;
}

/* Bar widths are now set dynamically via JavaScript */
    border-radius: 1px 1px 0 0;
}

.bar.comparing {
    background: linear-gradient(to top, #ff6b6b, #ff8787);
    box-shadow: 0 -2px 15px rgba(255, 107, 107, 0.6);
}

.bar.swapping {
    background: linear-gradient(to top, #51cf66, #69db7c);
    box-shadow: 0 -2px 15px rgba(81, 207, 102, 0.6);
    animation: swap-pulse 0.3s ease;
}

.bar.sorted {
    background: linear-gradient(to top, #845ec2, #9b7edb);
    box-shadow: 0 -2px 15px rgba(132, 94, 194, 0.6);
}

.bar.pivot {
    background: linear-gradient(to top, #ffd43b, #ffe066);
    box-shadow: 0 -2px 15px rgba(255, 212, 59, 0.6);
}

@keyframes swap-pulse {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(1.2); }
}

/* Info Panel */
.info-panel {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
    background: #333333;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    width: 800px;
    max-width: 95vw;
    box-sizing: border-box;
}

.info-text {
    color: #c0c0c0;
    font-size: 0.9em;
}

.stats {
    color: #007bff;
    font-weight: 600;
    margin-top: 10px;
}

/* Back Button */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(51, 51, 51, 0.9);
    color: #e0e0e0;
    padding: 8px 16px;
    border: 1px solid #444;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.back-btn:hover {
    background: rgba(71, 71, 71, 0.9);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .site-title {
        font-size: 2em;
    }
    .page-title {
        font-size: 1.5em;
    }
    .simulation-container {
        width: 90vw;
        height: 40vh;
        padding: 0 10px;
    }
    .controls {
        gap: 10px;
    }
    .control-btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
    .algorithm-selector {
        padding-right: 35px;
        background-size: 18px, auto;
    }
    .bars-container {
        gap: 1px;
    }
    .bar {
        min-width: 4px;
    }
}