:root {
  --bg-primary: #ffffff;
  --bg-secondary: #0a4fa3;
  --bg-accent: #1e88e5;

  --text-primary: #1b1b1b;
  --text-muted: #6b7280;

  --border-color: #e5e7eb;

  --radius-card: 16px;
  --radius-input: 10px;
  --radius-button: 12px;

  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
}

body {
  margin: 0;
  background-color: var(--bg-primary);
}


.login-wrapper {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-card {
  width: 360px;
  background:#f9f9f9;
  padding: 32px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.logo {
  width: 110px;
  height: 50px;
  margin-bottom: 20px;
}

.login-card h2 {
  margin: 0;
  color: var(--text-primary);
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-color);
  font-size: 14px;
  outline: none;
}

.input-group input:focus {
  border-color: var(--bg-secondary);
}

/* =========================
   PASSWORD TOGGLE
========================= */

.password-group {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  opacity: 0.6;
  user-select: none;
}

.toggle-password:hover {
  opacity: 1;
}

button {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: var(--radius-button);
  background-color: var(--bg-secondary);
  color: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

button:hover {
  background-color: var(--bg-accent);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

#errorMsg {
  margin-top: 14px;
  color: #dc2626;
  font-size: 13px;
  min-height: 16px;
}


/* -------------------- */

.dashboard {
  padding: 10px;
  padding-bottom: 30px;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
.dashboard-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #282828;
}

.dashboard-title span {
  font-weight: 500;
  color: #64748b;
}

.btn-refresh {
  width: 105px;
  height: 35px;
  padding: 8px 14px;
  border-radius: 30px;
  background: #0b4da2;
  color: white;
  text-decoration: none;
  font-size: 13px;
}

.btn-refresh:hover {
  background: #083b7e;
}

.btn-refresh.disabled,
.btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* RIGHT */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

/* LEFT */
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* CENTER */
.header-center {
  text-align: center;
}

.logo {
  height: 50px;
}

/* Hamburger */
.hamburger {
  font-size: 24px;
  cursor: pointer;
}
.hamburger:hover {
  color:#7a7a7a;
  transform: translateY(-0.8px);
}


.logout-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--bg-secondary);
  color: var(--bg-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: all 0.25s ease;
}

.logout-btn:hover {
  background-color: var(--bg-secondary);
  color: #fff;
}

/* body */

/* Hamburger */
.hamburger {
  font-size: 24px;
  cursor: pointer;
  margin-right: 12px;
}

/* Sidebar base */
.sidebar {
  padding: 20px;
  position: fixed;
  left: -280px;
  top: 0;
  height: 100%;
  width: 280px;
  background: #fff;
  z-index: 1000;
  transition: left 0.3s ease;
}

/* Sidebar OPEN state */
.sidebar.open {
  left: 0;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-title {
  font-size: 18px;
  margin-bottom: 16px;
  font-weight: 600;
}

.plant-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.plant-item {
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.plant-item:hover {
  background: #f1f5f9;
}

.plant-item.active {
  background: #083b7e;
  color: white;
  font-weight: 600;
}


.service-info {
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
}
 
/* Service risk indicators */
.risk-text {
  font-weight: 600;
  margin-left: 4px;
}

/* Yellow warning */
.risk-text.warning {
  color: #f59e0b; /* amber */
}

/* Red danger */
.risk-text.danger {
  color: #dc2626; /* red */
}

.live-time {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 600;
  color: #0f172a;
}

.live-badge {
  font-size: 11px;
  background: #dc2626;
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  animation: live-pulse 1.5s infinite;
}

@keyframes live-pulse {
  50% {
    opacity: 0.6;
  }
}


.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 30px;
}

.card {
  background: rgb(255, 249, 249);
  padding: 40px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.card h4 {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.card p {
  margin-top: 8px;
  font-size: 18px;
  font-weight: 500;
}

/* PERFORMANCE SECTION */
.performance {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 24px;
  margin-top: 30px;
}

.performance-card {
  background: #fff8f8;
  padding: 24px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  height: 230px;
}

/* RO Efficiency */
.efficiency-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--bg-secondary);
  margin: 12px 0;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar:hover .progress-fill {
  filter: brightness(1.1);
  transition: filter 0.3s ease;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
}


/* RO performance mapping */
.progress-fill.excellent {
  width: 90%;
  background: #16a34a;
}

.progress-fill.good {
  width: 70%;
  background: #22c55e;
}

.progress-fill.average {
  width: 45%;
  background: #facc15;
}

.progress-fill.needs-attention {
  width: 25%;
  background: #dc2626;
}
.progress-fill {
  transition: width 0.4s ease;
}


.muted-text {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 10px;
}

/* FILTER HEALTH */
.health-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  font-size: 14px;
}

.health-label {
  white-space: nowrap;
}

.health-bar {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  position: relative;
  overflow: hidden;
}

.health-bar::after {
  content: "";
  position: absolute;
  height: 100%;
  left: 0;
  top: 0;
  border-radius: 999px;
}

/* Status widths + colors */
.excellent::after {
  width: 90%;
  background: #16a34a;
}

.good::after {
  width: 70%;
  background: #22c55e;
}

.average::after {
  width: 45%;
  background: #facc15;
}

.health-label {
  text-align: right;
  font-weight: 500;
}



.card,
.performance-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover,
.performance-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0,0,0,0.08);
}

