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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 20px;
}

.solubility-container {
    max-width: 1400px;
    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, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    line-height: 1.6;
}

main {
    padding: 30px;
}

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

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

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

.chart-display h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.chart-display canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.beaker-legend,
.q-ksp-info,
.curve-info,
.common-ion-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.ion-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.ion-icon.a {
    background: #e74c3c;
}

.ion-icon.b {
    background: #3498db;
}

.solid-icon {
    width: 16px;
    height: 16px;
    background: #95a5a6;
    border-radius: 3px;
    display: inline-block;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95em;
}

.info-item span:first-child {
    font-weight: 600;
    color: #555;
}

.info-item span:last-child {
    color: #2c3e50;
    font-weight: 700;
}

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

.controls-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 600;
}

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

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

.control-group h4 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9em;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    font-size: 0.95em;
    cursor: pointer;
    margin-bottom: 15px;
}

.slider-hint {
    font-size: 0.8em;
    color: #7f8c8d;
    font-style: italic;
    margin-bottom: 12px;
}

.precipitation-display {
    background: #ecf0f1;
    padding: 12px;
    border-radius: 8px;
    margin-top: 12px;
}

.precipitation-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9em;
}

.precipitation-item span:first-child {
    font-weight: 600;
    color: #555;
}

.precipitation-item span:last-child {
    color: #2c3e50;
    font-weight: 700;
}

.precipitate-yes {
    color: #e74c3c !important;
    font-weight: 700;
}

.precipitate-no {
    color: #27ae60 !important;
    font-weight: 700;
}

.preset-btn,
.anim-btn {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover,
.anim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

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

.anim-btn {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.anim-btn:hover {
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.3);
}

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

.formulas-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

.formula-list {
    display: grid;
    gap: 12px;
}

.formula-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.formula-label {
    font-weight: 600;
    color: #555;
    margin-right: 10px;
    min-width: 180px;
}

.formula {
    font-family: 'Courier New', monospace;
    color: #2c3e50;
    background: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.95em;
}

.explanation {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.explanation h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.4em;
    font-weight: 600;
}

.explanation p {
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

.explanation strong {
    color: #2c3e50;
    font-weight: 600;
}

/* Status colors */
.saturated {
    color: #f39c12 !important;
}

.unsaturated {
    color: #27ae60 !important;
}

.precipitate {
    color: #e74c3c !important;
}

/* Language selector styling */
#langSelector {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#languageSelect {
    font-size: 0.9em;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    header .subtitle {
        font-size: 0.95em;
    }

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

    .formula-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .formula-label {
        margin-bottom: 8px;
        min-width: auto;
    }
}
