/* Apple Liquid Display Design System - 2024 Premium Implementation */

/* CSS Custom Properties for Advanced Theming */
:root {
  --apple-glass-bg: rgba(255, 255, 255, 0.08);
  --apple-glass-bg-hover: rgba(255, 255, 255, 0.15);
  --apple-glass-border: rgba(255, 255, 255, 0.18);
  --apple-glass-shadow: rgba(0, 0, 0, 0.08);
  --apple-glass-shadow-hover: rgba(0, 0, 0, 0.12);
  --apple-glass-text: rgba(0, 0, 0, 0.85);
  --apple-glass-text-secondary: rgba(0, 0, 0, 0.6);
  --apple-blur: 24px;
  --apple-saturate: 200%;
  --apple-brightness: 1.2;
  --apple-contrast: 1.4;
  --apple-gradient-start: rgba(255, 255, 255, 0.1);
  --apple-gradient-end: rgba(255, 255, 255, 0.02);
  --apple-ambient-1: radial-gradient(800px 800px at 10% 10%, rgba(33,150,243,0.08), transparent 60%);
  --apple-ambient-2: radial-gradient(700px 700px at 90% 20%, rgba(0,188,212,0.08), transparent 60%);
  --apple-ambient-3: radial-gradient(900px 900px at 30% 80%, rgba(171,71,188,0.06), transparent 65%);
  --apple-noise: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" viewBox="0 0 140 140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)" opacity="0.035"/></svg>');
}

/* Liquid Ambient Background Scene - Subtle for white theme */
.apple-liquid-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  opacity: 0.3; /* Reduced opacity for white background */
}

.apple-liquid-ambient {
  position: absolute;
  inset: -20%;
  background:
    var(--apple-ambient-1),
    var(--apple-ambient-2),
    var(--apple-ambient-3);
  filter: blur(60px) saturate(100%); /* More blur, less saturation for subtlety */
  animation: ambient-shift 18s ease-in-out infinite alternate;
  opacity: 0.4; /* Further reduced for white background */
}

.apple-liquid-bokeh {
  position: absolute;
  width: 40vmax;
  height: 40vmax;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.25), rgba(255,255,255,0.04) 60%, transparent 70%);
  filter: blur(10px);
  mix-blend-mode: screen;
  opacity: 0.6;
}
.apple-liquid-bokeh.bokeh-1 { top: 10%; left: -10%; animation: bokeh-float-1 24s ease-in-out infinite; }
.apple-liquid-bokeh.bokeh-2 { bottom: -15%; right: -10%; animation: bokeh-float-2 28s ease-in-out infinite; }
.apple-liquid-bokeh.bokeh-3 { top: 25%; right: 15%; animation: bokeh-float-3 22s ease-in-out infinite; }

.apple-liquid-noise {
  position: absolute;
  inset: 0;
  background-image: var(--apple-noise);
  pointer-events: none;
}

@keyframes ambient-shift {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.04); }
}
@keyframes bokeh-float-1 { 0% { transform: translate3d(0,0,0); } 50% { transform: translate3d(8%, -6%, 0); } 100% { transform: translate3d(2%, -2%, 0);} }
@keyframes bokeh-float-2 { 0% { transform: translate3d(0,0,0); } 50% { transform: translate3d(-6%, 8%, 0); } 100% { transform: translate3d(-2%, 2%, 0);} }
@keyframes bokeh-float-3 { 0% { transform: translate3d(0,0,0); } 50% { transform: translate3d(4%, 6%, 0); } 100% { transform: translate3d(1%, 2%, 0);} }


/* Core Liquid Display Glass */
.apple-liquid-glass {
  background: linear-gradient(135deg, var(--apple-gradient-start), var(--apple-gradient-end));
  backdrop-filter: blur(var(--apple-blur)) saturate(var(--apple-saturate)) brightness(var(--apple-brightness)) contrast(var(--apple-contrast));
  -webkit-backdrop-filter: blur(var(--apple-blur)) saturate(var(--apple-saturate)) brightness(var(--apple-brightness)) contrast(var(--apple-contrast));
  border: 0.5px solid var(--apple-glass-border);
  border-radius: 20px;
  box-shadow:
    0 8px 32px var(--apple-glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Advanced Glass Variants */
.apple-liquid-glass-premium {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.08)
  );
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.apple-liquid-glass-interactive {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.02),
    rgba(120, 119, 198, 0.03)
  );
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.apple-liquid-glass-interactive:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.06),
    rgba(120, 119, 198, 0.05)
  );
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

