/*!
 * Sorting Algorithm Visualizer - Modern Neumorphism Design
 * Built with: Rust + WebAssembly
 */

:root {
    --primary: #f0f2f5;
    --secondary: #e3e7ed;
    --accent: #4f46e5;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-light: #ffffff;
    --shadow-dark: #d1d9e6;
    --neu-distance: 20px;
    --neu-intensity: 0.15;
}

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

body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--primary);
    height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
}

.container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    height: 100vh;
    padding: 20px;
    max-width: 100vw;
}

.header {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 10px;
}

.header h1 {
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar {
    background: var(--primary);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        inset -5px -5px 10px var(--shadow-light),
        inset 5px 5px 10px var(--shadow-dark);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.control-section {
    background: var(--primary);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 
        5px 5px 10px var(--shadow-dark),
        -5px -5px 10px var(--shadow-light);
}

.control-section h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

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

.stats {
    background: var(--primary);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Neumorphism Button Styles */
button {
    background: var(--primary);
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 
        6px 6px 12px var(--shadow-dark),
        -6px -6px 12px var(--shadow-light);
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 8px;
}

button:hover {
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    transform: translateY(-1px);
}

button:active {
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
}

button.primary {
    background: var(--accent);
    color: white;
    box-shadow: 
        6px 6px 12px rgba(79, 70, 229, 0.3),
        -6px -6px 12px rgba(79, 70, 229, 0.1);
}

button.primary:hover {
    box-shadow: 
        4px 4px 8px rgba(79, 70, 229, 0.3),
        -4px -4px 8px rgba(79, 70, 229, 0.1);
}

/* Neumorphism Input Styles */
select, input[type="text"], input[type="range"] {
    background: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 10px 15px;
    color: var(--text-primary);
    font-size: 0.875rem;
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    outline: none;
    width: 100%;
    margin-bottom: 10px;
}

select:focus, input[type="text"]:focus {
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light),
        0 0 0 2px var(--accent);
}

input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: var(--secondary);
    border-radius: 3px;
    box-shadow: 
        inset 2px 2px 4px var(--shadow-dark),
        inset -2px -2px 4px var(--shadow-light);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 
        2px 2px 4px var(--shadow-dark),
        -2px -2px 4px var(--shadow-light);
    cursor: pointer;
}

label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    display: block;
}

/* Professional Icon Styling */
.fas, .far, .fab {
    margin-right: 8px;
    font-size: 0.9em;
    opacity: 0.8;
}

.header h1 .fas {
    margin-right: 12px;
    color: var(--accent);
    font-size: 1.2em;
}

.control-section h3 .fas {
    margin-right: 8px;
    color: var(--accent);
    font-size: 0.9em;
}

.stat-label .fas {
    margin-right: 6px;
    font-size: 0.8em;
    color: var(--accent);
}

.credit-label .fas {
    margin-right: 6px;
    font-size: 0.8em;
    color: var(--accent);
}

button .fas {
    margin-right: 6px;
    font-size: 0.85em;
}

button.primary .fas {
    color: rgba(255, 255, 255, 0.9);
}

label .fas {
    margin-right: 6px;
    color: var(--accent);
    font-size: 0.8em;
}

/* Canvas Neumorphism Style */
.canvas-container {
    background: var(--primary);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        inset 8px 8px 16px var(--shadow-dark),
        inset -8px -8px 16px var(--shadow-light);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    border-radius: 15px;
    background: var(--secondary);
    box-shadow: 
        4px 4px 8px var(--shadow-dark),
        -4px -4px 8px var(--shadow-light);
    max-width: 100%;
    max-height: 100%;
}

/* Algorithm Info Section */
.algorithm-info {
    background: var(--primary);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 
        5px 5px 10px var(--shadow-dark),
        -5px -5px 10px var(--shadow-light);
    margin-bottom: 15px;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.info-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

#info-toggle {
    padding: 8px 12px;
    font-size: 0.8rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 
        3px 3px 6px rgba(79, 70, 229, 0.3),
        -3px -3px 6px rgba(79, 70, 229, 0.1);
    width: auto;
    margin-bottom: 0;
}

#info-toggle:hover {
    box-shadow: 
        2px 2px 4px rgba(79, 70, 229, 0.3),
        -2px -2px 4px rgba(79, 70, 229, 0.1);
}

.info-content {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

.info-content.hidden {
    display: none;
}

.info-description p {
    margin-bottom: 10px;
    line-height: 1.5;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.info-description p:last-child {
    margin-bottom: 0;
}

/* Credits Section */
.credits {
    background: var(--primary);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 
        inset 3px 3px 6px var(--shadow-dark),
        inset -3px -3px 6px var(--shadow-light);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.credit-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}

.credit-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credit-item a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    transition: color 0.2s;
}

.credit-item a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.credit-item strong {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        padding: 15px;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .sidebar {
        max-height: none;
        overflow-y: visible;
    }
    
    .stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .credits {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .algorithm-info {
        padding: 12px;
    }
    
    .info-header h3 {
        font-size: 1rem;
    }
    
    #canvas {
        width: 100%;
        height: 300px;
    }
    
    .canvas-container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        gap: 10px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .credits {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .control-section {
        padding: 12px;
    }
    
    .control-section h3 {
        font-size: 0.9rem;
    }
    
    button {
        padding: 10px 16px;
        font-size: 0.8rem;
    }
    
    #canvas {
        height: 250px;
    }
}