html, body { margin: 0; padding: 0; }
/* ─── Nav override for inner pages ──────────────────────────────────────────── */
.pz-nav {
  position: relative;
  background: linear-gradient(135deg, #0a2540 0%, #1565c0 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 10;
  padding: 0.5rem 1.5rem;
  margin: 0;
  top: 0;
}

.pz-nav .navbar-brand img { filter: brightness(0) invert(1); }
.pz-nav .nav-link { color: rgba(255,255,255,0.85) !important; font-size: 0.95rem; padding: 0.5rem 1rem !important; }
.pz-nav .nav-link:hover { color: #fff !important; }

/* ─── Page wrapper ───────────────────────────────────────────────────────────── */
.pz-page {
  min-height: calc(100vh - 56px);
  background: #f0f4f8;
  padding: 0 0 2rem;
}

/* ─── Auth forms ─────────────────────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: url('/images/pool_bg.jpg') no-repeat center center/cover;
  position: relative;
}
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 37, 64, 0.6);
}
.auth-card {
  position: relative;
  z-index: 2;
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-card img.auth-logo {
  display: block;
  margin: 0 auto 1.5rem;
  max-width: 160px;
}
.auth-card h2 {
  text-align: center;
  font-weight: 700;
  color: #0a2540;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}
.auth-card .form-control {
  border-radius: 8px;
  border: 1.5px solid #dde3ea;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.auth-card .form-control:focus {
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}
.btn-pz {
  background: linear-gradient(135deg, #1565c0, #0a2540);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  transition: opacity 0.2s, transform 0.1s;
}
.btn-pz:hover { opacity: 0.9; color: white; }
.btn-pz:active { transform: scale(0.98); }
.auth-links { text-align: center; margin-top: 1rem; font-size: 0.9rem; }
.auth-links a { color: #1565c0; }

/* ─── Dashboard ──────────────────────────────────────────────────────────────── */
.pz-dashboard-header {
  background: linear-gradient(135deg, #0a2540 0%, #1565c0 100%);
  color: white;
  padding: 2rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.pz-dashboard-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 40px;
  background: #f0f4f8;
  clip-path: ellipse(55% 100% at 50% 100%);
}
.pz-dashboard-header h2 { font-weight: 700; font-size: 1.8rem; }
.pz-dashboard-header p { opacity: 0.8; }

/* ─── Device Cards ───────────────────────────────────────────────────────────── */
.device-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.device-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  color: inherit;
  text-decoration: none;
}
.device-card .device-name { font-weight: 700; font-size: 1.2rem; color: #0a2540; }
.device-card .device-id { font-size: 0.8rem; color: #999; font-family: monospace; }
.device-card .device-temp { font-size: 2rem; font-weight: 700; color: #1565c0; }
.device-card .device-temp-label { font-size: 0.8rem; color: #999; }
.device-status {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.device-status.online { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.device-status.offline { background: #ef4444; }

/* ─── Device detail page ─────────────────────────────────────────────────────── */
.device-detail-header {
  background: linear-gradient(135deg, #0a2540 0%, #1565c0 100%);
  color: white;
  padding: 0 0 3rem;
  position: relative;
}
.device-detail-header::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 40px;
  background: #f0f4f8;
  clip-path: ellipse(55% 100% at 50% 100%);
}

.pz-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.pz-card h5 { font-weight: 700; color: #0a2540; margin-bottom: 1rem; }

/* ─── Temp display ───────────────────────────────────────────────────────────── */
.temp-display {
  text-align: center;
  padding: 1rem;
}
.temp-value { font-size: 3rem; font-weight: 700; color: #1565c0; line-height: 1; }
.temp-label { font-size: 0.85rem; color: #999; margin-top: 0.25rem; }

/* ─── Mode buttons ───────────────────────────────────────────────────────────── */
.mode-btn {
  flex: 1;
  padding: 0.6rem;
  border: 2px solid #dde3ea;
  background: white;
  border-radius: 8px;
  font-weight: 600;
  color: #666;
  transition: all 0.2s;
  cursor: pointer;
}
.mode-btn.active-off  { background: #ef4444; border-color: #ef4444; color: white; }
.mode-btn.active-auto { background: #1565c0; border-color: #1565c0; color: white; }
.mode-btn.active-on   { background: #22c55e; border-color: #22c55e; color: white; }
.mode-btn:hover:not(.active-off):not(.active-auto):not(.active-on) {
  border-color: #1565c0; color: #1565c0;
}

/* ─── Relay indicator ────────────────────────────────────────────────────────── */
.relay-indicator {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  transition: background 0.3s;
}
.relay-on  { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.relay-off { background: #ef4444; }

/* ─── Chart container ────────────────────────────────────────────────────────── */
.chart-container { position: relative; height: 280px; }

/* ─── Setpoint slider ────────────────────────────────────────────────────────── */
.setpoint-display {
  font-size: 2.5rem;
  font-weight: 700;
  color: #1565c0;
  text-align: center;
}
input[type=range] {
  width: 100%;
  accent-color: #1565c0;
}

/* ─── Admin table ────────────────────────────────────────────────────────────── */
.admin-table th { background: #0a2540; color: white; font-weight: 600; }
.admin-table td { vertical-align: middle; }
.badge-admin { background: #1565c0; color: white; }
.badge-user  { background: #64748b; color: white; }

/* ─── Alert overrides ────────────────────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; }

/* ─── Add device modal ───────────────────────────────────────────────────────── */
.pz-id-input { font-family: monospace; font-size: 1.1rem; letter-spacing: 2px; }

/* ─── Loading spinner ────────────────────────────────────────────────────────── */
.pz-spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.pz-footer {
  text-align: center;
  padding: 1.5rem;
  color: #999;
  font-size: 0.8rem;
}
