body {
  font-family: "Segoe UI", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #101010;
  color: #fff;
  height: 100vh;
  /*overflow: hidden;*/
  overflow-y: auto; /* ✅ thêm dòng này để có thanh cuộn dọc */
}

/* ===== Layout ===== */
.dashboard-container {
  display: flex;
  height: calc(100vh - 60px);
  gap: 10px;
  padding: 10px;
}

/* ===== System Diagram ===== */
.diagram-container {
  flex: 0 0 25%;
  background: #1a1a1a;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  position: relative;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}

.diagram-title {
  font-size: 1.5em;
  font-weight: 600;
  text-align: center;
  color: #ffdd57;
  margin-bottom: 10px;
}

/* Mermaid lines & shapes */
.mermaid svg path,
.mermaid svg line {
  stroke: #ccc !important;
  stroke-width: 2px !important;
}
.mermaid svg rect,
.mermaid svg polygon {
  fill: #2a2a2a !important;
  stroke: #eee !important;
}

/* ===== Sensors Section ===== */
.sensors-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* chia đều khoảng cách */
  overflow: hidden;
  height: 100%;
}

/* ===== Sensor Row ===== */
.sensor-row {
  flex: 1; /* mỗi hàng tự chia đều không gian */
  display: flex;
  align-items: center;
  background: #181818;
  border-radius: 10px;
  padding: 12px 15px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* Chart smaller for value space */
.sensor-row canvas {
  flex: 0 0 65%;
  height: 130px !important;
  background: #111;
  border-radius: 8px;
  margin-right: 10px;
}

/* ===== Value Section ===== */
.value-alert {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 5px;
}

.sensor-value {
  font-size: 2.5em;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
  transition: color 0.3s ease, transform 0.2s ease;
}

.sensor-value.safe {
  color: #4CAF50;
}

.sensor-value.alert {
  color: #ff4444;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1.05); }
  50% { opacity: 0.4; transform: scale(1); }
}

/* ===== Threshold ===== */
label {
  font-size: 0.85em;
  color: #ccc;
}

input[type=number] {
  width: 60px;
  text-align: center;
  font-size: 0.95em;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2b2b2b;
  color: #fff;
}

/* ===== MQTT Status ===== */
#mqttStatus {
  font-size: 0.9em;
  padding-left: 10px;
}
.mqtt-connected { color: #4CAF50; }
.mqtt-disconnected { color: #f44336; }
