/**
 * Druck und Fläche Rechner Styles
 * WCAG 2.1 AA Compliant - Optimized for accessibility
 */

.druck-flaeche-calculator-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Calculator Panel */
.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;
}

.formula-text {
  font-family: 'Courier New', monospace;
  font-size: 1.2em;
  font-weight: bold;
  color: #1565c0; /* Darker blue for better contrast */
  background: #fff;
  padding: 10px 15px;
  border-radius: 5px;
  margin: 15px 0;
  text-align: center;
  border: 2px solid #1565c0;
}

/* Input Section */
.input-section {
  margin: 20px 0;
}

.form-group {
  margin-bottom: 20px;
}

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

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group input[type='number'] {
  flex: 1;
  padding: 10px;
  border: 2px solid #8b95a3; /* Darker border for visibility */
  border-radius: 5px 0 0 5px;
  font-size: 16px;
  color: #1a1a1a;
}

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

.input-group select {
  padding: 10px;
  border: 2px solid #8b95a3;
  border-left: none;
  background: #fff;
  border-radius: 0 5px 5px 0;
  min-width: 150px;
  color: #1a1a1a;
}

.input-group select:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.2);
}

/* Buttons */
.btn-primary {
  background: #1565c0; /* Darker blue for better contrast */
  border-color: #1565c0;
  color: #ffffff;
  padding: 12px 30px;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s;
  cursor: pointer;
  border-radius: 5px;
}

.btn-primary:hover {
  background: #0d47a1;
  border-color: #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;
}

/* Result Panel */
.result-panel {
  margin-top: 30px;
  padding: 20px;
  background: #e3f2fd;
  border-left: 5px solid #1565c0;
  border-radius: 5px;
  animation: slideIn 0.3s ease-out;
  border: 2px solid #1565c0;
}

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

.result-panel h3 {
  color: #1565c0;
  margin-top: 0;
}

.result-value {
  font-size: 1.5em;
  margin: 15px 0;
}

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

.result-value .value-highlight {
  color: #1565c0;
  font-weight: 700;
  font-size: 1.3em;
  margin: 0 10px;
}

.result-value select {
  padding: 8px;
  border: 2px solid #1565c0;
  border-radius: 5px;
  background: white;
  font-size: 0.9em;
  margin-left: 10px;
  color: #1a1a1a;
}

.result-value select:focus {
  outline: none;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.2);
}

.comparison-info {
  margin-top: 15px;
  padding: 15px;
  background: white;
  border-radius: 5px;
  border-left: 5px solid #2e7d32; /* Darker green for better contrast */
  border: 2px solid #e0e0e0;
}

.comparison-info p {
  margin: 0;
  color: #1a1a1a;
}

/* Visual Piston Demonstration */
.visual-demo {
  margin-top: 30px;
  padding: 20px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #e0e0e0;
}

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

.piston-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#piston-canvas {
  border: 2px solid #8b95a3; /* Darker border for visibility */
  border-radius: 10px;
  background: white;
}

.piston-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 400px;
}

.piston-controls label {
  font-weight: 600;
  color: #1a1a1a;
  flex: 1;
}

.piston-controls input[type='range'] {
  flex: 2;
  height: 8px;
  border-radius: 5px;
  background: #d1d5db;
  outline: none;
  cursor: pointer;
}

.piston-controls input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1565c0;
  cursor: pointer;
  border: 2px solid #ffffff;
}

.piston-controls input[type='range']::-webkit-slider-thumb:hover {
  background: #0d47a1;
  transform: scale(1.1);
}

.piston-controls input[type='range']::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1565c0;
  cursor: pointer;
  border: 2px solid #ffffff;
}

.piston-controls input[type='range']::-moz-range-thumb:hover {
  background: #0d47a1;
  transform: scale(1.1);
}

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

.piston-controls span {
  min-width: 100px;
  text-align: center;
  font-weight: 600;
  color: #1565c0;
}

