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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    min-height: 100vh;
    padding: 20px;
}

.lechatelier-container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.05rem;
    opacity: 0.9;
}

main {
    padding: 30px;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-display {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-display h3 {
    color: #1e293b;
    font-size: 1.05rem;
    margin-bottom: 15px;
    font-weight: 600;
}

canvas {
    width: 100%;
    border-radius: 8px;
    background: white;
    display: block;
}

#moleculeCanvas {
    height: 280px;
}

#concentrationCanvas {
    height: 280px;
}

#barChartCanvas {
    height: 300px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #475569;
}

.legend-color {
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.container-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 12px;
    background: white;
    border-radius: 8px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #475569;
}

#equilibriumStatus {
    font-weight: 600;
    color: #059669;
}

.values-display {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.value-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.value-label {
    font-size: 0.8rem;
    color: #78716c;
    font-weight: 500;
}

.value-value {
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 700;
}

.value-value.blue { color: #3b82f6; }
.value-value.orange { color: #f59e0b; }
.value-value.green { color: #22c55e; }
.value-value.red { color: #ef4444; }

.controls-panel {
    background: #ecfdf5;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    color: #1e293b;
    font-size: 1.4rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-group {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.control-group h4 {
    color: #059669;
    font-size: 0.95rem;
    margin-bottom: 12px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #d1fae5;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    color: #475569;
    font-size: 0.85rem;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #d1fae5;
    outline: none;
    margin-top: 4px;
    margin-bottom: 12px;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #059669;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
    transition: all 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #047857;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #059669;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.4);
    transition: all 0.2s;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: #047857;
}

.select-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #d1fae5;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.select-input:focus {
    border-color: #059669;
}

.condition-btn {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #d1fae5;
    border-radius: 8px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #047857;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.condition-btn:hover {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #059669;
    transform: translateY(-1px);
}

.condition-btn:active {
    transform: translateY(0);
}

.temperature-btn {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #c2410c;
}

.temperature-btn:hover {
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    border-color: #f97316;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.control-button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.control-button.start {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.control-button.start:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.control-button.pause {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.control-button.pause:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.control-button.reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.control-button.reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.preset-btn {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #d1fae5;
    border-radius: 8px;
    background: white;
    color: #059669;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.preset-btn:hover {
    background: #ecfdf5;
    border-color: #059669;
    transform: translateY(-1px);
}

.preset-btn:active {
    transform: translateY(0);
}

.formulas-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.formulas-section h3 {
    color: #1e293b;
    font-size: 1.15rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formula-item {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background: #ecfdf5;
    border-radius: 6px;
    border-left: 3px solid #059669;
}

.formula-label {
    font-weight: 600;
    color: #059669;
    min-width: 160px;
    font-size: 0.9rem;
}

.formula {
    font-family: 'Courier New', monospace;
    color: #475569;
    font-size: 0.9rem;
}

.explanation {
    background: #ecfdf5;
    border-radius: 12px;
    padding: 30px;
}

.explanation h2 {
    color: #047857;
    font-size: 1.6rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.explanation h3 {
    color: #059669;
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.explanation p {
    color: #475569;
    line-height: 1.7;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.explanation strong {
    color: #1e293b;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .visualization-layout {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .values-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    main {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .control-button {
        width: 100%;
    }

    .container-info {
        flex-direction: column;
        gap: 10px;
    }
}
