* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  text-align: center;
  min-width: 300px;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #333;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
}

.modal-content button {
  width: 100%;
  padding: 12px;
  background-color: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.modal-content button:hover {
  background-color: #5568d3;
}

header {
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
}

header h1 {
  color: #333;
  margin-bottom: 10px;
}

header p {
  color: #666;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  background-color: white;
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
  color: #333;
  margin-bottom: 20px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

#deviceSelect {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  margin-bottom: 15px;
}

.device-info {
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 5px;
  margin-top: 10px;
}

.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-button {
  flex: 1;
  min-width: 100px;
  padding: 12px 20px;
  border: none;
  background-color: #f0f0f0;
  cursor: pointer;
  border-radius: 5px 5px 0 0;
  transition: all 0.3s;
}

.tab-button:hover {
  background-color: #e0e0e0;
}

.tab-button.active {
  background-color: #667eea;
  color: white;
}

.day-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.day-controls button {
  padding: 10px 20px;
  border: none;
  background-color: #28a745;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.day-controls button:hover {
  background-color: #218838;
}

.time-window {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  background-color: #fafafa;
}

.window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.window-header input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-right: 10px;
}

.btn-delete {
  padding: 8px 15px;
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.btn-delete:hover {
  background-color: #c82333;
}

.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.time-input-group {
  display: flex;
  flex-direction: column;
}

.time-input-group label {
  margin-bottom: 8px;
  font-weight: bold;
  color: #555;
  font-size: 14px;
}

.time-input-group input[type="text"] {
  padding: 10px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  text-align: center;
}

.time-input-group input[type="text"]:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.time-input-group input[type="text"]:invalid {
  border-color: #dc3545;
}

.alarm-conditions {
  margin-top: 15px;
}

.alarm-conditions h4 {
  margin-bottom: 10px;
  color: #555;
}

.alarm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.alarm-condition {
  display: flex;
  flex-direction: column;
}

.alarm-condition label {
  margin-bottom: 5px;
  font-size: 14px;
  color: #666;
}

.alarm-condition input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

#actionButtons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

#actionButtons button {
  padding: 15px 40px;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.error {
  color: #dc3545;
  margin-top: 10px;
  font-weight: bold;
}

.success {
  color: #28a745;
  font-weight: bold;
}

.validation-issue {
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 5px;
  border-left: 4px solid;
}

.validation-issue.error {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.validation-issue.success {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}


.close-valve-section {
    margin-bottom: 15px;
    padding: 12px;
    background-color: #f0f8ff;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-label span {
    user-select: none;
}

@media (max-width: 768px) {
  .tabs {
    flex-direction: column;
  }
  
  .alarm-grid {
    grid-template-columns: 1fr;
  }
  
  #actionButtons {
    flex-direction: column;
  }
  
  .time-inputs {
    grid-template-columns: 1fr;
  }
}
