/* PID Simulator Styles */

:root {
  --primary-color: #4363d8;
  --secondary-color: #666;
  --border-color: #ddd;
  --bg-light: #f9f9f9;
  --text-color: #333;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

.container {
  max-width: 100%;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

h1 {
  font-size: 2em;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--secondary-color);
  font-size: 0.95em;
}

h3 {
  font-size: 1.1em;
  color: var(--text-color);
  margin-bottom: 12px;
  margin-top: 20px;
}

/* Charts */
#charts {
  margin-bottom: 24px;
}

/* Metrics Section */
.metrics-section {
  background: var(--bg-light);
  padding: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.metrics-section h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-icon {
  font-size: 0.9em;
  cursor: help;
  opacity: 0.7;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric-card {
  background: white;
  padding: 12px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
  font-family: 'Courier New', monospace;
}

.metric-value.good {
  color: #3cb44b;
}

.metric-value.warning {
  color: #ffe119;
}

.metric-value.bad {
  color: #e6194b;
}

.metric-desc {
  font-size: 10px;
  color: var(--secondary-color);
  line-height: 1.3;
}

.chart-wrapper {
  margin-bottom: 16px;
  background: var(--bg-light);
  border-radius: 6px;
  padding: 12px;
  border: 1px solid var(--border-color);
  min-height: 160px;
  max-height: 160px;
  overflow: hidden;
}

.chart-title {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
  user-select: none;
  transition: color 0.2s;
}

.chart-title:hover {
  color: var(--primary-color);
}

.chart-title.collapsed {
  color: var(--secondary-color);
}

.chart-canvas {
  width: 100% !important;
  height: 120px !important;
  max-height: 120px !important;
  transition: all 0.3s ease;
}

/* Controls */
.controls-section {
  background: var(--bg-light);
  padding: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  font-weight: 500;
  color: var(--secondary-color);
  min-width: 120px;
}

label span {
  margin-left: 6px;
  display: inline;
}

input[type="number"],
select {
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  background: white;
  transition: border-color 0.2s;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
}

input[type="checkbox"] {
  margin-top: 8px;
  margin-right: 6px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: center;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #3451b8;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background: white;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-light);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:active:not(:disabled) {
  transform: translateY(0);
}

/* Step Response Test Section */
.step-test-section {
  background: #fff8e1;
  padding: 16px;
  border-radius: 6px;
  border: 2px solid #ffd54f;
  margin-top: 16px;
}

.step-test-desc {
  color: var(--secondary-color);
  font-size: 0.9em;
  margin-bottom: 12px;
}

.btn-test {
  background: #ffd54f;
  color: #333;
  border: 1px solid #ffc107;
  font-weight: 600;
}

.btn-test:hover:not(:disabled) {
  background: #ffc107;
  transform: translateY(-1px);
}

.step-status {
  display: inline-block;
  padding: 8px 16px;
  background: white;
  border-radius: 4px;
  font-size: 0.9em;
  font-weight: 600;
  color: #333;
}

.step-status.active {
  background: #4caf50;
  color: white;
}

/* Footer */
footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.9em;
  color: var(--secondary-color);
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

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

  .container {
    padding: 16px;
  }

  h1 {
    font-size: 1.5em;
  }

  .controls {
    gap: 8px;
  }

  label {
    min-width: 100px;
  }

  .chart-canvas {
    height: 100px !important;
    max-height: 100px !important;
  }

  .chart-wrapper {
    min-height: 140px;
    max-height: 140px;
  }

  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .controls {
    flex-direction: column;
  }

  label {
    width: 100%;
  }

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

  button {
    width: 100%;
  }

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

  .metric-value {
    font-size: 20px;
  }
}
