/* Bright Modern Gradient Theme - Updated */
:root {
  --primary-blue: #4facfe;
  --secondary-blue: #00f2fe;
  --light-blue: #74b9ff;
  --dark-blue: #667eea;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-glow: 0 8px 32px rgba(102, 126, 234, 0.37);
}

/* Global Styles */
body {
  background: #f8f9fa;
  background-attachment: fixed;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  color: #2c3e50;
}

/* Keep Grafana pages with dark background */
body.grafana-page {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
}

/* Light Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(116, 185, 255, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
  z-index: -1;
}

/* Modern Cards */
.glass-card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  /* Match height with modern-device-card */
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Ensure glass-card body takes remaining space */
.glass-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Equal height cards in the same row */
.row .col-md-6 {
  display: flex;
  flex-direction: column;
}

.row .col-md-6 .card {
  flex: 1;
}

/* Unit Card Styles */
.unit-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border: none !important;
  height: 120px;
  transition: all 0.3s ease;
}

.unit-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%) !important;
}

.unit-card .card-body {
  padding: 15px;
  display: flex;
  align-items: center;
  min-height: 60px;
}

.unit-card .card-body .row {
  width: 100%;
  margin: 0;
  display: flex;
  align-items: center;
}

.unit-card .card-body .col-md-3 {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  min-height: 40px;
}

.unit-card .card-title {
  color: #ffffff !important;
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0;
}

.unit-card .status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Unit selection container transitions */
#unitSelectionContainer {
    transition: all 0.5s ease-in-out;
    opacity: 1;
    max-height: 500px;
    overflow: hidden;
}

#unitSelectionContainer.hidden {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}

/* Grafana page - completely hide navbar */
.grafana-page .main-header {
  display: none !important;
}

.grafana-page .main-sidebar {
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 1020;
  width: 60px; /* Collapsed width for icons only */
}

.grafana-page .content-wrapper {
  margin-left: 0 !important;
  margin-top: 0 !important;
  transition: margin 0.3s ease;
}

.grafana-page .main-footer {
  margin-left: 0 !important;
  transition: margin 0.3s ease;
}

/* First stage: Show sidebar with icons only on hover */
.grafana-page .main-sidebar:hover,
.grafana-page .sidebar-hover {
  transform: translateX(0);
  width: 60px; /* Keep narrow for icons only */
}

/* Hide text in first stage */
.grafana-page .main-sidebar .nav-sidebar .nav-link p,
.grafana-page .main-sidebar .brand-text,
.grafana-page .main-sidebar .user-panel .info,
.grafana-page .main-sidebar .nav-header,
.grafana-page .main-sidebar .nav-link .right,
.grafana-page .main-sidebar .nav-link .badge {
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  width: 0;
  display: none;
}

/* Ensure nav-link items stay in one line */
.grafana-page .main-sidebar .nav-sidebar .nav-link {
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
}

.grafana-page .main-sidebar .nav-sidebar .nav-link .nav-icon {
  flex-shrink: 0 !important;
  margin-right: 8px !important;
}

.grafana-page .main-sidebar .nav-sidebar .nav-link p {
  margin: 0 !important;
  flex: 1 !important;
}

/* Make nav-items more responsive to hover */
.grafana-page .main-sidebar .nav-item {
  transition: background-color 0.1s ease !important;
}

.grafana-page .main-sidebar .nav-item:hover {
  background-color: rgba(255,255,255,0.1) !important;
}

/* Show text when sidebar is in hover state but not expanded */
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .nav-sidebar .nav-link p,
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .brand-text,
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .user-panel .info,
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .nav-header,
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .nav-link .right,
.grafana-page .main-sidebar.sidebar-hover:not(.sidebar-expanded) .nav-link .badge {
  opacity: 0;
  display: none;
  width: 0;
}

/* Second stage: Show full menu when sidebar is expanded */
.grafana-page .main-sidebar.sidebar-expanded {
  width: 250px !important;
  transition: width 0.2s ease;
}

.grafana-page .main-sidebar.sidebar-expanded .nav-sidebar .nav-link p,
.grafana-page .main-sidebar.sidebar-expanded .brand-text,
.grafana-page .main-sidebar.sidebar-expanded .user-panel .info,
.grafana-page .main-sidebar.sidebar-expanded .nav-header,
.grafana-page .main-sidebar.sidebar-expanded .nav-link .right,
.grafana-page .main-sidebar.sidebar-expanded .nav-link .badge {
  opacity: 1;
  display: inline-block;
  width: auto;
  transition: opacity 0.15s ease;
  transition-delay: 0s;
}

