/* ================================
   VAILLANT WP MONITORING STYLES
   ================================ */

/* Enhanced CSS Variables for Professional Theme */
:root {
  /* Text Colors - Enhanced Contrast */
  --text-primary: #0f172a;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-accent: #1e293b;
  
  /* Background Colors - Subtle Gradients */
  --bg-primary: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  --bg-secondary: linear-gradient(135deg, #f9fafb 0%, #f1f5f9 100%);
  --bg-tertiary: linear-gradient(135deg, #f3f4f6 0%, #e2e8f0 100%);
  
  /* Border Colors - Soft Edges */
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  
  /* Status Colors - Professional Palette */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-error: #ef4444;
  --status-info: #3b82f6;
  
  /* Accent Colors */
  --accent-primary: #1e40af;
  --accent-secondary: #7c3aed;
}

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
}

/* Dark Mode Variables (both .dark class and data-theme support) */
.dark,
[data-theme="dark"] {
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-accent: #ffffff;
  
  --bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-secondary: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  --bg-tertiary: linear-gradient(135deg, #334155 0%, #475569 100%);
  
  --border-primary: #475569;
  --border-secondary: #64748b;
  
  --status-success: #34d399;
  --status-warning: #fbbf24;
  --status-error: #f87171;
  --status-info: #60a5fa;
  
  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
}

/* Enhanced Typography & Readability */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Inter', sans-serif;
  line-height: 1.6;
  font-size: 16px;
  letter-spacing: 0.025em;
  color: var(--text-primary);
  background: var(--bg-secondary);
  background-attachment: fixed;
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  margin-top: 0;
}

p, span, div {
  line-height: 1.5;
  color: var(--text-primary);
}

/* Theme-aware Text Classes */
.text-primary { 
  color: var(--text-primary) !important; 
}

.text-secondary { 
  color: var(--text-secondary) !important; 
}

.text-muted { 
  color: var(--text-muted) !important; 
}

.text-accent {
  color: var(--text-accent) !important;
}

/* Status Colors with CSS Variables and Glow Effects */
.status-online { 
  color: var(--status-success); 
  font-weight: 500;
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.3));
}

.status-warning { 
  color: var(--status-warning); 
  font-weight: 500;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.3));
}

.status-error { 
  color: var(--status-error); 
  font-weight: 500; 
}

.status-offline { 
  color: var(--text-muted); 
  font-weight: 500; 
}

.status-info {
  color: var(--status-info);
  font-weight: 500;
}

/* Background Status Colors */
.bg-status-online { 
  background-color: rgba(5, 150, 105, 0.1); 
  border-color: var(--status-success); 
  color: var(--status-success);
}

.bg-status-warning { 
  background-color: rgba(217, 119, 6, 0.1); 
  border-color: var(--status-warning); 
  color: var(--status-warning);
}

.bg-status-error { 
  background-color: rgba(220, 38, 38, 0.1); 
  border-color: var(--status-error); 
  color: var(--status-error);
}

.bg-status-offline { 
  background-color: rgba(107, 114, 128, 0.1); 
  border-color: var(--text-muted); 
  color: var(--text-muted);
}

/* Dark Mode Status Background Adjustments */
.dark .bg-status-online { 
  background-color: rgba(16, 185, 129, 0.15); 
}

.dark .bg-status-warning { 
  background-color: rgba(245, 158, 11, 0.15); 
}

.dark .bg-status-error { 
  background-color: rgba(248, 113, 113, 0.15); 
}

