:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding: 2rem;
    overflow-x: hidden;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* 2 Column Layout */
.app-container {
    display: grid;
    grid-template-columns: minmax(500px, 1.2fr) 450px;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    align-items: stretch;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: space-between;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: space-between;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

/* Simulation Section */
.simulation-section {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f8ff; 
    border: 2px solid var(--border-color);
    padding: 1rem;
}

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 650px;
    aspect-ratio: 650 / 750;
}

#simCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Tabs */
.tabs-container {
    margin-bottom: 1.5rem;
}

.tabs {
    display: flex;
    background: var(--bg-color);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    gap: 0.25rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Controls Section */
.sliders-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.slider-header label {
    font-weight: 500;
    font-size: 0.95rem;
}

.value-display {
    background: var(--bg-color);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stats */
.stats-box {
    display: flex;
    justify-content: space-around;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.pressure .stat-value {
    color: var(--danger-color);
}

.collisions .stat-value {
    color: var(--primary-color);
}

/* Info Box */
.info-box {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    background: #f0fdf4;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--success-color);
    line-height: 1.5;
    height: 100px;
    overflow-y: auto;
}

.info-box strong {
    color: #166534;
}

/* Graphs Section */
.graphs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.graphs-header h3 {
    font-size: 1.1rem;
    color: var(--text-main);
}

.outline-btn {
    padding: 0.4rem 0.8rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.outline-btn:hover {
    background: var(--bg-color);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.graphs-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.graph-container {
    position: relative;
    height: 200px;
    width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    .app-header h1 {
        font-size: 1.5rem;
    }
    .card {
        padding: 1rem;
    }
    .tabs {
        flex-wrap: wrap;
    }
    .tab-btn {
        flex: 1 1 calc(50% - 0.5rem);
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    .stats-box {
        flex-direction: column;
        gap: 1rem;
    }
}