/* Premium Shimmer Effect */
.apple-liquid-glass::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 45%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 70%
  );
  animation: apple-shimmer 4s ease-in-out infinite;
  pointer-events: none;
  opacity: 0.6;
}

@keyframes apple-shimmer {
  0%, 100% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    opacity: 0;
  }
  50% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
    opacity: 0.8;
  }
}

/* Premium Header Glass */
.apple-liquid-header {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.05),
    rgba(173, 216, 230, 0.03)
  );
  backdrop-filter: blur(28px) saturate(220%) brightness(1.25) contrast(1.5);
  -webkit-backdrop-filter: blur(28px) saturate(220%) brightness(1.25) contrast(1.5);
  border: 0.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  padding: 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s ease, background 0.35s ease;
}

.apple-liquid-header:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.09),
    rgba(173, 216, 230, 0.06)
  );
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transform: translateY(-3px);
}

.apple-liquid-header::after {
  content: '';
  position: absolute;
  top: -140%;
  left: -40%;
  width: 180%;
  height: 200%;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,0.18), transparent 60%);
  transform: rotate(18deg);
  opacity: 0.0;
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}

.apple-liquid-header:hover::after {
  opacity: 0.35;
  transform: rotate(18deg) translateY(18%);
}

/* Premium Card Glass */
.apple-liquid-card {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.03),
    rgba(240, 248, 255, 0.02)
  );
  backdrop-filter: blur(20px) saturate(190%) brightness(1.15) contrast(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(190%) brightness(1.15) contrast(1.3);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.apple-liquid-card:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0.08),
    rgba(173, 216, 230, 0.04)
  );
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  transform: translateY(-4px);
}

/* Subtle highlight sweep */
.apple-liquid-card::after {
  content: '';
  position: absolute;
  top: -150%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,0.18), transparent 60%);
  transform: rotate(20deg);
  opacity: 0.0;
  transition: opacity 0.8s ease, transform 0.8s ease;
  pointer-events: none;
}
.apple-liquid-card:hover::after {
  opacity: 0.4;
  transform: rotate(20deg) translateY(20%);
}

/* Premium Modal Glass */
.apple-liquid-modal {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.06),
    rgba(240, 248, 255, 0.03)
  );
  backdrop-filter: blur(32px) saturate(240%) brightness(1.3) contrast(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(240%) brightness(1.3) contrast(1.6);
  border: 0.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 28px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  padding: 40px;
  max-width: 500px;
  width: 90%;
}

/* Premium Input Glass */
.apple-liquid-input {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.02)
  );
  backdrop-filter: blur(16px) saturate(160%) brightness(1.05) contrast(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(160%) brightness(1.05) contrast(1.2);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  padding: 14px 18px;
  color: var(--apple-glass-text);
  transition: all 0.2s ease;
}

.apple-liquid-input:focus {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.15),
    rgba(255, 255, 255, 0.04)
  );
  border-color: rgba(0, 123, 255, 0.3);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    0 0 0 3px rgba(0, 123, 255, 0.1);
  outline: none;
}

.apple-liquid-input::placeholder {
  color: var(--apple-glass-text-secondary);
}

/* Premium Status Glass */
.apple-liquid-status {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.01)
  );
  backdrop-filter: blur(14px) saturate(150%) brightness(1.08) contrast(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(150%) brightness(1.08) contrast(1.2);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  padding: 20px;
  margin-bottom: 16px;
}

/* Premium Network Glass */
.apple-liquid-network {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.11),
    rgba(255, 255, 255, 0.03),
    rgba(135, 206, 235, 0.02)
  );
  backdrop-filter: blur(18px) saturate(175%) brightness(1.12) contrast(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(175%) brightness(1.12) contrast(1.25);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.apple-liquid-network:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.08),
    rgba(135, 206, 235, 0.04)
  );
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

/* Premium Spinner */
.apple-liquid-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 123, 255, 0.2);
  border-top: 3px solid rgba(0, 123, 255, 0.8);
  border-radius: 50%;
  animation: apple-spin 1s linear infinite;
}

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

