/* ═══════════════════════════════════════════════════════════
   SORT VISUALIZER - INTERACTIVE SORTING ALGORITHMS
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --primary-color: #961114;
    --secondary-color: #FFD700;
    --bg-dark: #070707;
    --bg-secondary: #1a1a1a;
    --text-color: #FCF7F8;
    --border-color: rgba(252, 247, 248, 0.1);
    --font-pixel: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', sans-serif;
    
    /* Bar Colors */
    --bar-default: #4A90E2;
    --bar-comparing: #FFD700;
    --bar-swapping: #FF6B6B;
    --bar-sorted: #00FF7F;
    --bar-pivot: #9B59B6;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-color);
    min-height: 100vh;
}

/* ═══ NAVBAR ═══ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(7, 7, 7, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--primary-color);
    z-index: 1000;
}

.navbar-container {
    max-width: 1920px;
    height: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-pixel);
    font-size: 1.2rem;
    color: var(--primary-color);
}

.logo span{
    color: var(--text-color);
}

.logo svg {
    stroke: var(--primary-color);
}

.nav-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* ═══ CONTAINER ═══ */
.container {
    margin-top: 90px;
    padding: 2rem;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 90px);
}

/* ═══ CONTROLS PANEL ═══ */
.controls-panel {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.control-group h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.algo-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.algo-btn {
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(150, 17, 20, 0.3);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    text-align: left;
}

.algo-btn:hover {
    border-color: var(--primary-color);
    background: rgba(150, 17, 20, 0.1);
}

.algo-btn.active {
    border-color: var(--primary-color);
    background: rgba(150, 17, 20, 0.2);
    box-shadow: 0 0 10px rgba(150, 17, 20, 0.3);
}

.slider {
    width: 100%;
    height: 6px;
    background: rgba(150, 17, 20, 0.2);
    border-radius: 3px;
    outline: none;
    margin-bottom: 0.5rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}

.slider-value {
    display: block;
    text-align: right;
    font-weight: 700;
    color: var(--secondary-color);
}

.action-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    border: none;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 0.5rem;
}

.action-btn:hover:not(:disabled) {
    background: #7a0d0f;
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.primary {
    background: var(--secondary-color);
    color: var(--bg-dark);
}

.action-btn.primary:hover:not(:disabled) {
    background: #e6c200;
}

.action-btn.secondary {
    background: var(--bg-dark);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.action-btn.secondary:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

/* Stats Panel */
.stats-panel {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    opacity: 0.7;
}

.stat-value {
    font-weight: 700;
    color: var(--secondary-color);
}

/* ═══ VISUALIZATION PANEL ═══ */
.visualization-panel {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.bars-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    height: 500px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.bar {
    flex: 1;
    background: var(--bar-default);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px 4px 0 0;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bar.comparing {
    background: var(--bar-comparing);
    transform: scaleY(1.05);
}

.bar.swapping {
    background: var(--bar-swapping);
    transform: scaleY(1.1);
}

.bar.sorted {
    background: var(--bar-sorted);
}

.bar.pivot {
    background: var(--bar-pivot);
    transform: scaleX(1.2);
}

/* Algorithm Info */
.algo-info {
    background: rgba(150, 17, 20, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.algo-info h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.algo-info p {
    margin-bottom: 1rem;
    opacity: 0.9;
    line-height: 1.6;
}

.complexity-info {
    display: flex;
    gap: 2rem;
}

.complexity {
    font-size: 0.9rem;
}

.complexity strong {
    color: var(--secondary-color);
    font-family: monospace;
}

/* ═══ LEGEND ═══ */
.legend {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    z-index: 100;
}

.legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.color-box.default { background: var(--bar-default); }
.color-box.comparing { background: var(--bar-comparing); }
.color-box.swapping { background: var(--bar-swapping); }
.color-box.sorted { background: var(--bar-sorted); }
.color-box.pivot { background: var(--bar-pivot); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 1rem;
        margin-top: 80px;
    }
    
    .bars-container {
        height: 350px;
    }
    
    .legend {
        bottom: 10px;
        left: 10px;
        padding: 0.75rem;
    }
}