.dark .bg-status-offline { 
  background-color: rgba(156, 163, 175, 0.15); 
}
.dark .bg-status-error { background-color: rgba(220, 38, 38, 0.15); border-color: #f87171; }
.dark .bg-status-offline { background-color: rgba(107, 114, 128, 0.15); border-color: #9ca3af; }

/* ================================
   ENHANCED ANIMATIONS & EFFECTS
   ================================ */

.loading-spinner {
  border: 4px solid rgba(59, 130, 246, 0.1);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pulse-animation {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

/* Professional Hover Effects */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.dark .hover-lift:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Connection Indicators with Enhanced Glow */
.online-indicator,
.offline-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-glow 2s infinite;
  box-shadow: 0 0 8px currentColor;
}

.online-indicator {
  background-color: var(--status-success);
  color: var(--status-success);
}

.offline-indicator {
  background-color: var(--status-error);
  color: var(--status-error);
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 8px currentColor;
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
    box-shadow: 0 0 16px currentColor;
  }
}

/* ================================
   COMPONENT STYLES
   ================================ */

/* Device Cards */
.device-card {
  transition: all 0.2s ease;
  cursor: pointer;
}

.device-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* KPI Cards - Enhanced Professional Design */
.kpi-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px 16px 0 0;
}

.dark .kpi-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  border-color: rgba(71, 85, 105, 0.8);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
}

.dark .kpi-card:hover {
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.3), 0 10px 10px rgba(0, 0, 0, 0.2);
}

/* KPI Values with CSS Variables for Maximum Contrast */
.kpi-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin: 0.5rem 0;
  letter-spacing: -0.05em;
  color: var(--text-accent);
}

.dark .kpi-value {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.kpi-label {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.kpi-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Category Sections */
.category-section {
  border-radius: 16px;
  border: 2px solid;
}

.executive-summary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ================================
   DARK MODE IMPROVEMENTS
   ================================ */

/* Dark Mode Improvements - Enhanced Contrast */
.dark .text-green-600 { color: #22c55e !important; }
.dark .text-red-600 { color: #ef4444 !important; }
.dark .text-yellow-600 { color: #eab308 !important; }
.dark .text-blue-600 { color: #3b82f6 !important; }
.dark .text-orange-600 { color: #ea580c !important; }

.dark .bg-green-50 { background-color: rgba(34, 197, 94, 0.12) !important; }
.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.12) !important; }
.dark .bg-yellow-50 { background-color: rgba(234, 179, 8, 0.12) !important; }
.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.12) !important; }
.dark .bg-orange-50 { background-color: rgba(234, 88, 12, 0.12) !important; }

/* Better Card Readability with CSS Variables - ENHANCED */
.card-readable {
  background-color: var(--bg-primary);
  border: 2px solid var(--border-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  margin-left: 0;
  margin-right: 0;
  width: 100%;
  max-width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
  overflow: hidden;
  word-wrap: break-word;
  box-sizing: border-box;
}

.dark .card-readable {
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
}

.card-readable:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  border-color: var(--border-secondary);
}

.dark .card-readable:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
}

/* Text Overflow Prevention */
.card-readable * {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

/* Enhanced Table Readability with CSS Variables */
.table-readable {
  font-size: 0.95rem;
  line-height: 1.5;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-primary);
}

.table-readable th {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--border-primary);
}

.table-readable td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.table-readable tbody tr:hover td {
  background-color: var(--bg-tertiary);
  transform: scale(1.002);
  transition: all 0.15s ease;
}

.table-readable td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.dark .table-readable td {
  border-bottom-color: #4b5563;
}

/* ================================
   NAVIGATION
   ================================ */

/* Header - Professional Design */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom-color: rgba(71, 85, 105, 0.8);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

header h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation - Enhanced Professional Design */
.nav-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 12px;
  flex-shrink: 0;
  min-width: fit-content;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s;
}

.nav-btn:hover::before {
  left: 100%;
}

.nav-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.dark .nav-btn:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-btn:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.dark .nav-btn:focus {
  outline-color: #60a5fa;
}

/* Mobile Navigation - Better Touch Targets */
.mobile-nav-btn {
  min-height: 70px;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: fit-content;
  font-weight: 500;
  font-size: 0.75rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid transparent;
}

.mobile-nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.08);
  transform: translateY(-1px);
}

.dark .mobile-nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

.mobile-nav-btn i {
  font-size: 1.5rem;
  margin-bottom: 0.375rem;
  display: block;
  line-height: 1;
}

