/**
 * Chemisches Gleichgewicht Styles
 * WCAG 2.1 AA Compliant - Optimized for accessibility
 */

.chemisches-gleichgewicht-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

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

.calculator-panel h2 {
  color: #1a1a1a;
  margin-bottom: 15px;
}

.simulation-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 20px;
  margin: 20px 0;
}

.simulation-canvas {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  height: auto;
}

.simulation-canvas canvas {
  border: 2px solid #8b95a3;
  border-radius: 8px;
  background: #000;
}

.equilibrium-display {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  margin-top: 20px;
  text-align: center;
}

.equation-display {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  margin-top: 15px;
}

.formula-text {
  font-family: 'Courier New', monospace;
  font-size: 1.1em;
  font-weight: bold;
  color: #1565c0;
  background: white;
  padding: 15px;
  border-radius: 5px;
  border: 2px solid #1565c0;
  display: inline-block;
  margin: 10px 0;
}

.simulation-controls {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  margin-top: 20px;
}

.control-group {
  margin-bottom: 15px;
}

.control-group label {
  font-weight: 600;
  color: #1a1a1a;
  display: block;
  margin-bottom: 8px;
}

.control-group input[type='range'] {
  width: 100%;
  height: 35px;
  background: #f8f9fa;
  border: 2px solid #8b95a3;
  border-radius: 5px;
  cursor: pointer;
}

.control-group input[type='range']:focus {
  outline: 3px solid #ffc107;
  outline-offset: 2px;
}

.control-group button {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s;
  cursor: pointer;
  border-radius: 5px;
  border: none;
}

.btn-primary {
  background: #1565c0;
  color: #ffffff;
}

