/* Navigation Header */
.nav-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 300;
}

.nav-buttons {
  display: flex;
  gap: 1rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: white;
  color: #667eea;
  border-color: white;
}

.nav-btn.logout-btn {
  background: rgba(220, 53, 69, 0.8);
  border-color: rgba(220, 53, 69, 0.8);
  margin-left: auto;
}

.nav-btn.logout-btn:hover {
  background: rgba(220, 53, 69, 1);
  border-color: rgba(220, 53, 69, 1);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-content h2 {
  margin-top: 0;
  color: #333;
  font-weight: 300;
}

/* Main Content */
main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

main h2 {
  color: #333;
  font-weight: 300;
  margin-bottom: 1rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}

main h3 {
  color: #555;
  font-weight: 400;
  margin: 1.5rem 0 1rem 0;
}

/* Date Time Controls */
.date-time-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e9ecef;
}

.datetime-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 150px;
}

.datetime-group label {
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.datetime-group input,
.datetime-group select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.datetime-group input:focus,
.datetime-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.datetime-group button {
  background: #667eea;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s ease;
}

.datetime-group button:hover {
  background: #5a6fd8;
}

/* State Controls */
.state-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* WebSocket Controls */
.websocket-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e9ecef;
}

.websocket-controls input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 5px;
  flex: 1;
}

.websocket-controls button {
  background: #28a745;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.3s ease;
}

.websocket-controls button:hover {
  background: #218838;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .nav-header h1 {
    font-size: 1.5rem;
  }
  
  .date-time-controls {
    flex-direction: column;
  }
  
  .datetime-group {
    min-width: auto;
  }
  
  .state-controls {
    justify-content: center;
  }
  
  .websocket-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

.power-button {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  outline: none;
  cursor: pointer;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  padding-top: 3px;
  margin: 2px auto;
}

.power-button.off {
  background: radial-gradient(#936666, #433939);
}

.power-button.on {
  background: radial-gradient(#56cd6d, #1f741d);
}

.power-icon {
  font-size: 26px;
  font-weight: bold;
  margin-left: -1px;
}

.state-button {
  margin: auto 5px;
  /*rounded corners*/
  border-radius: 5px;
  background-color: #898e87;
  padding: 4px;
  text-align: center;
}

/* Chart container styles */
#chartsContainer {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

#chartsContainer h2 {
  margin: 20px 0 10px 0;
  color: #333;
  border-bottom: 2px solid #eee;
  padding-bottom: 5px;
}

#chartsContainer canvas {
  margin-bottom: 20px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

/* Responsive design for charts */
@media (max-width: 768px) {
  #chartsContainer {
    width: 95%;
  }
  
  #chartsContainer h2 {
    font-size: 18px;
  }
}

/* Loading indicator */
.loading {
  text-align: center;
  font-size: 18px;
  color: #666;
  margin: 20px 0;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
  0%, 20% {
    color: rgba(0,0,0,0);
    text-shadow:
      .25em 0 0 rgba(0,0,0,0),
      .5em 0 0 rgba(0,0,0,0);
  }
  40% {
    color: #666;
    text-shadow:
      .25em 0 0 rgba(0,0,0,0),
      .5em 0 0 rgba(0,0,0,0);
  }
  60% {
    text-shadow:
      .25em 0 0 #666,
      .5em 0 0 rgba(0,0,0,0);
  }
  80%, 100% {
    text-shadow:
      .25em 0 0 #666,
      .5em 0 0 #666;
  }
}