/* Specific styling for nav-link text in expanded state */
.grafana-page .main-sidebar.sidebar-expanded .nav-sidebar .nav-link p {
  display: inline !important;
  margin-left: 0 !important;
}

/* Highlight effect on individual item hover */
.grafana-page .main-sidebar .nav-item:hover .nav-link,
.grafana-page .main-sidebar .brand-link:hover,
.grafana-page .main-sidebar .user-panel:hover {
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
}



/* Adjust content when sidebar is visible */
.grafana-page.sidebar-visible .content-wrapper {
  margin-left: 60px !important; /* Adjust for icon-only width */
  transition: margin-left 0.3s ease;
}

.grafana-page.sidebar-visible .main-footer {
  margin-left: 60px !important; /* Adjust for icon-only width */
  transition: margin-left 0.3s ease;
}

/* Adjust content when sidebar is fully expanded */
.grafana-page.sidebar-expanded .content-wrapper {
  margin-left: 250px !important;
  transition: margin-left 0.3s ease;
}

.grafana-page.sidebar-expanded .main-footer {
  margin-left: 250px !important;
  transition: margin-left 0.3s ease;
}

/* Hover trigger area for sidebar only */
.grafana-page::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 50px;
  height: 100vh;
  z-index: 1040;
  background: transparent;
  pointer-events: auto;
}

/* Custom Map Marker Styles */
.custom-div-icon {
    background: none !important;
    border: none !important;
}

.custom-marker {
    position: relative;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.custom-marker:hover .marker-icon {
    transform: scale(1.1);
    filter: brightness(1.1);
}

.custom-marker:hover .marker-pulse {
    animation-duration: 1s;
}

.custom-marker.online .marker-icon {
    background: linear-gradient(135deg, #00e676, #00c853);
    color: #ffffff;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.7), 0 0 0 2px rgba(0, 200, 83, 0.3);
}

.custom-marker.offline .marker-icon {
    background: linear-gradient(135deg, #ff5722, #f44336);
    color: #ffffff;
    border: 4px solid #ffffff;
    box-shadow: 0 4px 20px rgba(255, 87, 34, 0.7), 0 0 0 2px rgba(244, 67, 54, 0.3);
}

.marker-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    animation: pulse 2s infinite;
    z-index: 1;
}

.custom-marker.online .marker-pulse {
    background: rgba(0, 230, 118, 0.5);
}

.custom-marker.offline .marker-pulse {
    background: rgba(255, 87, 34, 0.5);
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    70% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Enhanced Modern Device Information Card Styles */
.modern-device-card {
  background: #ffffff;
  border: none;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modern-device-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  z-index: 1;
}

.modern-device-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 8px 16px rgba(0, 0, 0, 0.08);
}

.device-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 70%, #f093fb 100%);
  border: none;
  padding: 20px 24px;
  color: white;
  position: relative;
  overflow: hidden;
}

.device-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  z-index: 0;
}

.device-header > * {
  position: relative;
  z-index: 1;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  backdrop-filter: blur(15px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.device-icon:hover {
  transform: scale(1.1) rotate(5deg);
  background: rgba(255, 255, 255, 0.35);
}

.header-text {
  flex: 1;
  margin-left: 16px;
  display: flex;
  align-items: center;
}

.header-text .card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.3px;
}

.device-id-badge {
  background: rgba(255, 255, 255, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  display: inline-block;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modern-device-body {
  padding: 24px;
  background: linear-gradient(135deg, #fafbfc 0%, #f8f9fa 100%);
}

.device-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.info-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 1px solid rgba(102, 126, 234, 0.1);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-height: 70px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.info-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border-radius: 16px 0 0 16px;
  transition: all 0.4s ease;
}

.info-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(240, 147, 251, 0.05) 100%);
  transition: width 0.4s ease;
}

.info-card:hover {
  background: #ffffff;
  transform: translateY(-4px) translateX(2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(102, 126, 234, 0.2);
}

.info-card:hover::before {
  width: 6px;
}

.info-card:hover::after {
  width: 100%;
}

.info-card:hover::before {
  width: 4px;
}

.info-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 70%, #f093fb 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.info-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.info-card:hover .info-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.info-card:hover .info-icon::before {
  opacity: 1;
}

.info-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  color: #8e9aaf;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.info-value {
  font-size: 15px;
  color: #2c3e50;
  font-weight: 700;
  line-height: 1.3;
  transition: color 0.3s ease;
}

