/* Global styles */
@font-face {
    font-family: 'Satoshi-Medium';
    src: url('./fonts/Satoshi-Medium.woff2') format('woff2'),
        url('./fonts/Satoshi-Medium.woff') format('woff'),
        url('./fonts/Satoshi-Medium.ttf') format('truetype');
    font-weight: 500;
    font-display: swap;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Satoshi-Medium', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0e151c;
    color: #e6eaf0;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.page-title {
    text-align: center;
    color: #3498db;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.02em;
}

.panel {
    background: #111921;
    border-radius: 20px;
    box-shadow: 0 4px 24px 0 #000a;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    min-width: 300px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.visualization {
    background: transparent;
    border-radius: 16px;
    padding: 0;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.algo-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.algo-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.algo-btn {
    padding: 8px 16px;
    border: 2px solid #3498db;
    background-color: rgb(44, 41, 41);
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 120px;
}

.algo-btn:hover {
    background-color: #3498db;
    color: white;
}

.algo-btn.active {
    background-color: #3498db;
    color: white;
}

.algo-btn:disabled {
    border-color: #3498db;
    background-color: rgb(44, 41, 41);
    color: #999999;
    cursor: not-allowed;
}

.array-input {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    border: none;
    background: #19222c;
    color: #e6eaf0;
    font-size: 1rem;
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
    box-shadow: 0 1px 2px #0002;
}

.array-input:focus {
    outline: 2px solid #3498db;
}

.speed-group {
    display: flex;
    gap: 0.7rem;
    margin-top: 0.2rem;
    margin-bottom: 0.2rem;
}

.speed-btn {
    flex: 1;
    background: #19222c;
    color: #b6c2d1;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 0;
    font-size: .97rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speed-btn.active {
    background: #3498db;
    color: #fff;
}

.speed-btn:hover:not(.active) {
    background: #232f3d;
    color: #fff;
}

.button-group {
    display: flex;
    gap: 0.7rem;
    margin-top: 0.2rem;
}

.main-btn {
    flex: 1;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 0;
    font-size: .97rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px #0002;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.main-btn:hover:not(:disabled) {
    background: #2176b6;
}

.main-btn:disabled {
    background: #1a232c;
    color: #7a8ca3;
    cursor: not-allowed;
}

.stats {
    margin-top: 1.2rem;
    background: #141c24;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: 0 1px 4px #0002;
}

.stat {
    font-size: 1.1rem;
    color: #b6c2d1;
}

.stat-num {
    color: #2ecc71;
    font-weight: 600;
    margin-left: 0.3rem;
}

.dashboard-panel {
    flex: 1;
    background: #111921;
    border-radius: 20px;
    box-shadow: 0 4px 24px 0 #000a;
    padding: 2rem 2.5rem 2.5rem 2.5rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dashboard-title {
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: 0.01em;
}

#bars-container {
    display: flex;
    align-items: flex-end;
    height: 240px;
    gap: 10px;
    margin-bottom: 0.7rem;
}

.bar {
    flex: 1;
    background: linear-gradient(180deg, #3498db 80%, #2176b6 100%);
    border-radius: 10px 10px 4px 4px;
    transition: background 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    min-width: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    font-weight: 600;
}

.bar.comparing {
    background: linear-gradient(180deg, #e74c3c 80%, #c0392b 100%);
}

.bar.swapping {
    background: linear-gradient(180deg, #f39c12 80%, #e67e22 100%);
}

.bar.sorted {
    background: linear-gradient(180deg, #2ecc71 80%, #27ae60 100%);
    animation: pulse 1.5s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scaleY(1);
    }

    50% {
        transform: scaleY(1.05);
    }

    100% {
        transform: scaleY(1);
    }
}

.sort-complete-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(46, 204, 113, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 100;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#bar-labels {
    display: flex;
    align-items: flex-start;
    justify-content: stretch;
    gap: 10px;
    margin-top: 0.2rem;
}

.bar-label {
    flex: 1;
    text-align: center;
    color: #b6c2d1;
    font-size: 1rem;
    font-weight: 500;
    min-width: 28px;
}

.main-content-row {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    width: 100%;
}

@media (max-width: 900px) {
    .container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .dashboard-panel {
        padding: 1.2rem 0.5rem 1.5rem 0.5rem;
    }

    .panel {
        max-width: 100%;
        min-width: 0;
        padding: 1.2rem 0.7rem 1rem 0.7rem;
    }

    .main-content-row {
        flex-direction: column;
        gap: 1.5rem;
    }
}