@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

/* Utility for white-washing black SVGs */
.logo-white {
  filter: brightness(0) invert(1);
}

/* Glassmorphism Utilities */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
}

.glass-input {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--glass-border) !important;
  color: var(--text-primary) !important;
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

select.glass-input option {
  background-color: #1e1b4b;
  /* Matches theme */
  color: #f8fafc;
}

/* Login Page Specifics */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
}

.form-floating>label {
  color: var(--text-secondary);
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Dashboard Layout */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: rgba(15, 23, 42, 0.95);
  /* Slightly more opaque */
  border-right: 1px solid var(--glass-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  transition: margin-left 0.3s ease-in-out;
}

.sidebar.collapsed {
  margin-left: -260px;
}

.main-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  margin-left: 260px;
  transition: margin-left 0.3s ease-in-out;
}

.main-content.expanded {
  margin-left: 0;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar {
    margin-left: -260px;
  }

  .sidebar.active {
    margin-left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  /* Overlay only visible on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    /* Below sidebar (1000) but above content */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
  }

  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
}

/* Ensure overlay is hidden on desktop always */
@media (min-width: 769px) {
  .sidebar-overlay {
    display: none !important;
  }
}

/* Widgets */
.kpi-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.kpi-label {
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

/* Custom Tabs for Dark Theme */
.nav-tabs {
  border-bottom: 1px solid var(--glass-border);
}

.nav-tabs .nav-link {
  border: none;
  color: var(--text-secondary);
  background: transparent;
  padding: 0.75rem 1.5rem;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--text-primary) !important;
  background: rgba(59, 130, 246, 0.2);
  /* Accent with opacity */
  border-bottom: 2px solid var(--accent-color);
}

.nav-link {
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  margin-bottom: 0.25rem;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-link i {
  width: 24px;
  margin-right: 10px;
}

/* Connectivity Status */
.status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-pulse.bg-success {
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: pulse-green 2s infinite;
}

.status-dot-pulse.bg-danger {
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-red 2s infinite;
}

.status-dot-pulse.bg-secondary {
  background-color: #6c757d !important;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}