/* Premium Text Styling */
.apple-liquid-text {
  color: var(--apple-glass-text);
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  letter-spacing: -0.01em;
}

.apple-liquid-text-secondary {
  color: var(--apple-glass-text-secondary);
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Premium Button Glass */
.apple-liquid-button {
  background: linear-gradient(135deg,
    rgba(0, 123, 255, 0.1),
    rgba(0, 123, 255, 0.05)
  );
  backdrop-filter: blur(12px) saturate(140%) brightness(1.1) contrast(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(140%) brightness(1.1) contrast(1.1);
  border: 0.5px solid rgba(0, 123, 255, 0.2);
  border-radius: 12px;
  box-shadow:
    0 4px 16px rgba(0, 123, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.02);
  padding: 12px 24px;
  color: rgba(0, 123, 255, 0.9);
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.apple-liquid-button:hover {
  background: linear-gradient(135deg,
    rgba(0, 123, 255, 0.15),
    rgba(0, 123, 255, 0.08)
  );
  box-shadow:
    0 6px 20px rgba(0, 123, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
  :root {
    --apple-blur: 20px;
    --apple-saturate: 180%;
    --apple-brightness: 1.15;
  }

  .apple-liquid-header {
    padding: 20px;
    border-radius: 18px;
    margin-bottom: 20px;
  }

  .apple-liquid-card {
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 16px;
  }

  .apple-liquid-modal {
    padding: 24px;
    border-radius: 20px;
    margin: 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .apple-liquid-button {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
  }

  .apple-liquid-input {
    padding: 16px 20px;
    font-size: 16px;
    border-radius: 12px;
  }

  .apple-liquid-network {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 12px;
  }

  .apple-liquid-status {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
  .apple-liquid-header {
    padding: 16px;
    border-radius: 16px;
  }

  .apple-liquid-card {
    padding: 16px;
    border-radius: 14px;
  }

  .apple-liquid-modal {
    padding: 20px;
    border-radius: 18px;
    margin: 12px;
  }
}

/* Touch-Friendly Enhancements */
@media (hover: none) and (pointer: coarse) {
  .apple-liquid-button {
    min-height: 48px;
    min-width: 48px;
    padding: 14px 24px;
  }

  .apple-liquid-input {
    min-height: 48px;
    padding: 14px 18px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .apple-liquid-network:hover {
    transform: none; /* Disable hover transforms on touch devices */
  }

  .apple-liquid-card:hover {
    transform: none;
  }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
  .apple-liquid-modal {
    max-height: 85vh;
    padding: 20px;
  }

  .apple-liquid-header {
    padding: 16px 20px;
  }
}

/* Light Mode Support - Enhanced visibility */
:root {
  --apple-glass-bg-light: rgba(255, 255, 255, 0.25);
  --apple-glass-bg-hover-light: rgba(255, 255, 255, 0.35);
  --apple-glass-border-light: rgba(0, 0, 0, 0.15);
  --apple-glass-shadow-light: rgba(0, 0, 0, 0.15);
  --apple-glass-text-light: rgba(0, 0, 0, 0.85);
  --apple-glass-text-secondary-light: rgba(0, 0, 0, 0.65);
  --apple-gradient-start-light: rgba(255, 255, 255, 0.3);
  --apple-gradient-end-light: rgba(255, 255, 255, 0.1);
}

/* Light mode card styling - Enhanced visibility */
.apple-liquid-card {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px) saturate(180%) brightness(1.1) !important;
  -webkit-backdrop-filter: blur(16px) saturate(180%) brightness(1.1) !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  border-radius: 16px !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  padding: 24px !important;
  margin-bottom: 20px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  position: relative !important;
  overflow: hidden !important;
}

.apple-liquid-card:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 2px solid rgba(59, 130, 246, 0.8) !important;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
  transform: none !important;
}

/* Light mode header styling - Enhanced visibility */
.apple-liquid-header {
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(20px) saturate(180%) brightness(1.1) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.1) !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 20px !important;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  padding: 32px !important;
  margin-bottom: 32px !important;
  position: relative !important;
  overflow: hidden !important;
  transition: all 0.2s ease !important;
}

.apple-liquid-header:hover {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(0, 0, 0, 0.18) !important;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.12),
    0 6px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
  transform: translateY(-2px) !important;
}

/* Light mode text styling - Clean and readable */
.apple-liquid-text {
  color: rgba(0, 0, 0, 0.9) !important;
  font-weight: 600 !important;
  text-shadow: none !important;
  letter-spacing: -0.01em !important;
}

.apple-liquid-text-secondary {
  color: rgba(0, 0, 0, 0.75) !important;
  font-weight: 500 !important;
  text-shadow: none !important;
}

/* Light mode tab and border fixes */
.border-white\/20 {
  border-color: rgba(0, 0, 0, 0.15) !important;
}

.border-white\/10 {
  border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Light mode table styling */
.table-container {
  background: rgba(255, 255, 255, 0.7) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
}

.table-container table {
  background: transparent !important;
}

.table-container tbody {
  background: transparent !important;
}

.table-container tr {
  background: transparent !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

.table-container td {
  background: transparent !important;
  color: rgba(0, 0, 0, 0.85) !important;
}

/* Dark Mode Support - Updated for manual toggle */
.dark {
  --apple-glass-bg: rgba(0, 0, 0, 0.24);
  --apple-glass-bg-hover: rgba(0, 0, 0, 0.34);
  --apple-glass-border: rgba(255, 255, 255, 0.1);
  --apple-glass-shadow: rgba(0, 0, 0, 0.42);
  --apple-glass-text: rgba(255, 255, 255, 0.92);
  --apple-glass-text-secondary: rgba(255, 255, 255, 0.65);
  --apple-gradient-start: rgba(255, 255, 255, 0.05);
  --apple-gradient-end: rgba(0, 0, 0, 0.12);
}
.dark .apple-liquid-bokeh { mix-blend-mode: screen; opacity: 0.55; }

/* High Contrast Support */
@media (prefers-contrast: high) {
  :root {
    --apple-glass-bg: rgba(255, 255, 255, 0.2);
    --apple-glass-border: rgba(0, 0, 0, 0.3);
    --apple-glass-text: rgba(0, 0, 0, 1);
    --apple-glass-text-secondary: rgba(0, 0, 0, 0.8);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .apple-liquid-glass,
  .apple-liquid-card,
  .apple-liquid-network,
  .apple-liquid-button {
    transition: none;
  }

  .apple-liquid-glass::before {
    animation: none;
  }
}

.liquid-card:hover {
    background: rgba(248, 250, 252, 0.98) !important;
    border: 1px solid rgba(241, 245, 249, 0.4) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

.glass-bg {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.1) 0%, rgba(241, 245, 249, 0.05) 100%);
    backdrop-filter: blur(10px);
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    from { box-shadow: 0 0 20px rgba(52, 199, 89, 0.3); }
    to { box-shadow: 0 0 30px rgba(52, 199, 89, 0.6); }
}

/* Removed automatic floating animation - cards should only move on hover */

.temp-indicator {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4, #45B7D1, #96CEB4, #FFEAA7) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.humidity-indicator {
    background: linear-gradient(45deg, #667eea, #764ba2) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.setpoint-indicator {
    background: linear-gradient(45deg, #f093fb, #f5576c) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Dark mode card overrides - Using Apple Liquid design system */
.dark .apple-liquid-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03), rgba(240, 248, 255, 0.02)) !important;
    backdrop-filter: blur(20px) saturate(190%) brightness(1.15) contrast(1.3) !important;
    border: 0.5px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.06) !important;
}

.dark .apple-liquid-card:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08), rgba(173, 216, 230, 0.04)) !important;
    border: 0.5px solid rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.08) !important;
}

