/* Modern IoT Dashboard Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
  /* Android App Color Palette */
  --timberwolf: #DAD7CD;
  --sage: #A3B18A;
  --fern-green: #588157;
  --hunter-green: #3A5A40;
  --brunswick-green: #344E41;

  /* Theme Colors Mapped */
  --primary: var(--fern-green);
  --primary-dark: var(--hunter-green);
  --primary-light: var(--sage);
  --secondary: var(--sage);
  --secondary-dark: var(--fern-green);
  
  --accent: #d97706;
  --accent-dark: #b45309;
  
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --warning: #f97316;
  --warning-dark: #ea580c;
  --success: var(--fern-green);
  --info: #3b82f6;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: var(--timberwolf);
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  
  /* Text Colors */
  --text-primary: var(--brunswick-green);
  --text-secondary: var(--hunter-green);
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
  
  /* Border & Shadow */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 6px 8px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Border Radius */
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: 0.3s ease;
  --transition-fast: 0.15s ease;
  --transition-slow: 0.5s ease;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
  --gradient-secondary: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-dark));
  --gradient-danger: linear-gradient(135deg, var(--danger), var(--danger-dark));
  --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #022c22;
  --bg-secondary: #064e3b;
  --bg-tertiary: #065f46;
  --bg-card: #064e3b;
  --bg-glass: rgba(6, 78, 59, 0.8);
  
  --text-primary: #ecfdf5;
  --text-secondary: #a7f3d0;
  --text-muted: #6ee7b7;
  
  --border: #065f46;
  --border-light: #10b981;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 8px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  object-fit: contain;
}

.rotate-animation {
  animation: logo-rotate 2s linear infinite;
}

@keyframes logo-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Login Page */
.login-container {
  min-height: 100vh;
    display: flex;
  align-items: center;
    justify-content: center;
  position: relative;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.login-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.floating-shapes .shape {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.shape-1 { width: 80px; height: 80px; top: 20%; left: 10%; }
.shape-2 { width: 120px; height: 120px; top: 60%; right: 15%; animation-delay: 2s; }
.shape-3 { width: 60px; height: 60px; bottom: 20%; left: 20%; animation-delay: 4s; }

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

.login-card {
  background: var(--bg-primary);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
  margin-bottom: 2rem;
}

.login-header .logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: white;
}

.login-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.login-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.input-group input {
    width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: var(--transition);
}

.input-group input:focus {
    outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.login-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-btn:hover {
    transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.error-message {
  color: var(--danger);
  text-align: center;
  font-size: 0.875rem;
  margin-top: 1rem;
  display: none;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-footer {
  margin-top: 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.login-footer p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--primary-dark);
  transform: translateX(-4px);
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

/* Animated Background */
.dashboard::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(5, 150, 105, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(217, 119, 6, 0.05) 0%, transparent 50%);
  animation: backgroundShift 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0%, 100% { transform: translateX(0) translateY(0) scale(1); }
  33% { transform: translateX(-20px) translateY(-10px) scale(1.05); }
  66% { transform: translateX(20px) translateY(10px) scale(0.95); }
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: var(--z-sticky);
  transition: var(--transition);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-glass);
  z-index: -1;
}

.sidebar-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-secondary);
  color: var(--primary);
  border-left-color: var(--primary);
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.status-indicator.connected {
  color: var(--secondary);
}

.logout-btn {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
    cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.logout-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  font-size: 1.125rem;
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  background: var(--primary);
  color: var(--text-inverse);
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.mobile-sidebar-toggle {
  display: none;
  margin-right: 0.5rem;
}

@media (max-width: 1024px) {
  .mobile-sidebar-toggle {
    display: block;
  }
}

#pageTitle {
  font-size: 1.5rem;
  font-weight: 600;
}

.header-stats {
  display: flex;
  gap: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
}

.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Quick Stats */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card.updated {
  animation: pulse 0.3s ease;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.stat-icon {
  width: 50px;
  height: 50px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.stat-content h3 {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-unit {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.stat-status i {
  font-size: 0.75rem;
  color: var(--secondary);
}

.stat-status.warning i { color: var(--warning); }
.stat-status.danger i { color: var(--danger); }

/* Chart Container */
.chart-container {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  transition: var(--transition);
}

.chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-glass);
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
}

.chart-container:hover::before {
  opacity: 1;
}

.chart-container:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2xl);
}

.chart-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.chart-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
}

.chart-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.chart-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.chart-wrapper {
  padding: 2rem;
  height: 500px;
  position: relative;
}

/* Sensors Grid */
.sensors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.sensor-detail-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}

.sensor-detail-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.sensor-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sensor-icon {
  width: 50px;
  height: 50px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--primary);
}

.sensor-info {
  flex: 1;
}

.sensor-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sensor-info p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sensor-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.sensor-data {
  padding: 1.5rem;
  text-align: center;
}