#mobile-nav {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.dark #mobile-nav {
  background-color: rgba(31, 41, 55, 0.98);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* ================================
   PAGE CONTENT LAYOUT - FORCED CONSISTENCY
   ================================ */

/* Main container - EXPLICIT padding for ALL screen sizes */
main {
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
  padding: 0rem 0.5rem;
}

@media (min-width: 640px) {
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 768px) {
  main {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  main {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1280px) {
  main {
    padding-left: 3rem;
    padding-right: 3rem;
  }
}

/* Page content wrapper */
.page-content {
  box-sizing: border-box;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 1rem;
  padding-bottom: 2rem;
}

/* Ensure first element doesn't push content down */
.page-content > *:first-child {
  margin-top: 0 !important;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

/* Chart Overlays */
.chart-overlay {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(4px);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .chart-overlay {
  background-color: rgba(31, 41, 55, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Form Elements with CSS Variables */
select, input {
  transition: all 0.2s ease-in-out;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

select:focus, input:focus {
  border-color: var(--status-info);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

select:hover, input:hover {
  border-color: var(--border-secondary);
}

/* Enhanced Button Styling with Professional Design */
button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.025em;
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
}

/* Icon Button Consistency */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  background-color: transparent;
}

.icon-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.dark .icon-btn:hover {
  background-color: rgba(59, 130, 246, 0.2);
}

button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:hover:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button:active:not(:disabled) {
  transform: translateY(0);
  transition-duration: 0.05s;
}

/* Navigation Improvements */
.nav-btn {
  color: var(--text-muted);
  transition: all 0.2s ease-in-out;
  background-color: transparent;
}

.nav-btn:hover {
  color: var(--text-primary);
  background-color: rgba(59, 130, 246, 0.05);
  border-bottom-color: rgba(59, 130, 246, 0.3);
}

.dark .nav-btn:hover {
  background-color: rgba(59, 130, 246, 0.15);
}

.nav-btn.active,
.nav-btn.text-vaillant-blue {
  color: #1e40af !important;
  font-weight: 600;
  background-color: rgba(59, 130, 246, 0.08);
}

.dark .nav-btn.active,
.dark .nav-btn.text-vaillant-blue {
  color: #60a5fa !important;
  background-color: rgba(59, 130, 246, 0.2);
}

/* Mobile Navigation Active State */
.mobile-nav-btn.text-vaillant-blue {
  background-color: rgba(59, 130, 246, 0.1);
  border-bottom-color: #1e40af;
}

.dark .mobile-nav-btn.text-vaillant-blue {
  background-color: rgba(59, 130, 246, 0.2);
  border-bottom-color: #60a5fa;
}

/* Comprehensive Tailwind Overrides for Dark Mode */
.dark .bg-gray-50 {
  background-color: var(--bg-secondary) !important;
}

.dark .bg-white {
  background-color: var(--bg-primary) !important;
}

.dark .bg-gray-800 {
  background-color: var(--bg-primary) !important;
  border: 2px solid var(--border-primary) !important;
}

.dark .bg-gray-700 {
  background-color: var(--bg-tertiary) !important;
}

.dark .border-gray-200 {
  border-color: var(--border-primary) !important;
}

.dark .border-gray-300 {
  border-color: var(--border-secondary) !important;
}

.dark .border-gray-700 {
  border-color: var(--border-primary) !important;
}

/* Text Color Overrides for Maximum Contrast */
.dark .text-gray-900 {
  color: var(--text-accent) !important;
}

.dark .text-gray-500 {
  color: var(--text-secondary) !important;
}

.dark .text-gray-600 {
  color: var(--text-secondary) !important;
}

.dark .text-gray-400 {
  color: var(--text-muted) !important;
}

.dark .text-gray-300 {
  color: var(--text-secondary) !important;
}

.dark .text-gray-200 {
  color: var(--text-primary) !important;
}

/* Status Badge Color Improvements */
.dark .bg-green-100 {
  background-color: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.dark .bg-blue-100 {
  background-color: rgba(96, 165, 250, 0.2) !important;
  border: 1px solid rgba(96, 165, 250, 0.4) !important;
}

.dark .bg-red-100 {
  background-color: rgba(248, 113, 113, 0.2) !important;
  border: 1px solid rgba(248, 113, 113, 0.4) !important;
}

/* ================================
   GATEWAY DATA CONTAINER STYLES
   ================================ */

/* Gateway Data Content Containers */
#consumption-content,
#diagnostics-content,
#systems-content,
#schedules-content,
#settings-content {
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.6;
}

/* Gateway Data Cards with Better Text Handling */
#consumption-card,
#diagnostics-card,
#systems-card,
#schedules-card,
#settings-card {
  min-height: 200px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
}

#consumption-card .p-6,
#diagnostics-card .p-6,
#systems-card .p-6,
#schedules-card .p-6,
#settings-card .p-6 {
  flex: 1;
  overflow: hidden;
}

/* Data Display Improvements */
.gateway-data-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.gateway-data-item:last-child {
  border-bottom: none;
}

.gateway-data-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 120px;
  max-width: 40%;
  flex-shrink: 0;
  margin-right: 1rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.gateway-data-value {
  color: var(--text-primary);
  text-align: right;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 60%;
}

/* Scrollbar Styling */
#consumption-content::-webkit-scrollbar,
#diagnostics-content::-webkit-scrollbar,
#systems-content::-webkit-scrollbar,
#schedules-content::-webkit-scrollbar,
#settings-content::-webkit-scrollbar {
  width: 6px;
}

#consumption-content::-webkit-scrollbar-track,
#diagnostics-content::-webkit-scrollbar-track,
#systems-content::-webkit-scrollbar-track,
#schedules-content::-webkit-scrollbar-track,
#settings-content::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

#consumption-content::-webkit-scrollbar-thumb,
#diagnostics-content::-webkit-scrollbar-thumb,
#systems-content::-webkit-scrollbar-thumb,
#schedules-content::-webkit-scrollbar-thumb,
#settings-content::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 3px;
}

#consumption-content::-webkit-scrollbar-thumb:hover,
#diagnostics-content::-webkit-scrollbar-thumb:hover,
#systems-content::-webkit-scrollbar-thumb:hover,
#schedules-content::-webkit-scrollbar-thumb:hover,
#settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.dark .bg-yellow-100 {
  background-color: rgba(245, 158, 11, 0.2) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

.dark .text-green-800 {
  color: #a7f3d0 !important;
  font-weight: 600 !important;
}

.dark .text-blue-800 {
  color: #bfdbfe !important;
  font-weight: 600 !important;
}

.dark .text-red-800 {
  color: #fecaca !important;
  font-weight: 600 !important;
}

.dark .text-yellow-800 {
  color: #fef3c7 !important;
  font-weight: 600 !important;
}

/* Color-specific Dark Mode Overrides for Better Contrast */
.dark .text-green-600 {
  color: #34d399 !important;
}

.dark .text-blue-600 {
  color: #60a5fa !important;
}

.dark .text-red-600 {
  color: #f87171 !important;
}

.dark .text-yellow-600 {
  color: #fbbf24 !important;
}

.dark .text-green-500 {
  color: #6ee7b7 !important;
}

.dark .text-blue-500 {
  color: #93c5fd !important;
}

.dark .text-red-500 {
  color: #fca5a5 !important;
}

.dark .text-yellow-500 {
  color: #fcd34d !important;
}

.dark .text-green-400 {
  color: #86efac !important;
}

.dark .text-blue-400 {
  color: #93c5fd !important;
}

.dark .text-red-400 {
  color: #fca5a5 !important;
}

.dark .text-yellow-400 {
  color: #fde047 !important;
}

.dark .text-green-300 {
  color: #a7f3d0 !important;
}

.dark .text-blue-300 {
  color: #bfdbfe !important;
}

.dark .text-red-300 {
  color: #fecaca !important;
}

.dark .text-yellow-300 {
  color: #fef3c7 !important;
}

/* Enhanced Chart Container */
.dark canvas {
  background-color: transparent !important;
}

/* Global Dark Mode Background with CSS Variables */
.dark body {
  background-color: #0f172a !important;
}

.dark .bg-gray-900 {
  background-color: #0f172a !important;
}

/* Header Dark Mode Enhancement */
.dark header {
  background-color: var(--bg-primary) !important;
  border-bottom-color: var(--border-primary) !important;
}

/* Improved Shadow for Dark Mode - More Visible */
.dark .shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.8), 0 4px 6px -2px rgba(0, 0, 0, 0.6) !important;
}

