/* Grid Frequency specific styles */

.gauge-container {
  height: 300px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Frequency display style */
.frequency-display {
  font-size: 80px;
  font-weight: 700;
  text-align: center;
  margin: 0;
  line-height: 1;
  background: linear-gradient(45deg, #30a2ff, #8e82fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.frequency-unit {
  font-size: 24px;
  font-weight: 400;
  text-align: center;
  margin-top: 0;
  opacity: 0.8;
}

.frequency-status {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-top: 20px;
  padding: 8px 16px;
  border-radius: 30px;
  display: inline-block;
}

.frequency-status.normal {
  color: white;
  background-color: var(--normal-color);
}

.frequency-status.warning {
  color: white;
  background-color: var(--warning-color);
}

.frequency-status.danger {
  color: white;
  background-color: var(--danger-color);
}

.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-normal {
  background-color: var(--normal-color);
}

.status-warning {
  background-color: var(--warning-color);
}

.status-danger {
  background-color: var(--danger-color);
}

/* Frequency data section */
.frequency-data {
  margin-top: 20px;
  padding: 20px;
  max-height: 500px; /* Increased height to accommodate the legend */
  color: white;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Table container to ensure it doesn't overlap the legend */
.table-container {
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 20px;
}

/* Frequency key legend */
.frequency-key {
  margin-top: auto;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 10;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 10px 10px;
}

.frequency-key .legend-item {
  margin: 5px 0;
}

/* Chart container height */
.chart-container {
  min-height: 400px;
  position: relative;
  margin: 20px 0;
}

/* Toggle button styles */
.toggle-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.toggle-button {
  padding: 8px 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-button.active {
  background: rgba(48, 162, 255, 0.7);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .frequency-display {
    font-size: 60px;
  }
  
  .frequency-unit {
    font-size: 20px;
  }
  
  .frequency-status {
    font-size: 16px;
    padding: 6px 12px;
  }
}

/* Make toggle buttons consistent with compact design */
.compact-controls .toggle-buttons {
  display: flex;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.compact-controls .toggle-button {
  flex: 1;
  padding: 6px 12px;
  font-size: 13px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  margin: 0;
  cursor: pointer;
}

.compact-controls .toggle-button.active {
  background: rgba(48, 162, 255, 0.7);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Legend styling */
.legend {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  padding: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
}

/* Frequency gauge tile */
.frequency-gauge-tile {
  background-color: rgba(103, 58, 183, 0.2);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  margin: 20px auto;
  max-width: 600px;
  text-align: center;
  min-height: 250px; 
}

.frequency-gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Refresh countdown styling */
.refresh-countdown {
  margin-top: 15px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

#countdown-timer {
  font-weight: 700;
  color: white;
}

/* Frequency gauge slider */
.frequency-gauge-slider {
  width: 100%;
  margin: 20px 0 10px;
  position: relative;
  height: 40px;
}

.gauge-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  display: flex;
  overflow: hidden;
  position: relative;
}

.gauge-section {
  height: 100%;
}

/* Adjust the width of each section to match the frequency ranges */
.gauge-critical-low {
  background-color: var(--danger-color);
  width: 25%; /* 49.0-49.5 Hz (0.5 Hz = 25% of 2Hz range) */
}

.gauge-warning-low {
  background-color: var(--warning-color);
  width: 15%; /* 49.5-49.8 Hz (0.3 Hz = 15% of 2Hz range) */
}

.gauge-normal {
  background-color: var(--normal-color);
  width: 20%; /* 49.8-50.2 Hz (0.4 Hz = 20% of 2Hz range) */
}

.gauge-warning-high {
  background-color: var(--warning-color);
  width: 15%; /* 50.2-50.5 Hz (0.3 Hz = 15% of 2Hz range) */
}

.gauge-critical-high {
  background-color: var(--danger-color);
  width: 25%; /* 50.5-51.0 Hz (0.5 Hz = 25% of 2Hz range) */
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  padding: 0 2px;
  position: relative;
  width: 100%;
}

.gauge-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  position: absolute;
  transform: translateX(-50%);
  padding: 5px;
}

/* Position each label at the correct frequency point */
.gauge-label:nth-child(1) {
  left: 0%; /* 49.0 Hz */
}

.gauge-label:nth-child(2) {
  left: 25%; /* 49.5 Hz */
}

.gauge-label:nth-child(3) {
  left: 50%; /* 50.0 Hz */
}

.gauge-label:nth-child(4) {
  left: 75%; /* 50.5 Hz */
}

.gauge-label:nth-child(5) {
  left: 100%; /* 51.0 Hz */
}

.gauge-pointer {
  position: absolute;
  top: -5px;
  left: 50%; /* Default position at 50Hz */
  transform: translateX(-50%);
  transition: left 0.3s ease-out;
}

.pointer-arrow {
  width: 2px;
  height: 16px;
  background-color: #ffffff;
  position: relative;
}

.pointer-arrow:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: -4px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #ffffff;
}

/* Summary stats - add margin to prevent overlap */
.summary-stats {
  margin-top: 50px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 15px;
}
