/* style.css */

body {
  font-family: 'Segoe UI', sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f0f4f8;
}

.tab {
  display: none
}

.tab.active {
  display: block;
}

header {
  background-color: #77a8c6;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-header button {
  padding: 6px 16px;
  background-color: #d6cbf6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.right-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.right-header button {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  background-color: #bfbce0;
  cursor: pointer;
  font-weight: bold;
}

.container {
  display: flex;
  justify-content: space-around;
  margin-top: 30px;
  padding: 0 40px;
}

.column {
  width: 45%;
}

h2 {
  color: #1b2a41;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 10px;
}

.status-box {
  background-color: #b3d3ee;
  padding: 20px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.control-box {
  background-color: #b3d3ee;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 20px;
}

.toggle-switch {
  width: 50px;
  height: 25px;
  background-color: #ccc;
  border-radius: 25px;
  position: relative;
  cursor: pointer;
  margin: 10px auto;
}

.toggle-switch::before {
  content: '';
  width: 22px;
  height: 22px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  top: 1.5px;
  left: 2px;
  transition: 0.3s;
}

.toggle-switch.on {
  background-color: #4cd964;
}

.toggle-switch.on::before {
  transform: translateX(25px);
}

.auto-toggle {
  padding: 10px 20px;
  background-color: white;
  border: 2px solid #333;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
}

.icon {
  font-size: 18px;
}

/* Login tab */
#login {
  padding: 50px;
  text-align: center;
}

#login input {
  padding: 10px;
  margin: 10px;
  width: 200px;
}

#login button {
  padding: 10px 20px;
  font-weight: bold;
}

#signup {
  padding: 50px;
  text-align: center;
}

#signup input {
  padding: 10px;
  margin: 10px;
  width: 200px;
}

#signup button {
  padding: 10px 20px;
  font-weight: bold;
}

/* Chart tab */
#chart {
  padding: 20px;
  text-align: center;
}

canvas {
  max-width: 90%;
  height: 300px;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-label {
  font-size: 18px;
  font-weight: bold;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  background-color: #d6cbf6;
  font-weight: bold;
  cursor: pointer;
}

.control-box.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-label {
  font-weight: bold;
  font-size: 18px;
}

.control-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.control-btn {
  padding: 6px 12px;
  background-color: white;
  border: 2px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.control-btn:hover {
  background-color: #eee;
}

#fanThresholdOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* Làm mờ nền */
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#fanThresholdOverlay.active {
  display: flex;
}

#lightThresholdOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5); /* Làm mờ nền */
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#lightThresholdOverlay.active {
  display: flex;
}


.popup {
  background: #fff;
  padding: 30px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  width: 320px;
  max-width: 90%;
  text-align: left;
}

.popup h3 {
  margin-top: 0;
  text-align: center;
  color: #1b2a41;
}

.popup label {
  display: block;
  margin-bottom: 20px;
  font-weight: bold;
}

.popup input[type="range"] {
  width: 100%;
}

.popup span {
  display: inline-block;
  margin-top: 5px;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.popup button {
  margin-top: 10px;
  padding: 8px 16px;
  background-color: #77a8c6;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  color: white;
  cursor: pointer;
  width: 100%;
}

.popup button:hover {
  background-color: #5e93b0;
}

#fanThresholdOverlay.active ~ #dashboard {
  filter: blur(30px);
  pointer-events: none;
  user-select: none;
}

#lightThresholdOverlay.active ~ #dashboard {
  filter: blur(30px);
  pointer-events: none;
  user-select: none;
}

#dashboard.blurred {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.settings-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.settings-section h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.btn {
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn:hover {
    opacity: 0.8;
}

.status-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    display: none;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.range-input {
    width: 100%;
}

.range-value {
    font-weight: bold;
    color: #4CAF50;
}

.auto-control-toggle {
  width: 60px;
  height: 30px;
  background-color: grey;
  border: none;
  border-radius: 15px;
  color: white;
  cursor: pointer;
}

.auto-control-toggle.enabled {
  background-color: green;
}