.dark .shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4) !important;
}

.dark .shadow {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3) !important;
}

/* Improved theme-aware contrast classes */
.contrast-text {
  color: var(--text-primary);
}

.contrast-text-secondary {
  color: var(--text-secondary);
}

.contrast-bg {
  background-color: var(--bg-primary);
}

.contrast-border {
  border-color: var(--border-primary);
}

/* Focus styles for accessibility */
input:focus, select:focus, textarea:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
  outline: none;
}

.dark input:focus, .dark select:focus, .dark textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* Tooltips */
.tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
}

.dark .tooltip:hover::after {
  background-color: rgba(255, 255, 255, 0.9);
  color: #1f2937;
}

/* ================================
   RESPONSIVE BREAKPOINTS
   ================================ */

/* Mobile First Approach */
@media (max-width: 640px) {
  header h1 { 
    font-size: 0.875rem;
    max-width: 150px;
  }
  
  .kpi-card {
    min-height: 160px;
    padding: 1rem;
  }
  
  .chart-overlay {
    position: static !important;
    margin: 4px 0;
    display: inline-block;
    width: calc(50% - 2px);
  }
  
  .mobile-nav-btn {
    min-height: 65px;
    font-size: 0.7rem;
    padding: 0.625rem 0.375rem;
  }
  
  .mobile-nav-btn i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
  }
  
  #mobile-nav {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

