/* General Reset */
html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Roboto', Arial, sans-serif;
  background-color: #f7f9fc;
  color: #2c3e50;
  overflow: hidden;
}

/* Header Styling */
header {
  background-color: #2c3e50;
  color: white;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

header h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Main Container */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Controls Section */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #dfe6e9;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

#controls:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.control {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.control label {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.control input[type="range"] {
  width: 240px;
  -webkit-appearance: none;
  height: 8px;
  border-radius: 5px;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  outline: none;
  opacity: 0.9;
  transition: opacity .2s;
}

.control input[type="range"]:hover {
  opacity: 1;
}

.control select {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #bdc3c7;
  border-radius: 4px;
  background-color: white;
  transition: border-color 0.3s ease;
}

.control select:focus {
  border-color: #3498db;
  outline: none;
}

button {
  background-color: #1abc9c;
  color: white;
  border: none;
  padding: 0.8rem 1.8rem;
  border-radius: 6px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
  background-color: #16a085;
  transform: translateY(-2px);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  background-color: #95a5a6;
  cursor: not-allowed;
}

/* Canvas Container */
#canvas-container {
  position: relative;
  background-color: #ffffff;
  border: 1px solid #dfe6e9;
  border-radius: 12px;
  overflow: hidden;
  padding: 15px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

#simulation-canvas {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  transition: transform 0.3s;
}

#simulation-canvas:hover {
  transform: scale(1.02);
}

/* Charts Section */
#charts {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 800px;
  margin-top: 2rem;
  padding: 1rem;
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

#metrics-chart {
  max-width: 100%;
  height: 320px;
}

/* Tooltip Styling */
.control-tooltip {
  position: absolute;
  background-color: #34495e;
  color: white;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  border-radius: 5px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 10;
}

.control:hover .control-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  #controls {
    flex-direction: column;
  }

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #2c3e50;
    color: #ecf0f1;
  }

  header {
    background-color: #34495e;
  }

  #controls {
    background-color: #34495e;
    border: 1px solid #2c3e50;
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
  }

  button {
    background-color: #1abc9c;
  }

  button:hover {
    background-color: #16a085;
  }

  #canvas-container {
    background-color: #34495e;
    border: 1px solid #2c3e50;
  }

  #metrics-chart {
    border-color: #bdc3c7;
  }
}