.dark .apple-liquid-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05), rgba(173, 216, 230, 0.03)) !important;
    border: 0.5px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.08) !important;
}

.dark .apple-liquid-header:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.09), rgba(173, 216, 230, 0.06)) !important;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
}

.dark .apple-liquid-text {
    color: rgba(255, 255, 255, 0.92) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.dark .apple-liquid-text-secondary {
    color: rgba(255, 255, 255, 0.65) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

.dark .glass-bg {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(10px);
}

.dark .temp-indicator {
    background: linear-gradient(45deg, #60A5FA, #34D399, #F59E0B, #EF4444) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    filter: brightness(1.3) !important;
}

.dark .humidity-indicator {
    background: linear-gradient(45deg, #8B5CF6, #06B6D4) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    filter: brightness(1.3) !important;
}

.dark .setpoint-indicator {
    background: linear-gradient(45deg, #F472B6, #FB7185) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    filter: brightness(1.3) !important;
}

/* Loading animation */
.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* Table styles */
.table-container {
    max-height: 600px;
    overflow-y: auto;
}

/* House data tab - no vertical scrolling, expand naturally */
#house-tab-content .table-container {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: auto !important;
}

/* Ensure database table shows all rows */
#database-table-content .table-container {
    max-height: 800px;
    overflow-y: auto;
    min-height: 400px;
}

#database-table-content .table-container table {
    width: 100%;
    table-layout: auto;
}

#database-table-content .table-container tbody tr {
    display: table-row !important;
    height: auto !important;
}

#database-table-content .table-container tbody td {
    display: table-cell !important;
    padding: 12px 24px !important;
    white-space: nowrap;
}

