:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

  /* Glassmorphism Variables - Light Mode */
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-blur: 12px;
}

[data-bs-theme="dark"] {
  /* Glassmorphism Variables - Dark Mode */
  --glass-bg: rgba(33, 37, 41, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
}

body {
  background-color: #f8f9fa;
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  min-height: 100vh;
  transition: background-color 0.3s ease;
}

body.animated-bg {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

[data-bs-theme="light"] body {
  background-color: #f8f9fa;
}

[data-bs-theme="light"] body.animated-bg {
  /* Overlay to desaturate the gradient for readability in light mode */
  background:
    linear-gradient(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.7)),
    linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
}

[data-bs-theme="dark"] body {
  background-color: #121212;
}

[data-bs-theme="dark"] body.animated-bg {
  /* Darker overlay for dark mode */
  background:
    linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
    linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
}

/* Navbar */
.navbar {
  background: rgba(var(--bs-dark-rgb), 0.2) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: none;
}

/* Cards */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

#hero_gateways_card:hover {
  transform: translateY(-8px) scale(1.02);
  background: rgba(var(--bs-primary-rgb), 0.2) !important;
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.3);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.25);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  padding: 1rem 1.25rem;
}

[data-bs-theme="dark"] .card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tables */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  border-top: none;
}

.table td {
  vertical-align: middle;
}

/* Table Header Filters */
.column-filter-input {
  width: 100%;
  padding: 4px 8px;
  font-size: 0.75rem;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  margin-top: 5px;
  transition: all 0.2s ease;
}

.column-filter-input:focus {
  outline: none;
  border-color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), 0.1);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

[data-bs-theme="dark"] .column-filter-input {
  background: rgba(0, 0, 0, 0.2);
}

/* Badges */
.badge {
  padding: 0.5em 0.8em;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-radius: 6px;
}

/* Transitions */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stats/Hero Cards */
.stat-card {
  display: flex;
  align-items: center;
  padding: 1.5rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-right: 1rem;
  background: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--bs-primary);
}

.stat-content h6 {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-content h3 {
  margin-bottom: 0;
  font-weight: 700;
}

/* Disk Usage Progress */
.progress {
  height: 8px;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .progress {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Footer logic */
#last_reload {
  font-weight: 600;
}

.navbar #last_reload {
  color: rgba(255, 255, 255, 0.9);
}

/* Collapsible Card Chevrons */
.card-header .bi-chevron-down {
  transition: transform 0.3s ease;
}

.card-header.collapsed .bi-chevron-down {
  transform: rotate(-90deg);
}

/* Setup Page Labels */
.setup-label {
  width: 350px;
  min-width: 350px;
  white-space: normal;
  text-align: left;
}

/* Active TX Pulse Animation */
@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(220, 53, 69, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    transform: scale(1);
  }
}

.tx-active {
  animation: pulse-red 2s infinite;
  border-color: #dc3545 !important;
  background: rgba(220, 53, 69, 0.05) !important;
}

/* Live Status Pulse Indicator */
.live-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #28a745;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  box-shadow: 0 0 0 rgba(40, 167, 69, 0.4);
  animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

/* New Row Highlight Flash */
.row-highlight-flash {
  animation: highlight-fade 3s ease-out;
}

@keyframes highlight-fade {
  0% {
    background-color: rgba(40, 167, 69, 0.3);
  }
  100% {
    background-color: transparent;
  }
}

/* Health Status Colors */
.stat-health-low {
  color: #0d6efd !important; /* Blue */
}

.stat-health-mid {
  color: #fd7e14 !important; /* Orange */
}

.stat-health-high {
  color: #dc3545 !important; /* Red */
}

.stat-icon-health-low {
  background: rgba(13, 110, 253, 0.1) !important;
  color: #0d6efd !important;
}

.stat-icon-health-mid {
  background: rgba(253, 126, 20, 0.1) !important;
  color: #fd7e14 !important;
}

.stat-icon-health-high {
  background: rgba(220, 53, 69, 0.1) !important;
  color: #dc3545 !important;
}