.progress-bar:hover .progress-fill {
  filter: brightness(1.1);
}

.efficiency-value {
  transition: transform 0.3s ease;
}

.performance-card:hover .efficiency-value {
  transform: scale(1.03);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blink-group {
  display: flex;
  gap: 6px;
}

.blink-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: blink 1.4s infinite;
}

/* stagger */
.blink-dot:nth-child(2) { animation-delay: 0s; }
.blink-dot:nth-child(3) { animation-delay: 0s; }

@keyframes blink {
  0% { opacity: 0.1; }
  50% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* EXCELLENT → calm green */
.blink-group.excellent .blink-dot {
  background: #16a34a;
  animation-duration: 1.6s;
}

/* GOOD → normal green */
.blink-group.good .blink-dot {
  background: #22c55e;
  animation-duration: 1.3s;
}

/* AVERAGE → yellow, faster */
.blink-group.average .blink-dot {
  background: #facc15;
  animation-duration: 1s;
}

/* NEEDS ATTENTION → red, fast */
.blink-group.needs-attention .blink-dot {
  background: #dc2626;
  animation-duration: 0.7s;
}

/* ===========================
   MOBILE COMPACT DASHBOARD
   =========================== */
@media (max-width: 768px) {

  /* ---------- HEADER ---------- */
  .dashboard-header {
    padding: 10px 12px;
    height: auto;
  }

  .header-left {
    gap: 8px;
  }

  .logo {
    height: 25px; 
    width: 50px;  /* smaller logo */
  }

  .dashboard-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    margin-right: 20px;
    margin-left: 20px;
  }

  .header-right {
    gap: 6px;
  }

  .btn-refresh {
    width: 63px;
    height: 22px;
  }
  .logout-btn {
    width: 43px;
    height: 23px;
  }

  .btn-refresh,
  .logout-btn {
    padding: 6px 10px;
    font-size: 7px;
    border-radius: 999px;
  }

  /* ---------- HAMBURGER ---------- */
  .hamburger {
    font-size: 14px;
    padding: 4px;
  }

  /* ---------- SIDEBAR ---------- */
  .sidebar {
    width: 75vw;
    max-width: 280px;
    padding: 16px;
  }

  .sidebar-title {
    font-size: 14px;
  }

  .plant-item {
    font-size: 13px;
    padding: 8px 10px;
  }

  /* ---------- INFO CARD (TIME / SERVICE) ---------- */
  .service-info {
    font-size: 13px;
    line-height: 1.4;
  }

  /* ---------- CARDS ---------- */
  .cards {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .card {
    padding: 16px;
  }

  .card h4 {
    font-size: 13px;
  }

  .card p {
    font-size: 14px;
  }

  /* ---------- PERFORMANCE SECTION ---------- */
  .performance {
    width: 450px;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .performance-card h3 {
    font-size: 20px;
  }
  .progress-bar{
    width: 200px;
  }
@media (max-width: 768px) {

  .health-row {
    display: grid;
    grid-template-columns: 100px 1fr 85px;
    align-items: center;
    gap: 6px;
  }

  /* Left label */
  .health-name {
    font-size: 12px;
    white-space: nowrap;      /* ⛔ prevents RO / Membrane split */
    overflow: hidden;
    text-overflow: ellipsis;  /* safety */
  }

  /* Progress bar */
  .health-bar {
    width: 100%;
    height: 7px;
  }

  /* Right status */
  .health-label {
    font-size: 12px;
    text-align: right;
    white-space: nowrap;   /* keeps Needs Attention / Excellent in one line */
  }
}



  /* ---------- BLINKING DOT (SMALLER) ---------- */
  .status-dot {
    width: 8px;
    height: 8px;
  }
}
