* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px;
  background: #f5f5f5;
}

h1 {
  color: #333;
  text-align: center;
  font-size: 1.5rem;
  margin: 10px 0 15px;
}

.controls {
  background: white;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.control-group label {
  font-weight: 500;
  color: #555;
  font-size: 14px;
  min-width: 45px;
}

.control-group input, .control-group select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.control-group input[type="datetime-local"] {
  flex: 1 1 140px;
}

.control-group select {
  flex: 1 1 100px;
}

.control-group button {
  padding: 10px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
}

.control-group button:hover {
  background: #0056b3;
}

.auto-refresh {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auto-refresh input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auto-refresh select {
  flex: 0 1 80px;
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ccc;
  margin-left: 5px;
  flex-shrink: 0;
}

.status-indicator.active {
  background: #28a745;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chart-container {
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  width: 100%;
  min-height: 300px;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 70vh;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Tablet and up */
@media (min-width: 600px) {
  body {
    padding: 15px;
  }
  h1 {
    font-size: 1.75rem;
  }
  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 15px;
    gap: 15px;
  }
  .control-group {
    width: auto;
    flex: 1 1 auto;
  }
  .chart-container {
    padding: 15px;
  }
}

/* Desktop */
@media (min-width: 900px) {
  body {
    padding: 20px;
  }
  h1 {
    font-size: 2rem;
  }
  .controls {
    justify-content: space-between;
    padding: 15px 20px;
  }
  .chart-container {
    padding: 20px;
  }
}