.data-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.data-value .unit {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.data-range {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sensor-chart {
  padding: 1rem 1.5rem;
  height: 200px;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.analytics-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.analytics-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row span:first-child {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.stat-row span:last-child {
  font-weight: 600;
}

.health-indicators {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.health-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.health-item:last-child {
  border-bottom: none;
}

.health-item i:first-child {
  width: 20px;
  color: var(--text-secondary);
}

.health-item span {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.health-status i {
  font-size: 0.75rem;
  color: var(--secondary);
}

.health-status.warning i { color: var(--warning); }
.health-status.danger i { color: var(--danger); }

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.settings-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.settings-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.setting-item, .threshold-item {
  margin-bottom: 1rem;
}

.setting-item label, .threshold-item label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.setting-item select, .threshold-item input {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: var(--transition);
}

.setting-item select:focus, .threshold-item input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.5rem;
  z-index: 10000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 300px;
}

.notification.show {
  transform: translateX(0);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.notification i {
  font-size: 1.25rem;
}

.notification-success {
  border-left: 4px solid var(--secondary);
}

.notification-success i {
  color: var(--secondary);
}

.notification-error {
  border-left: 4px solid var(--danger);
}

.notification-error i {
  color: var(--danger);
}

.notification-info {
  border-left: 4px solid var(--primary);
}

.notification-info i {
  color: var(--primary);
}

/* Settings Save Button */
.save-settings-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 1rem;
  width: 100%;
}

.save-settings-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Health Status Colors */
.health-status.connected i,
.status-indicator.connected i {
  color: var(--secondary);
}

.health-status.warning i,
.status-indicator.warning i {
  color: var(--warning);
}

.health-status.danger i,
.status-indicator.danger i {
  color: var(--danger);
}

.health-status.error i,
.status-indicator.error i {
  color: var(--danger);
}

.health-status.disconnected i,
.status-indicator.disconnected i {
  color: var(--text-muted);
}

/* Sensor Info List */
.sensor-info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.info-item i {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.info-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.info-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.info-content .range {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* All Sensor Values Display */
.all-sensor-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.sensor-value-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.sensor-value-item:hover {
  background: var(--bg-tertiary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.sensor-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.sensor-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

/* Enhanced Sensor Cards */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 0 1rem;
}

.sensor-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
}

.sensor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-glass);
  opacity: 0;
  transition: var(--transition);
  z-index: -1;
}

.sensor-card:hover::before {
  opacity: 1;
}

.sensor-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-2xl);
  border-color: var(--primary);
}

.sensor-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  transition: var(--transition);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.sensor-card.critical::after {
  background: var(--gradient-danger);
}

.sensor-card.danger::after {
  background: var(--gradient-accent);
}

.sensor-card.warning::after {
  background: var(--gradient-accent);
}

.sensor-card.normal::after {
  background: var(--gradient-secondary);
}

.sensor-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.sensor-card.updated {
  animation: pulse 0.3s ease-in-out;
}

.sensor-header {
    display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.sensor-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.5rem;
  font-size: 1.5rem;
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.sensor-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-glass);
  opacity: 0;
  transition: var(--transition);
}

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

.sensor-card:hover .sensor-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: var(--shadow-lg);
}

.sensor-info h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.125rem;
    font-weight: 600;
  color: var(--text-primary);
}

.sensor-status {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
    text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sensor-status i {
  margin-right: 0.5rem;
  font-size: 0.5rem;
}

.sensor-status.normal {
  color: var(--success);
}

.sensor-status.warning {
  color: var(--warning);
}

.sensor-status.danger {
  color: var(--danger);
}

.sensor-status.critical {
  color: var(--danger);
  animation: blink 1s infinite;
}

.sensor-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: baseline;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  position: relative;
}

.sensor-value::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-slow);
}

.sensor-card:hover .sensor-value::before {
  width: 100%;
}