.btn-primary:hover {
  background: #0d47a1;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary:focus-visible {
  outline: 3px solid #ffc107;
  outline-offset: 2px;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-warning {
  background: #ffc107;
  color: #1a1a1a;
}

.btn-warning:hover {
  background: #e0a800;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover {
  background: #138496;
}

.btn-danger {
  background: #dc3545;
  color: white;
}

.btn-danger:hover {
  background: #c82333;
}

.btn-lg {
  padding: 15px 30px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
  display: block;
}

.equilibrium-results {
  margin-top: 20px;
}

.result-box {
  text-align: center;
  padding: 25px;
  border-radius: 10px;
}

.result-box h4 {
  color: #1565c0;
  margin-bottom: 15px;
}

.equation {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.conc-panel {
  display: flex;
  gap: 10px;
}

.conc-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.conc-input {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.conc-input label {
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 5px;
}

.conc-input input[type='number'] {
  padding: 8px;
  border: 2px solid #8b95a3;
  border-radius: 5px;
  font-size: 14px;
  color: #1a1a1a;
  background: white;
}

.conc-input input[type='number']:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.2);
}

.arrow {
  font-size: 24px;
  font-weight: bold;
  color: #1a1a1a;
  margin: 0 20px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.85em;
  text-transform: uppercase;
}

.badge.equilibrium {
  background: #28a745;
  color: white;
}

.badge.reactants {
  background: #e74c3c;
  color: white;
}

.badge.products {
  background: #2ecc71;
  color: white;
}

.direction-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.direction-label {
  font-weight: 600;
  color: #1a1a1a;
}

.value-display {
  font-size: 1.5em;
  color: #1565c0;
  font-weight: 700;
}

.principle-examples {
  margin-top: 20px;
}

.principle-examples h4 {
  color: #1565c0;
  margin-bottom: 15px;
}

.principle-examples ul {
  margin: 15px 0;
  padding-left: 20px;
  line-height: 1.6;
}

.principle-examples li {
  margin: 10px 0;
  color: #1a1a1a;
}

.principle-examples strong {
  color: #1565c0;
}

.principle-examples .formula-text {
  background: #e3f2fd;
  border-color: #90caf9;
}

.button-group {
  display: flex;
  gap: 10px;
}

.button-group button {
  flex: 1;
}

.button-group label {
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.effect-display {
  font-size: 0.9em;
  color: #1a1a1a;
  margin-top: 10px;
}

.plot-container {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  margin-top: 20px;
}

.plot-container h3 {
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 15px;
}

.plot-wrapper {
  display: flex;
  justify-content: center;
}

.plot-wrapper canvas {
  border: 2px solid #8b95a3;
  border-radius: 8px;
  background: #000;
  max-width: 100%;
}

.plot-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-line {
  width: 30px;
  height: 4px;
  border-radius: 2px;
}

.legend-item span {
  font-weight: 600;
  color: #1a1a1a;
}

.calculation-summary {
  margin: 20px 0;
}

.calculation-steps {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
}

.calculation-steps h4 {
  color: #1565c0;
  margin-bottom: 10px;
}

.calculation-steps p {
  margin: 8px 0;
  color: #1a1a1a;
  font-family: 'Courier New', monospace;
  font-size: 0.95em;
}

.example {
  background: white;
  padding: 20px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  margin-bottom: 20px;
}

.example h5 {
  color: #1565c0;
  margin-bottom: 10px;
}

.example p {
  margin: 10px 0;
  color: #1a1a1a;
  line-height: 1.6;
}

.example .formula-text {
  background: #e3f2fd;
  border-color: #90caf9;
  margin: 10px 0;
}

.example .text-success {
  color: #28a745;
  font-weight: 600;
}

.rule-of-thumb {
  background: #fff3cd;
  padding: 15px;
  border-radius: 10px;
  border-left: 5px solid #ffc107;
  border: 2px solid #ffe082;
  margin: 20px 0;
}

.rule-of-thumb h4 {
  color: #856404;
  margin-bottom: 10px;
}

.rule-of-thumb p {
  margin: 8px 0;
  color: #1a1a1a;
}

.sub {
  vertical-align: sub;
  font-size: 0.7em;
}

.alert {
  padding: 15px 20px;
  border-radius: 8px;
  border: 2px solid;
  margin: 15px 0;
}

.alert-info {
  background: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
}

.alert-success {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.alert-warning {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

.alert h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

.alert p,
.alert ul {
  margin: 8px 0;
  color: inherit;
}

.alert li {
  margin: 5px 0;
}

@media (max-width: 768px) {
  .chemisches-gleichgewicht-container {
    padding: 10px;
  }

  .calculator-panel {
    padding: 15px;
  }

  .simulation-container {
    grid-template-columns: 1fr;
  }

  .equilibrium-display,
  .equation-display {
    padding: 15px;
  }

  .conc-panel {
    flex-direction: column;
  }

  .conc-inputs {
    grid-template-columns: 1fr;
  }

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

  .plot-wrapper {
    flex-direction: column;
  }

  .plot-legend {
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  .chemisches-gleichgewicht-container {
    color: #e0e0e0;
  }

  .calculator-panel,
  .example,
  .principle-examples {
    background: #1a1a1a;
    border-color: #404040;
  }

  .calculator-panel h2,
  .principle-examples h2,
  .educational-content h2 {
    color: #e0e0e0;
  }

  .formula-text {
    background: #2c2c2c;
    color: #64b5f6;
    border-color: #0d47a1;
  }

  .control-group label {
    color: #e0e0e0;
  }

  .control-group input[type='range'],
  .control-group input[type='number'] {
    background: #2c2c2c;
    color: #e0e0e0;
    border-color: #555;
  }

  .control-group input[type='range']:focus {
    outline-color: #64b5f6;
    border-color: #555;
  }

  .control-group input[type='number']:focus {
    outline-color: #64b5f6;
    border-color: #555;
  }

  .equilibrium-results,
  .plot-container {
    background: #1a1a1a;
    border-color: #404040;
  }

  .equilibrium-display .formula-text {
    background: #1a3c5e;
    border-color: #0d47a1;
  }

  .direction-info {
    background: #1a1a1a;
    border-color: #404040;
  }

  .value-display {
    color: #64b5f6;
  }

  .badge.equilibrium {
    background: #1a3c5e;
  }

  .badge.reactants {
    background: #74c3c;
  }

  .badge.products {
    background: #2ecc71;
  }

  .legend-line {
    background: #4a90e2;
  }

  .result-box,
  .calculation-steps,
  .example {
    background: #1a1a1a;
    border-color: #404040;
  }

  .example h5,
  .rule-of-thumb h4 {
    color: #64b5f6;
  }

  .alert-info {
    background: #1a3c5e;
    border-color: #0d47a1;
    color: #b8daff;
  }

  .alert-success {
    background: #1a3c5e;
    border-color: #0d47a1;
    color: #90caf9;
  }

  .alert-warning {
    background: #1a3c5e;
    border-color: #0d47a1;
    color: #ffc107;
  }

  .text-success {
    color: #90caf9;
  }
}
