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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
      'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
      sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f7fa;
  color: #262730;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  color: #262730;
}

/* Controls Section */
.controls-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.multi-select-group {
  grid-column: span 2;
}

.control-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #49457b;
}

.control-select {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background-color: white;
  color: #262730;
  cursor: pointer;
  transition: border-color 0.2s;
}

.control-select:hover {
  border-color: #ff4b4b;
}

.control-select:focus {
  outline: none;
  border-color: #ff4b4b;
  box-shadow: 0 0 0 1px #ff4b4b;
}

/* Multi-select dropdown */
.multi-select-container {
  position: relative;
}

.multi-select-display {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  min-height: 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  transition: border-color 0.2s;
}

.multi-select-display:hover {
  border-color: #ff4b4b;
}

.multi-select-display.active {
  border-color: #ff4b4b;
  box-shadow: 0 0 0 1px #ff4b4b;
}

.multi-select-display .placeholder {
  color: #a3a3a3;
}

.selected-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: #ff4b4b;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.selected-tag .remove-tag {
  cursor: pointer;
  font-weight: bold;
  margin-left: 0.25rem;
}

.selected-tag .remove-tag:hover {
  opacity: 0.7;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow: hidden;
}

.multi-select-dropdown.active {
  display: block;
}

.multi-select-search {
  padding: 0.5rem;
  border-bottom: 1px solid #e5e5e5;
}

.multi-select-search input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d4d4d8;
  border-radius: 4px;
  font-size: 0.875rem;
}

.multi-select-search input:focus {
  outline: none;
  border-color: #ff4b4b;
}

.multi-select-options {
  max-height: 240px;
  overflow-y: auto;
}

.multi-select-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.multi-select-option:hover {
  background-color: #f5f5f5;
}

.multi-select-option.selected {
  background-color: #fef2f2;
  color: #ff4b4b;
}

.multi-select-option input[type="checkbox"] {
  cursor: pointer;
}

.multi-select-hint {
  font-size: 0.75rem;
  color: #71717a;
  margin-top: 0.25rem;
}

/* Chart Section */
.chart-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  min-height: 550px;
  position: relative;
}

#chartContainer {
  width: 100%;
  height: 500px;
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 500px;
  gap: 1rem;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff4b4b;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

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

.loading-indicator p {
  color: #71717a;
  font-size: 0.875rem;
}

/* Warning Message */
.warning-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background-color: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.warning-icon {
  font-size: 1.5rem;
}

.warning-message span {
  color: #92400e;
}

/* Info Section */
.info-section {
  margin-top: 2rem;
}

.info-section hr {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin-bottom: 1.5rem;
}

.info-section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #262730;
}

.info-section p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #4a5568;
}

.info-section ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1rem;
}

.info-section li {
  margin-bottom: 0.75rem;
  line-height: 1.6;
  color: #4a5568;
  padding-left: 1.5rem;
  position: relative;
}

.info-section li::before {
  content: "•";
  color: #ff4b4b;
  font-weight: bold;
  position: absolute;
  left: 0;
}

.info-section strong {
  color: #262730;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
      padding: 1rem;
  }

  .page-header h1 {
      font-size: 2rem;
  }

  .controls-section {
      grid-template-columns: 1fr;
  }

  .multi-select-group {
      grid-column: span 1;
  }

  #chartContainer {
      height: 400px;
  }

  .chart-section {
      min-height: 450px;
  }

  .loading-indicator {
      height: 400px;
  }
}