.sensor-value .unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.sensor-range {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Notifications */
.notifications-area {
  position: relative;
}

.notifications-container {
  position: fixed;
  top: 80px;
  right: 1rem;
  z-index: 1000;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.notification {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.warning {
  border-left: 4px solid var(--warning);
}

.notification.danger {
  border-left: 4px solid var(--danger);
}

.notification.critical {
  border-left: 4px solid var(--danger);
  background: linear-gradient(135deg, var(--danger) 0%, rgba(239, 68, 68, 0.1) 100%);
  animation: pulse 2s infinite;
}

.notification-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.notification.warning .notification-icon {
  background: var(--warning);
  color: white;
}

.notification.danger .notification-icon {
  background: var(--danger);
  color: white;
}

.notification.critical .notification-icon {
  background: var(--danger);
  color: white;
  animation: pulse 1s infinite;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
    font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.notification-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.notification-sensor {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  transition: var(--transition);
  flex-shrink: 0;
}

.notification-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0.3;
  }
}

/* Map Markers & Animations */
.map-marker {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-marker .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.map-marker .ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  z-index: 1;
}

/* Low Risk - Calm Pulse */
.marker-low .dot { background: var(--fern-green); }
.marker-low .ring { 
  background: var(--fern-green);
  animation: pulse-ring 3s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* Medium Risk - Faster Pulse */
.marker-medium .dot { background: var(--warning); }
.marker-medium .ring { 
  background: var(--warning);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* High Risk - Rapid, Intense Pulse */
.marker-high .dot { background: var(--danger); }
.marker-high .ring { 
  background: var(--danger);
  animation: pulse-ring 1s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.marker-high .dot {
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.5); opacity: 0.8; }
  80%, 100% { transform: scale(2.5); opacity: 0; }
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Custom Map Popup */
.custom-popup .leaflet-popup-content-wrapper {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.custom-popup .leaflet-popup-content {
  margin: 0;
  width: 260px !important;
  line-height: 1.5;
}

.custom-popup .leaflet-popup-tip {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-top: none;
  border-left: none;
}

.custom-popup .leaflet-container a.leaflet-popup-close-button {
  color: var(--text-secondary);
  padding: 8px;
  font-size: 16px;
}

.popup-header {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.popup-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.popup-badge.low { background: rgba(88, 129, 87, 0.15); color: var(--fern-green); }
.popup-badge.medium { background: rgba(249, 115, 22, 0.15); color: var(--warning); }
.popup-badge.high { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.popup-body {
  padding: 16px;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.popup-label {
  color: var(--text-secondary);
}

.popup-value {
  font-weight: 600;
  color: var(--text-primary);
}

.popup-actions {
  padding: 0 16px 16px;
}

.popup-btn {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.popup-btn:hover {
  background: var(--primary-dark);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: var(--z-modal);
    transform: translateX(-100%);
    transition: transform var(--transition);
    backdrop-filter: blur(20px);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
  }
  
  .sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
  }
  
  .overview-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }
  
  .sensors-grid {
    grid-template-columns: 1fr;
  }
  
  .header-controls {
    gap: 0.5rem;
  }
  
  .theme-toggle {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .content {
    padding: 1rem;
  }
  
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
  }
  
  .sensor-card {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .sensor-icon {
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
  }
  
  .sensor-value {
    font-size: 2.5rem;
  }
  
  .chart-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
  }
  
  .chart-wrapper {
    padding: 1rem;
    height: 300px;
  }
  
  .header-info {
    display: none;
  }
  
  .header-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.875rem;
  }
  
  .login-card {
    margin: 1rem;
    padding: 2rem;
  }
  
  .notifications-container {
    max-width: 300px;
    right: 0.5rem;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 0.5rem;
  }
  
  .sensor-card {
    padding: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .sensor-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    margin-right: 0.75rem;
  }
  
  .sensor-value {
    font-size: 2rem;
  }
  
  .sensor-info h3 {
    font-size: 1rem;
  }
  
  .chart-wrapper {
    height: 250px;
    padding: 0.5rem;
  }
  
  .chart-header {
    padding: 0.75rem;
  }
  
  .chart-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .header {
    padding: 0.75rem 1rem;
  }
  
  #pageTitle {
    font-size: 1.25rem;
  }
  
  .theme-toggle {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
  
  .notifications-container {
    max-width: 250px;
    right: 0.25rem;
  }
  
  .notification {
    padding: 0.75rem;
    font-size: 0.875rem;
  }
}

/* Filter Controls */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-controls {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-primary);
  padding: 0.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
}

.loading-placeholder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  gap: 1rem;
}

.loading-placeholder i {
  font-size: 2rem;
  color: var(--primary);
}

.close-chart-btn {
  color: var(--danger);
  border-color: var(--danger);
}

/* Map Styles */
.map-wrapper {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  height: calc(100vh - 200px);
  min-height: 500px;
}

#mapContainer {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  z-index: 1;
}

/* Fix Leaflet z-index issues with sidebar */
.leaflet-pane {
  z-index: 1 !important;
}

.leaflet-top, .leaflet-bottom {
  z-index: 2 !important;
}

/* Sensor Details Section */
.details-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.back-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  transition: var(--transition);
}

.back-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  border-color: var(--primary);
}

.sensor-status-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--bg-secondary);
}

.sensor-status-badge.normal { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.sensor-status-badge.warning { color: var(--warning); background: rgba(245, 158, 11, 0.1); }
.sensor-status-badge.critical { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.detail-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary);
}

.detail-info h3 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.detail-info p {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.chart-card {
  background: var(--bg-primary);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.chart-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.chart-wrapper-small {
  height: 250px;
  position: relative;
}

.view-details-btn {
  margin-top: 1rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.view-details-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .details-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .sensor-status-badge {
    margin-left: 0;
  }
}


