:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
}

/* ================= BASE ================= */

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  background: var(--card);
  color: #111;
  transition: background 0.3s, color 0.3s;
}

/* ================= NAVBAR ================= */

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #4a90e2;
  color: #fff;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger {
  font-size: 26px;
  cursor: pointer;
  transition: 0.3s;
}

.hamburger:hover {
  transform: rotate(90deg);
}

.theme-toggle {
  font-size: 20px;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

/* ================= SIDEBAR ================= */

.sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100%;
  background: #111;
  padding-top: 60px;
  transition: 0.3s;
  z-index: 999;
}

.sidebar.active {
  left: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  color: white;
  text-decoration: none;
  transition: 0.2s;
}

.sidebar a:hover {
  background: #222;
}

/* ================= OVERLAY ================= */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  z-index: 998;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ================= DASHBOARD ================= */

.dashboard,
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
}

.card {
  background: #ffffff;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  text-align: center;
  transition: 0.3s;
  cursor: default;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.card h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #555;
}

.card p {
  font-size: 22px;
  font-weight: bold;
}

/* ================= BUTTON ================= */

button {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
  color: white;
}

/* Pump Button */

.pump-btn.on {
  background: #27ae60;
}

.pump-btn.off {
  background: #c0392b;
}

/* Mode Button */

.mode-btn.auto {
  background: #27ae60;
}

.mode-btn.manual {
  background: #c0392b;
}

/* ================= SOIL BAR ================= */

.soil-bar {
  background: #ddd;
  border-radius: 10px;
  height: 25px;
  overflow: hidden;
}

.soil-fill {
  height: 100%;
  width: 0%;
  background: #4a90e2;
  text-align: center;
  color: #fff;
  line-height: 25px;
  font-weight: bold;
  transition: width 0.5s, background 0.3s;
}

/* ================= ESP STATUS ================= */

.esp-status {
  margin-top: 10px;
  font-weight: bold;
  padding: 8px 15px;
  border-radius: 8px;
  display: inline-block;
  background: #999;
  color: white;
}

.no-shadow,
.no-shadow:hover {
  box-shadow: none !important;
  transform: none !important;
}

/* ================= DARK MODE ================= */

html.dark {
  --bg: #0f172a;
  --card: #1e293b;
}

html.dark .navbar {
  background: rgba(20,20,20,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

html.dark .card {
  background: #1e1e1e;
  color: #f5f5f5;
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.05);
}

html.dark .card h3 {
  color: #aaa;
}

html.dark .soil-bar {
  background: #333;
}

/* ================= LIGHT MODE ================= */

html.light {
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  color: #0f172a;
}

html.light .navbar {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
}

html.light .card {
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.05),
    0 10px 20px rgba(0,0,0,0.06);
}

html.light .soil-bar {
  background: #e5e7eb;
}

/* ================= RESPONSIVE ================= */

@media(max-width:768px){
  .dashboard,
  .controls {
    grid-template-columns: 1fr;
  }
}