.info-card:hover .info-value {
  color: #1a202c;
}

.coordinates-card .coordinates {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.coordinates-card .lat,
.coordinates-card .lng {
  font-family: 'Courier New', monospace;
  background: #e9ecef;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
}

.coordinates-card .no-data {
  color: #6c757d;
  font-style: italic;
  font-size: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .device-info-grid {
    grid-template-columns: 1fr;
  }
  
  .header-content {
    flex-direction: row;
    text-align: left;
  }
  
  .info-card {
    padding: 12px 14px;
    min-height: 55px;
  }
  
  .modern-device-body {
    padding: 16px;
  }
}

/* Enhanced Device popup styling */
.device-popup-enhanced {
    min-width: 300px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #2c3e50;
    border: 2px solid #e3f2fd;
}

.popup-header {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    padding: 18px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.popup-header h5 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.device-id-badge {
    background: rgba(255,255,255,0.25);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.popup-body {
    padding: 16px 18px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
    min-height: 200px;
    align-content: start;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f8ff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e3f2fd;
    transition: all 0.2s ease;
    min-height: 50px;
}

.info-item:hover {
    background: #e8f4fd;
    transform: translateY(-1px);
}

.info-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.info-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-label {
    font-size: 11px;
    color: #64b5f6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.info-value {
    font-size: 13px;
    font-weight: 700;
    color: #1565c0;
}

.status-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
}

.status-indicator.online {
    color: #2e7d32;
    background: #e8f5e8;
    border: 1px solid #c8e6c9;
}

.status-indicator.offline {
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
}

.last-seen {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
    font-weight: 500;
}

.popup-footer {
    padding: 15px 18px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.btn-view-details {
    background: linear-gradient(45deg, #2196f3, #1976d2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.btn-view-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

/* Device Popup Styles */
.device-popup {
    min-width: 250px;
    font-family: 'Source Sans Pro', sans-serif;
}

/* Enhanced Device Popup Styles */
.device-popup-enhanced {
    min-width: 320px;
    max-width: 380px;
    min-height: 420px;
    font-family: 'Source Sans Pro', sans-serif;
}

/* Leaflet Popup Container Overrides */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 320px !important;
    max-width: 380px !important;
    min-height: 420px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    border-radius: 12px !important;
}

.leaflet-popup-tip-container {
    margin-top: -1px !important;
}

/* Device Map Container Height Override */
#deviceMap {
    height: 650px !important;
    min-height: 650px !important;
}

.device-popup h6 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-weight: 600;
}

.device-popup p {
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.device-popup .badge {
    font-size: 11px;
}

/* Custom Marker Cluster Styles */
.marker-cluster-small {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
}

.marker-cluster-medium {
    background: linear-gradient(135deg, #fdcb6e, #e17055);
}

.marker-cluster-large {
    background: linear-gradient(135deg, #fd79a8, #e84393);
}

.marker-cluster {
    border: 3px solid #fff;
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.marker-cluster div {
    width: 34px;
    height: 34px;
    margin-left: 3px;
    margin-top: 3px;
    text-align: center;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster span {
    line-height: 1;
    font-size: 12px;
}

/* Sidebar Styling */
.main-sidebar {
  background: var(--gradient-primary) !important;
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link {
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(5px);
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Header Styling */
.main-header {
  background: var(--gradient-primary) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-light .navbar-nav .nav-link {
  color: #fff !important;
}

/* Content Wrapper */
.content-wrapper {
  background: #ffffff !important;
  min-height: 100vh;
  margin-left: 250px !important;
  transition: margin-left 0.3s ease;
}

/* Sidebar collapsed state */
.sidebar-collapse .content-wrapper {
  margin-left: 0 !important;
}

/* Card Animations */
.card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.card-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 15px 15px 0 0 !important;
  border-bottom: none;
  font-weight: bold;
}

.card-title {
  font-weight: bold !important;
  color: inherit;
}

/* Buttons */
.btn-primary {
  background: var(--gradient-secondary) !important;
  border: none !important;
  color: white !important;
  font-weight: 600;
  padding: 12px 30px;
  border-radius: 25px;
  box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-primary:hover {
  background: var(--gradient-primary) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
  color: white !important;
}

.btn-success {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
  border: none;
  border-radius: 25px;
}

.btn-danger {
  background: linear-gradient(135deg, #e17055 0%, #fd79a8 100%);
  border: none;
  border-radius: 25px;
}

/* Form Controls */
.form-control {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: #2c3e50;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
  font-weight: 500;
}

.form-control:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--light-blue);
  box-shadow: 0 0 0 0.2rem rgba(116, 185, 255, 0.25);
  color: #2c3e50;
}

.form-control::placeholder {
  color: #7f8c8d;
  opacity: 0.8;
}

/* Form Labels */
label {
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Form Text */
.form-text {
  color: #34495e !important;
  font-weight: 500;
}

/* Select Controls */
select.form-control {
  background: rgba(255, 255, 255, 0.9);
  color: #2c3e50;
}

select.form-control option {
  background: #fff;
  color: #2c3e50;
}

/* Readonly Inputs */
.form-control[readonly] {
  background: rgba(248, 249, 250, 0.9);
  color: #6c757d;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Checkbox Controls */
.custom-control-label {
  color: #2c3e50;
  font-weight: 500;
}

.custom-control-label::before {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.custom-control-input:checked ~ .custom-control-label::before {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}

/* Input Groups */
.input-group-text {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #2c3e50;
}

/* Tables */
.table {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  border-radius: 10px;
  overflow: hidden;
}

.table thead th {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  font-weight: 600;
}

.table tbody tr {
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.01);
}

/* Status Indicators */
.status-online {
  color: #00b894;
  animation: pulse 2s infinite;
}

.status-offline {
  color: #e17055;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Chart Containers */
.chart-container {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 20px;
  margin: 10px 0;
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modern Loading Overlay */
.modern-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modern-loading-container {
  text-align: center;
  color: #fff;
}

.modern-spinner {
  margin-bottom: 20px;
  position: relative;
  width: 60px;
  height: 60px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: modernSpin 2s linear infinite;
}

.spinner-ring:nth-child(1) {
  border-top-color: #667eea;
  animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
  border-top-color: #764ba2;
  animation-delay: 0.3s;
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
}

.spinner-ring:nth-child(3) {
  border-top-color: #f093fb;
  animation-delay: 0.6s;
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
}

@keyframes modernSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: textPulse 1.5s ease-in-out infinite;
}

@keyframes textPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%, 100% {
    content: '...';
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .glass-card {
    margin: 10px 5px;
  }
  
  .card {
    border-radius: 10px;
  }
}

/* Sidebar Custom Styling */
.main-sidebar {
  background: linear-gradient(180deg, #1a237e 0%, #283593 70%, rgba(255, 255, 255, 0.1) 100%) !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

.main-sidebar .sidebar {
  background: transparent;
}

/* Colorful Menu Icons */
.nav-sidebar .nav-item > .nav-link .nav-icon.fa-tachometer-alt {
  color: #ff6b6b !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-microchip {
  color: #4ecdc4 !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-users {
  color: #45b7d1 !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-database {
  color: #f9ca24 !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-chart-bar {
  color: #6c5ce7 !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-chart-line {
  color: #fd79a8 !important;
}

.nav-sidebar .nav-item > .nav-link .nav-icon.fa-wifi {
  color: #00b894 !important;
}

/* Submenu Icons - Circle with hole */
.nav-treeview .nav-item > .nav-link .nav-icon {
  color: rgba(255, 255, 255, 0.7) !important;
  margin-left: 20px;
  margin-right: 10px;
  font-size: 0.7rem;
  font-weight: 400;
}

/* Make all submenu icons hollow circles */
.nav-treeview .nav-item > .nav-link .nav-icon.fa-circle {
  font-family: "Font Awesome 5 Pro", "Font Awesome 5 Free" !important;
  font-weight: 400 !important;
}

/* Additional indentation for submenu text */
.nav-treeview .nav-item > .nav-link p {
  margin-left: 5px;
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
}

/* Submenu link styling for better visibility */
.nav-treeview .nav-item > .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  padding-left: 2rem;
}

/* Chart Header Last Update Text Styling */
.card-header .card-tools .text-muted {
  color: rgba(255, 255, 255, 0.9) !important;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
}

/* Specific styling for chart last update text */
#chartLastUpdate {
  color: rgba(255, 255, 255, 1) !important;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Enhanced visibility for all last update elements */
.card-header .card-tools small {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 10px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.95) !important;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.card-header .card-tools small:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Clock icon styling in header */
.card-header .card-tools small .fas.fa-clock {
  color: rgba(255, 255, 255, 0.9) !important;
  margin-right: 4px;
}

/* Submenu hover effect */
.nav-treeview .nav-item > .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Login Page Specific */
.login-page {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--shadow-glow);
  padding: 40px;
  animation: slideInDown 0.8s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Styling */
.modal-content {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-header.bg-primary {
    background-color: #007bff !important;
    color: white;
}

.modal-header.bg-primary .close {
    color: white;
    opacity: 0.8;
}

.modal-header.bg-primary .close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* Form Styling */
.form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Button Styling */
.btn {
    border-radius: 4px;
    font-weight: 500;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.login-input {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #333 !important;
  border-radius: 10px 0 0 10px;
  transition: all 0.3s ease;
}

.login-input:focus {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: var(--light-blue);
  box-shadow: 0 0 0 0.2rem rgba(116, 185, 255, 0.25);
  color: #333 !important;
}

.login-input::placeholder {
  color: #666 !important;
  opacity: 0.8;
  font-style: italic;
}

.login-input:focus::placeholder {
  color: transparent;
}

/* Icon Fix */
.fas, .far, .fab {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
  font-weight: 900;
}

/* Perbaikan untuk AdminLTE Layout */
.wrapper {
    min-height: 100vh;
}

/* Brand Link Styling */
.brand-link {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white !important;
    text-decoration: none;
}

.brand-link:hover {
    color: #74b9ff !important;
    text-decoration: none;
}

/* User Panel Styling */
.user-panel {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-panel .info a {
    color: white !important;
}

/* Sidebar Menu Icon Alignment */
.nav-sidebar .nav-icon {
    margin-right: 0.5rem;
    width: 1.2rem;
    text-align: center;
}

/* Modern Sidebar Styling with Dark Blue */
.main-sidebar {
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%) !important;
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}

/* Ensure sidebar dark variant uses dark blue gradient */
.sidebar-dark-primary .main-sidebar,
.sidebar-dark .main-sidebar {
    background: linear-gradient(180deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%) !important;
}

/* Sidebar Search Form */
.sidebar .form-inline {
    margin: 1rem 0.5rem;
}

.form-control-sidebar {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.form-control-sidebar::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.btn-sidebar {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-sidebar:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Nav Headers */
.nav-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.75rem 1rem 0.25rem 1rem;
    margin-top: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* Nav Items with Badges */
.nav-sidebar .nav-item .nav-link p .badge {
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
}

/* User Panel Enhancement */
.user-panel .info a {
    color: #fff !important;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.user-panel .info small {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.75rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Enhanced Text Readability on Gradient */
.nav-sidebar .nav-link {
    color: #fff !important;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.nav-sidebar .nav-link p {
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.nav-sidebar .nav-icon {
    color: #fff !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Brand link text enhancement */
.brand-link .brand-text {
    color: #fff !important;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Brand Link Enhancement */
.brand-link {
    padding: 0.8125rem 0.5rem;
    transition: all 0.3s ease;
}

.brand-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Active Menu Item */
.nav-sidebar .nav-item > .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 0.25rem;
    margin: 0 0.5rem;
}

/* Submenu Active Item */
.nav-treeview .nav-item > .nav-link.active {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    font-weight: bold;
    border-radius: 0.25rem;
    margin: 0 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Menu Hover Effects */
.nav-sidebar .nav-item:hover > .nav-link {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.25rem;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

/* Submenu Hover Effects */
.nav-treeview .nav-item:hover > .nav-link:not(.active) {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border-radius: 0.25rem;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

/* Content Wrapper Margin */
.content-wrapper {
    margin-left: 250px !important;
    background: transparent !important;
}

/* Responsive Design */
@media (max-width: 767.98px) {
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    .main-sidebar {
        margin-left: -250px;
    }
    
    .sidebar-open .main-sidebar {
        margin-left: 0;
    }
}

/* Dashboard Cards Fix */
.small-box {
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.small-box .inner {
    padding: 20px;
    color: #ffffff !important;
    font-weight: bold;
}

.small-box .inner h3 {
    font-weight: bold !important;
    color: #ffffff !important;
    font-size: 2.2rem;
}

.small-box .inner p {
    font-weight: 600 !important;
    color: #ffffff !important;
    font-size: 1rem;
}

.small-box .icon {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 70px;
    opacity: 0.3;
    color: #ffffff;
}

.small-box-footer {
    background: rgba(0, 0, 0, 0.2);
    color: white !important;
    text-decoration: none;
    padding: 10px;
    display: block;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 600;
}

.small-box-footer:hover {
    background: rgba(0, 0, 0, 0.3);
    color: white !important;
    text-decoration: none;
}

/* Fix Content Wrapper Margin for Sidebar Overlap */
@media (min-width: 768px) {
    .content-wrapper {
        margin-left: 250px !important;
        transition: margin-left 0.3s ease;
    }
    
    .sidebar-collapse .content-wrapper {
        margin-left: 0 !important;
    }
    
    .main-header {
        margin-left: 250px !important;
        transition: margin-left 0.3s ease;
    }
    
    .sidebar-collapse .main-header {
        margin-left: 0 !important;
    }
    
    .main-footer {
        margin-left: 250px !important;
        transition: margin-left 0.3s ease;
    }
    
    .sidebar-collapse .main-footer {
        margin-left: 0 !important;
    }
}

@media (max-width: 767px) {
    .content-wrapper {
        margin-left: 0 !important;
    }
    
    .main-header {
        margin-left: 0 !important;
    }
    
    .main-footer {
        margin-left: 0 !important;
    }
}

/* Ensure cards don't overlap with sidebar */
.content-wrapper .container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

/* Fix for dashboard cards specifically */
.content-wrapper .row {
  margin-left: 0;
  margin-right: 0;
}

.content-wrapper .col-lg-3,
.content-wrapper .col-md-4,
.content-wrapper .col-sm-6,
.content-wrapper .col-12 {
  padding-left: 15px;
  padding-right: 15px;
}

/* Fix for Real-time Monitoring Grafana card */
@media (min-width: 768px) {
  .content-wrapper {
    margin-left: 250px !important;
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .content-wrapper .card {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  .content-wrapper .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Ensure proper spacing for all cards */
.content-wrapper .card.glass-card {
  margin-bottom: 20px;
  box-sizing: border-box;
}

/* Real-time Charts Styling */
.real-time-charts-container {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: 20px;
  margin-bottom: 20px;
}

.chart-container {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.chart-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f8f9fa;
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

.chart-canvas-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-canvas-container canvas {
  max-height: 300px !important;
}

/* Logger Status Cards */
.logger-status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.logger-card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.logger-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
}

.logger-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.logger-card:hover::before {
  width: 6px;
}

.logger-card.online::before {
  background: linear-gradient(135deg, #51cf66, #40c057);
}

.logger-card.offline::before {
  background: linear-gradient(135deg, #ff6b6b, #fa5252);
}

.logger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logger-name {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.logger-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logger-status.online {
  background: rgba(81, 207, 102, 0.1);
  color: #40c057;
  border: 1px solid rgba(81, 207, 102, 0.2);
}

.logger-status.offline {
  background: rgba(255, 107, 107, 0.1);
  color: #fa5252;
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.logger-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-item {
  text-align: center;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.metric-label {
  font-size: 11px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
}

.metric-unit {
  font-size: 10px;
  color: #6c757d;
  margin-left: 2px;
}

/* Loading States */
.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: #6c757d;
  font-size: 14px;
}

.chart-loading i {
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .chart-canvas-container {
    height: 250px;
  }
  
  .logger-status-cards {
    grid-template-columns: 1fr;
  }
  
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Unit Selection Enhancement */
.unit-selection-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
}

.unit-selection-card .card-header {
  background: rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.unit-selection-card .form-control {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  backdrop-filter: blur(10px);
}

.unit-selection-card .form-control:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
  box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.unit-selection-card .form-control option {
  background: #2c3e50;
  color: white;
}

/* Enhanced Device Popup Styles */
.device-popup-enhanced {
  min-width: 250px;
  max-width: 280px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.device-popup-enhanced .popup-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 16px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.device-popup-enhanced .popup-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
  z-index: 0;
}

.device-popup-enhanced .popup-header > * {
  position: relative;
  z-index: 1;
}

.device-popup-enhanced .popup-header h5 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-popup-enhanced .device-id-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.device-popup-enhanced .popup-body {
  padding: 16px;
  background: #ffffff;
}

.device-popup-enhanced .info-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.device-popup-enhanced .info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #e9ecef;
  transition: all 0.2s ease;
}

.device-popup-enhanced .info-item:hover {
  background: #e9ecef;
  transform: translateX(2px);
}

.device-popup-enhanced .info-item i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.device-popup-enhanced .info-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.device-popup-enhanced .info-label {
  font-size: 0.7rem;
  color: #6c757d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.device-popup-enhanced .info-value {
  font-size: 0.8rem;
  color: #2c3e50;
  font-weight: 600;
}

.device-popup-enhanced .status-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 12px;
}

.device-popup-enhanced .status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
}

.device-popup-enhanced .status-indicator.online {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.device-popup-enhanced .status-indicator.offline {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.device-popup-enhanced .last-seen {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6c757d;
  font-size: 0.85rem;
}

.device-popup-enhanced .popup-footer {
  padding: 16px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  text-align: center;
}

.device-popup-enhanced .btn-direction {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.device-popup-enhanced .btn-direction:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.device-popup-enhanced .btn-direction:active {
  transform: translateY(0);
}

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 0;
  line-height: 1.4;
}

.leaflet-popup-tip {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Fullscreen Mode - Hide Sidebar Completely */
body.fullscreen-mode .main-sidebar {
  display: none !important;
}

body.fullscreen-mode .content-wrapper {
  margin-left: 0 !important;
}

body.fullscreen-mode .main-header {
  margin-left: 0 !important;
}

body.fullscreen-mode .main-footer {
  margin-left: 0 !important;
}

/* Custom Sidebar Styling - Match Header Theme */
.main-sidebar {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%) !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
}

.main-sidebar::before {
  background: linear-gradient(180deg, #667eea 0%, #764ba2 100%) !important;
}

/* Brand Link Styling */
.main-sidebar .brand-link {
  background: rgba(255, 255, 255, 0.1) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  transition: all 0.3s ease !important;
}

.main-sidebar .brand-link:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  text-decoration: none !important;
}

.main-sidebar .brand-text {
  color: #ffffff !important;
  font-weight: 600 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

/* Sidebar Content */
.main-sidebar .sidebar {
  background: transparent !important;
}

/* User Panel */
.main-sidebar .user-panel {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.main-sidebar .user-panel .info a {
  color: #ffffff !important;
  font-weight: 500 !important;
}

.main-sidebar .user-panel .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Navigation Menu */
.main-sidebar .nav-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  border-radius: 8px !important;
  margin: 2px 8px !important;
  transition: all 0.3s ease !important;
}

.main-sidebar .nav-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
  transform: translateX(5px) !important;
}

.main-sidebar .nav-sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  font-weight: 600 !important;
}

.main-sidebar .nav-sidebar .nav-link .nav-icon {
  color: rgba(255, 255, 255, 0.8) !important;
  margin-right: 10px !important;
}

.main-sidebar .nav-sidebar .nav-link:hover .nav-icon,
.main-sidebar .nav-sidebar .nav-link.active .nav-icon {
  color: #ffffff !important;
}

/* Navigation Headers */
.main-sidebar .nav-header {
  color: rgba(255, 255, 255, 0.6) !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.5px !important;
  margin-top: 15px !important;
}

/* Treeview Menu */
.main-sidebar .nav-treeview .nav-link {
  color: rgba(255, 255, 255, 0.8) !important;
  padding-left: 50px !important;
}

.main-sidebar .nav-treeview .nav-link:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

.main-sidebar .nav-treeview .nav-link.active {
  background: rgba(255, 255, 255, 0.15) !important;
  color: #ffffff !important;
}

/* Right Arrow for Treeview */
.main-sidebar .nav-link .right {
  color: rgba(255, 255, 255, 0.7) !important;
}

.main-sidebar .nav-link:hover .right,
.main-sidebar .nav-link.active .right {
  color: #ffffff !important;
}