/* Sidebar overlay */
.sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 230px;
  height: 100vh;
  background: #292c36;
  color: #fff;
  z-index: 2000;
  transition: left 0.3s ease;
  padding-top: 20px;
}
.sidebar.open {
  left: 0;
}

/* Menu Bubble */
.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-menu li {
  background: #292c36;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}
.sidebar-menu li:hover,
.sidebar-menu li.active {
  background: #ff3333;
  transform: translateX(3px);
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  z-index: 1500;
  transition: 0.3s;
}
.overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Toggle Buttons */
.sidebar-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 2100;
  background: #f44545;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
.dark-mode-toggle {
  position: absolute;
  top: 20px;
  right: 32px;
  background: #343a40;
  color: #ffe066;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

/* Container */
.container {
  margin-left: 0;
  padding: 40px;
  transition: margin-left 0.3s ease;
}

/* Cards */
.cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.card {
  background: #292c36;
  color: #fff;
  padding: 20px;
  border-radius: 12px;
  flex: 1 1 150px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: 0.2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}
.card .value {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 5px;
}
.card .value span {
  font-size: 1rem;
  vertical-align: super;
}
.card div:last-child {
  font-size: 0.9rem;
  color: #ccc;
}

/* Status */
.status-section {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.status-normal {
  background: #1ea831;
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: bold;
}
.status-warn {
  background: #c5a700;
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: bold;
}
.status-trip {
  background: #c71c1c;
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: bold;
}

/* History Table */
.history-section {
  background: #292c36;
  padding: 20px;
  border-radius: 12px;
  margin-top: 20px;
  color: #fff;
}
.download-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  margin-right: 10px;
}
.download-btn.excel {
  background: #38b000;
  color: #fff;
}
.download-btn.csv {
  background: #3396ff;
  color: #fff;
}
.history-table {
  margin-top: 16px;
  overflow-x: auto;
}
.history-table table {
  width: 100%;
  border-collapse: collapse;
}
.history-table th,
.history-table td {
  text-align: center;
  padding: 10px;
  color: #fff;
}
.history-table th {
  font-weight: bold;
  border-bottom: 1px solid #555;
}
.history-table tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Charts */
.charts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}
.chart-card {
  background: #292c36;
  padding: 15px;
  border-radius: 12px;
  flex: 1 1 45%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.chart-card canvas {
  width: 100% !important;
  height: 200px !important;
}
.chart-label {
  text-align: center;
  color: #fff;
  font-weight: bold;
  margin-top: 5px;
}

/* Responsive */
@media(max-width: 900px) {
  .chart-card {
    flex: 1 1 100%;
  }
}

/* Dark Mode */
body.dark-mode {
  background: #222;
  color: #eee;
}
body.dark-mode .card,
body.dark-mode .status-section,
body.dark-mode canvas,
body.dark-mode .history-table table {
  background: #292c36;
  color: #eee;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Responsive */
@media(max-width: 900px) {
  .cards {
    flex-wrap: wrap;
  }
  .card {
    flex: 1 1 45%;
  }
}
@media(max-width: 600px) {
  .card {
    flex: 1 1 100%;
  }
}