@media (min-width: 640px) {
  header h1 { max-width: 300px; }
}

@media (min-width: 768px) {
  .chart-container canvas { height: 300px !important; }
}

@media (min-width: 1024px) {
  header h1 { max-width: none; }
}

/* Navigation Visibility */
@media (max-width: 1279px) {
  nav.xl\\:flex { display: none !important; }
}

@media (min-width: 1280px) {
  nav.xl\\:hidden { display: none !important; }
  #mobile-nav { display: none !important; }
}

@media (min-width: 1024px) and (max-width: 1279px) {
  nav.hidden.lg\\:flex.xl\\:hidden { display: flex !important; }
  #mobile-nav { display: none !important; }
}

@media (max-width: 1023px) {
  nav.hidden.lg\\:flex.xl\\:hidden { display: none !important; }
  nav.xl\\:flex { display: none !important; }
}

/* Tablet Navigation (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
  .nav-btn {
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
  }
  .nav-btn i {
    font-size: 1rem;
  }
}

/* Desktop Navigation (1280px+) */
@media (min-width: 1280px) {
  .nav-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
  }
  .nav-btn i {
    font-size: 1rem;
  }
}

@media (min-width: 1536px) {
  .nav-btn {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
}

/* ================================
   UTILITIES
   ================================ */

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 100;
}

.dark .loading-overlay {
  background-color: rgba(31, 41, 55, 0.8);
}

/* Scrollbars */
.scroll-container::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.scroll-container::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 6px;
  margin: 4px;
}

.scroll-container::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  border-radius: 6px;
  border: 2px solid #f1f5f9;
}

.scroll-container::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.dark .scroll-container::-webkit-scrollbar-track,
.dark .custom-scrollbar::-webkit-scrollbar-track {
  background: #1f2937;
  border: 1px solid #374151;
}

.dark .scroll-container::-webkit-scrollbar-thumb,
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
  border: 2px solid #1f2937;
}

.dark .scroll-container::-webkit-scrollbar-thumb:hover,
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

/* Enhanced Plot Container Styling */
#integrated-charts-grid > div {
  transition: all 0.3s ease;
}

