:root[data-theme="light"] {
  --bg-body: #f5f7fb;
  --bg-card: #ffffff;
  --text-main: #212529;
}

:root[data-theme="dark"] {
  --bg-body: #0b1120;
  --bg-card: #111827;
  --text-main: #e5e7eb;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
}

.card {
  background-color: var(--bg-card);
}

/* Improve dark mode readability */
[data-theme="dark"] body {
  color: #e5e7eb;
}

[data-theme="dark"] .card,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item {
  background-color: #111827;
  color: #e5e7eb;
}

[data-theme="dark"] .list-group-item-action:hover,
[data-theme="dark"] .list-group-item-action:focus {
  background-color: #1f2937;
}

[data-theme="dark"] .text-muted {
  color: #9ca3af !important;
}

.site-footer {
  background-color: #f1f3f5;
  border-top: 1px solid #dee2e6;
  color: #6c757d;
}

.site-footer-link {
  color: #0d6efd;
}

.site-footer-link:hover,
.site-footer-link:focus {
  color: #0a58ca;
  text-decoration: underline !important;
}

[data-theme="dark"] .site-footer {
  background-color: #1f2937;
  border-top-color: #374151;
  color: #cbd5e1;
}

[data-theme="dark"] .site-footer-link {
  color: #93c5fd;
}

[data-theme="dark"] .site-footer-link:hover,
[data-theme="dark"] .site-footer-link:focus {
  color: #bfdbfe;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Ensure vertical centering even with Bootstrap's align-items-baseline */
.navbar-brand.d-flex {
  align-items: center !important;
}

.navbar-brand .brand-main {
  font-size: 3.2rem;
  font-weight: 500;
  line-height: 1.1;
}

.navbar-brand .brand-sub {
  font-size: 1.7rem;
  opacity: 0.85;
}

.avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #f8fafc;
  color: #0d6efd;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn {
  border: none;
  background: transparent;
  color: #f9fafb;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
  background: rgba(15, 23, 42, 0.25);
  color: #f9fafb;
}

.profile-btn {
  border: none;
  background-color: transparent;
  color: #f9fafb;
}

.profile-btn:hover,
.profile-btn:focus {
  background: rgba(15, 23, 42, 0.25);
  color: #f9fafb;
}

.inbox-btn {
  border: none;
  background-color: transparent;
  color: #f9fafb;
  padding-inline: 0.4rem;
}

.inbox-btn:hover,
.inbox-btn:focus {
  background: rgba(15, 23, 42, 0.25);
  color: #f9fafb;
}

.inbox-icon {
  font-size: 1.1rem;
}

.notification-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.35rem;
  font-size: 0.6rem;
}

/* Make all cards right-angled (no rounded corners) */
.card {
  border-radius: 0 !important;
}

/* Also ensure card headers have square top corners */
.card .card-header {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

.alerts-dropdown {
  min-width: 320px;
  max-height: 360px;
  overflow-y: auto;
}

.alerts-list .list-group-item {
  cursor: default;
}

.brand-logo {
  height: 80px;
  width: auto;
}

/* Make dashboard card text larger for readability */
.card-body.small {
  font-size: 1rem;
}

/* Responsive tweaks for smaller screens */
@media (max-width: 991.98px) {
  .brand-logo {
    height: 48px;
  }

  .navbar-brand .brand-main {
    font-size: 2.2rem;
  }

  .navbar-brand .brand-sub {
    font-size: 1.3rem;
  }
}

@media (max-width: 575.98px) {
  .brand-logo {
    height: 40px;
  }

  .navbar-brand .brand-main {
    font-size: 1.7rem;
  }

  .navbar-brand .brand-sub {
    font-size: 1.05rem;
  }
}

/* Subtle hover zoom for all cards */
.card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0.75rem 1.5rem rgba(15, 23, 42, 0.25);
}

/* (login password input uses Bootstrap's default input-group sizing) */

/* --- Site detail: Current Flow speedometer gauge --- */
.flow-gauge-card .flow-gauge-wrapper {
  max-width: 420px;
  margin: 0 auto;
}

.flow-gauge-card .gauge-container {
  position: relative;
  height: 220px;
}

.flow-gauge-card .gauge-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.flow-gauge-card .arc-bg {
  fill: none;
  stroke: var(--gauge-bg, #e5e7eb);
  stroke-width: 32;
}

.flow-gauge-card .arc-fill {
  fill: none;
  stroke-width: 32;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

.flow-gauge-card .gauge-text {
  fill: var(--gauge-text, #6b7280);
  font-size: 13px;
  font-weight: 500;
}

.flow-gauge-card .zone-label {
  font-size: 11px;
  font-weight: 600;
}

.flow-gauge-card .zone-low { fill: #198754; }
.flow-gauge-card .zone-med { fill: #fd7e14; }
.flow-gauge-card .zone-high { fill: #dc3545; }

.flow-gauge-card .gauge-value {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.flow-gauge-card .gauge-value-num {
  font-size: 2rem;
  font-weight: 600;
  color: var(--gauge-value-color, #0d6efd);
}

.flow-gauge-card .gauge-value-unit {
  font-size: 0.9rem;
  color: var(--gauge-text, #6b7280);
  margin-left: 2px;
}

/* Gauge gradient stops - light theme */
.flow-gauge-card .gauge-stop-low { stop-color: #198754; }
.flow-gauge-card .gauge-stop-mid { stop-color: #fd7e14; }
.flow-gauge-card .gauge-stop-high { stop-color: #dc3545; }

/* Dark theme overrides for gauge */
[data-theme="dark"] .flow-gauge-card .arc-bg {
  stroke: #374151;
}

[data-theme="dark"] .flow-gauge-card .gauge-text {
  fill: #9ca3af;
}

[data-theme="dark"] .flow-gauge-card .gauge-value-num {
  color: #60a5fa;
}

[data-theme="dark"] .flow-gauge-card .gauge-value-unit {
  color: #9ca3af;
}

/* Offline state: dimmed gauge value */
.flow-gauge-card.gauge-offline .gauge-value-num {
  color: var(--gauge-text, #6b7280);
}

[data-theme="dark"] .flow-gauge-card.gauge-offline .gauge-value-num {
  color: #6b7280;
}

/* --- Site detail breadcrumb (theme-aware, plain style) --- */
.site-breadcrumb-nav .breadcrumb {
  font-size: 0.9rem;
}

.site-breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
  color: #94a3b8;
}

.site-breadcrumb-nav .breadcrumb-item a {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 500;
}

.site-breadcrumb-nav .breadcrumb-item a:hover,
.site-breadcrumb-nav .breadcrumb-item a:focus {
  text-decoration: underline;
}

.site-breadcrumb-nav .breadcrumb-item.active {
  color: #64748b;
  font-weight: 600;
}

[data-theme="dark"] .site-breadcrumb-nav .breadcrumb-item a {
  color: #93c5fd;
}

[data-theme="dark"] .site-breadcrumb-nav .breadcrumb-item.active {
  color: #cbd5e1;
}

/* Measurement number safety in cards/gauges */
.metric-value {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

