.loading-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #e0f2fe 0%, #dbeafe 35%, #cbd5f5 60%, #a5b4fc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}

.loading-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  background: #fff;
  border-radius: 1.5rem;
  padding: 2rem 2.5rem;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  text-align: center;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: center;
}

.loading-icon {
  font-size: 2.5rem;
  border-radius: 1rem;
  padding: 0.75rem;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: inset 0 0 0 2px rgba(15, 23, 42, 0.05);
  animation: float 1.8s ease-in-out infinite;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  animation-fill-mode: forwards;
}

.loading-icon.delay-1 {
  animation-delay: 0.15s;
}

.loading-icon.delay-2 {
  animation-delay: 0.3s;
}

.loading-icon.delay-3 {
  animation-delay: 0.45s;
}

.loading-icon.delay-4 {
  animation-delay: 0.6s;
}

.loading-icon.delay-5 {
  animation-delay: 0.75s;
}

.loading-icon.delay-6 {
  animation-delay: 0.9s;
}

@keyframes float {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }

  40% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  70% {
    opacity: 1;
    transform: translateY(-4px) scale(1.02);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.loading-text {
  font-size: 1rem;
  color: #475569;
  letter-spacing: 0.04em;
}

@media (max-width: 360px) {
  .loading-card {
    padding: 1.25rem 1.5rem;
    border-radius: 1.25rem;
  }

  .loading-grid {
    gap: 0.5rem;
  }

  .quick-action-card {
    border-radius: 1.5rem;
  }

  #night-routine-device-list {
    gap: 0.75rem;
  }

  #night-routine-device-list .rounded-2xl {
    border-radius: 1rem;
    padding: 0.75rem;
  }
}