#integrated-charts-grid > div:hover {
  transform: translateY(-2px);
}

/* Timeframe Button States */
.timeframe-btn-integrated.active {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: white !important;
  font-weight: 700;
  transform: scale(1.05);
}

.timeframe-btn-integrated {
  transition: all 0.2s ease;
}

.timeframe-btn-integrated:hover {
  transform: translateY(-1px);
}

/* Gateway Details Section Enhancements */
#gateway-details-section {
  animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================================
   ERROR POPUP STYLES
   ================================ */

/* Container für alle Error-Pop-ups */
.error-popup-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
}

/* Pop-up Overlay */
.error-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: all;
}

.error-popup-visible {
  opacity: 1;
}

.error-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* Pop-up Content Container */
.error-popup-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popupSlideIn 0.3s ease-out;
}

.dark .error-popup-content {
  background: #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

@keyframes popupSlideIn {
  from {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Pop-up Header */
.error-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.dark .error-popup-header {
  border-bottom-color: #334155;
}

.error-popup-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.error-popup-title {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  margin: 0;
}

.dark .error-popup-title {
  color: #f8fafc;
}

.error-popup-close {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.error-popup-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dark .error-popup-close:hover {
  background: #334155;
  color: #f8fafc;
}

/* Pop-up Body */
.error-popup-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.error-popup-message {
  color: #374151;
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 16px 0;
}

.dark .error-popup-message {
  color: #e2e8f0;
}

/* Details Section */
.error-popup-details {
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.dark .error-popup-details {
  background: #0f172a;
  border-color: #334155;
}

.error-popup-details summary {
  cursor: pointer;
  font-weight: 500;
  color: #475569;
  font-size: 14px;
  padding: 4px;
  user-select: none;
}

.dark .error-popup-details summary {
  color: #94a3b8;
}

.error-popup-details summary:hover {
  color: #0f172a;
}

.dark .error-popup-details summary:hover {
  color: #f8fafc;
}

.error-popup-details pre {
  margin: 12px 0 0 0;
  padding: 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.dark .error-popup-details pre {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}

/* Queue Info */
.error-popup-queue {
  margin-top: 16px;
  padding: 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  color: #92400e;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dark .error-popup-queue {
  background: #422006;
  color: #fde68a;
}

/* Pop-up Footer */
.error-popup-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dark .error-popup-footer {
  border-top-color: #334155;
  background: #0f172a;
}

/* Buttons */
.error-popup-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.error-popup-btn-primary {
  background: #3b82f6;
  color: white;
}

.error-popup-btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.error-popup-btn-secondary {
  background: #e2e8f0;
  color: #475569;
}

.dark .error-popup-btn-secondary {
  background: #334155;
  color: #e2e8f0;
}

.error-popup-btn-secondary:hover {
  background: #cbd5e1;
}

.dark .error-popup-btn-secondary:hover {
  background: #475569;
}

/* Severity-spezifische Styles */
.error-popup-error .error-popup-header {
  background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.dark .error-popup-error .error-popup-header {
  background: linear-gradient(135deg, #450a0a 0%, #1e293b 100%);
}

.error-popup-warning .error-popup-header {
  background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}

.dark .error-popup-warning .error-popup-header {
  background: linear-gradient(135deg, #422006 0%, #1e293b 100%);
}

.error-popup-info .error-popup-header {
  background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.dark .error-popup-info .error-popup-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
}

/* Responsive Anpassungen */
@media (max-width: 640px) {
  .error-popup-content {
    max-width: 95%;
    width: 95%;
    border-radius: 8px;
  }
  
  .error-popup-header,
  .error-popup-body,
  .error-popup-footer {
    padding: 16px;
  }
  
  .error-popup-title {
    font-size: 16px;
  }
  
  .error-popup-footer {
    flex-direction: column;
  }
  
  .error-popup-btn {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .no-print { display: none !important; }
  .bg-white { background: white !important; }
  .text-white { color: black !important; }
  .error-popup-container { display: none !important; }
}