.pressure-indicator {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.pressure-bar {
  height: 30px;
  background: #d1d5db;
  border-radius: 15px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid #8b95a3;
}

.pressure-fill {
  height: 100%;
  background: linear-gradient(
    to right,
    #2e7d32,
    #e65100,
    #b91c1c
  ); /* Darker colors for better contrast */
  transition: width 0.3s ease;
  border-radius: 15px;
}

.pressure-indicator p {
  font-size: 1.2em;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

/* Area Visualization */
.area-visualization {
  margin-top: 20px;
}

.area-visual {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 5px;
  border: 2px solid #e0e0e0;
}

.square-demo {
  margin: 20px auto;
  border: 3px solid #1565c0;
  background: rgba(21, 101, 192, 0.1);
  transition: all 0.3s ease;
}

/* Example Cards */
.hydraulic-examples {
  margin: 40px 0;
}

.hydraulic-examples h2 {
  text-align: center;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.hydraulic-examples p.lead {
  text-align: center;
  color: #2d2d2d;
  margin-bottom: 30px;
}

.example-card {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 5px solid #1565c0;
  border: 2px solid #e0e0e0;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
  height: 100%;
}

.example-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.example-card h3 {
  color: #1565c0;
  margin-bottom: 15px;
}

.example-values {
  background: white;
  padding: 15px;
  border-radius: 5px;
  margin-top: 15px;
  border: 2px solid #e0e0e0;
}

.example-values p {
  margin: 8px 0;
  color: #1a1a1a;
}

.example-values strong {
  color: #1a1a1a;
}

/* Educational Info */
.educational-info {
  margin: 40px 0;
}

.educational-info h2 {
  text-align: center;
  color: #1a1a1a;
  margin-bottom: 30px;
}

.info-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 5px solid #2e7d32; /* Darker green for better contrast */
  border: 2px solid #e0e0e0;
  height: 100%;
}

.info-card h3 {
  color: #2e7d32;
  margin-bottom: 15px;
}

.info-card .formula-text {
  font-size: 1em;
  margin: 10px 0;
}

.info-card ul,
.info-card ol {
  margin: 10px 0;
  padding-left: 20px;
}

.info-card li {
  margin: 5px 0;
  color: #1a1a1a;
}

/* Tables */
.table {
  background: white;
  border-radius: 5px;
  overflow: hidden;
  border: 2px solid #e0e0e0;
}

.table thead {
  background: #1565c0;
  color: white;
}

.table th {
  font-weight: 600;
  padding: 12px;
  border: 2px solid #0d47a1;
}

.table td {
  padding: 10px 12px;
  border-top: 2px solid #e0e0e0;
  color: #1a1a1a;
}

.table-striped tbody tr:nth-of-type(odd) {
  background: rgba(21, 101, 192, 0.05);
}

.table tbody tr:hover {
  background: rgba(21, 101, 192, 0.1);
}

.table tbody tr:focus {
  outline: 2px solid #1565c0;
  outline-offset: -2px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .druck-flaeche-calculator-container {
    padding: 10px;
  }

  .calculator-panel {
    padding: 20px;
  }

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

  .input-group input[type='number'] {
    border-radius: 5px;
    margin-bottom: 5px;
  }

  .input-group select {
    border-radius: 5px;
    border-left: 2px solid #8b95a3;
  }

  .result-value {
    font-size: 1.2em;
  }

  #piston-canvas {
    width: 100%;
    height: auto;
  }

  .piston-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .piston-controls span {
    text-align: center;
    margin-top: 5px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .druck-flaeche-calculator-container {
    color: #e0e0e0;
  }

  .calculator-panel {
    background: #1a1a1a;
    border-color: #404040;
  }

  .calculator-panel h2,
  .visual-demo h3,
  .hydraulic-examples h2,
  .educational-info h2 {
    color: #e0e0e0;
  }

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

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

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

  .result-panel {
    background: #2c2c2c;
    border-left-color: #64b5f6;
    border-color: #404040;
  }

  .result-panel h3 {
    color: #64b5f6;
  }

  .result-value .label {
    color: #e0e0e0;
  }

  .result-value .value-highlight {
    color: #64b5f6;
  }

  .comparison-info {
    background: #2c2c2c;
    border-left-color: #2e7d32;
    border-color: #404040;
  }

  .comparison-info p {
    color: #e0e0e0;
  }

  .example-card,
  .info-card {
    background: #1a1a1a;
    border-left-color: #64b5f6;
    border-color: #404040;
  }

  .example-card h3,
  .info-card h3 {
    color: #64b5f6;
  }

  .example-values {
    background: #2c2c2c;
    border-color: #404040;
  }

  .example-values p,
  .example-values strong {
    color: #e0e0e0;
  }

  .visual-demo {
    background: #1a1a1a;
    border-color: #404040;
  }

  #piston-canvas {
    border-color: #404040;
  }

  .piston-controls label {
    color: #e0e0e0;
  }

  .piston-controls input[type='range'] {
    background: #404040;
  }

  .piston-controls span {
    color: #64b5f6;
  }

  .pressure-bar {
    background: #404040;
    border-color: #555;
  }

  .pressure-indicator p {
    color: #e0e0e0;
  }

  .area-visual {
    background: #2c2c2c;
    border-color: #404040;
  }

  .square-demo {
    border-color: #64b5f6;
    background: rgba(100, 181, 246, 0.1);
  }

  .hydraulic-examples p.lead {
    color: #c0c0c0;
  }

  .info-card li {
    color: #c0c0c0;
  }

  .table {
    background: #1a1a1a;
    border-color: #404040;
    color: #e0e0e0;
  }

  .table thead {
    background: #0d47a1;
  }

  .table th {
    border-color: #0d47a1;
  }

  .table td {
    border-color: #404040;
    color: #e0e0e0;
  }

  .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(100, 181, 246, 0.1);
  }

  .table tbody tr:hover {
    background: rgba(100, 181, 246, 0.15);
  }
}