/* Force table to show all rows */
#database-table-body {
    display: table-row-group !important;
}

#database-table-body tr {
    display: table-row !important;
    height: auto !important;
}

.priority-1 { background-color: #dbeafe; }
.priority-3 { background-color: #fef3c7; }
.priority-4 { background-color: #fed7aa; }
.priority-5 { background-color: #fecaca; }
.priority-6 { background-color: #fca5a5; }

.dark .priority-1 { background-color: rgba(59, 130, 246, 0.15); border-left: 3px solid #3B82F6; }
.dark .priority-3 { background-color: rgba(245, 158, 11, 0.15); border-left: 3px solid #F59E0B; }
.dark .priority-4 { background-color: rgba(251, 146, 60, 0.15); border-left: 3px solid #FB923C; }
.dark .priority-5 { background-color: rgba(239, 68, 68, 0.15); border-left: 3px solid #EF4444; }
.dark .priority-6 { background-color: rgba(220, 38, 38, 0.15); border-left: 3px solid #DC2626; }

/* Custom very dark background - REMOVED AGGRESSIVE OVERRIDE */

/* Force bright white text in dark mode - REMOVED AGGRESSIVE OVERRIDE */

/* Dark mode dropdown styling - Using Apple Liquid classes */
.dark select {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(16px) saturate(160%) brightness(1.05) contrast(1.2);
    border: 0.5px solid rgba(255, 255, 255, 0.2);
    color: var(--apple-glass-text);
}

.dark select option {
    background-color: rgba(31, 41, 55, 0.95);
    color: var(--apple-glass-text);
}

/* Dark mode table styling - Using Apple Liquid classes */
.dark .table-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
    backdrop-filter: blur(14px) saturate(150%) brightness(1.08) contrast(1.2);
    border: 0.5px solid rgba(255, 255, 255, 0.15);
}

.dark .table-container table {
    background: transparent;
}

.dark .table-container tbody {
    background: transparent;
}

.dark .table-container tr {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .table-container td {
    background: transparent;
    color: var(--apple-glass-text);
}

/* Keep gradient indicators working - Fixed */
.dark .temp-indicator,
.dark .humidity-indicator,
.dark .setpoint-indicator {
    background: linear-gradient(45deg, #60A5FA, #34D399) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Error text styling - Consistent across light and dark modes */
.apple-liquid-text-error {
    color: #ef4444 !important; /* Red-500 */
    font-weight: 600 !important;
}

.dark .apple-liquid-text-error {
    color: #f87171 !important; /* Red-400 for better visibility in dark mode */
    font-weight: 600 !important;
}

/* Sensor item alignment - ensure proper left/right alignment */
.sensor-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    margin-bottom: 2px !important;
}

.sensor-label {
    text-align: left !important;
    flex: 1 !important;
    margin-right: 8px !important;
}

.sensor-value {
    text-align: right !important;
    flex-shrink: 0 !important;
    font-weight: 600 !important;
}

/* Light mode sensor item styling */
.sensor-item {
    background: rgba(0, 0, 0, 0.03) !important;
}

.dark .sensor-item {
    background: rgba(255, 255, 255, 0.05) !important;
}
