/* Stayi Global Loading System */

.stayi-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.stayi-loader-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.stayi-loader-panel {
  width: min(100%, 22rem);
  text-align: center;
}

.stayi-building {
  width: 7.5rem;
  height: 8.5rem;
  margin: 0 auto 1.75rem;
  position: relative;
}

.stayi-building-roof {
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 3.75rem solid transparent;
  border-right: 3.75rem solid transparent;
  border-bottom: 1.75rem solid #111827;
}

.stayi-building-body {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 6.5rem;
  height: 6.25rem;
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  border-radius: 0.35rem 0.35rem 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.75rem 0.65rem 0.55rem;
  box-shadow: 0 20px 45px -20px rgba(17, 24, 39, 0.45);
}

.stayi-window {
  aspect-ratio: 1;
  border-radius: 0.2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: stayi-window-glow 2.4s ease-in-out infinite;
}

.stayi-window:nth-child(1) { animation-delay: 0s; }
.stayi-window:nth-child(2) { animation-delay: 0.3s; }
.stayi-window:nth-child(3) { animation-delay: 0.6s; }
.stayi-window:nth-child(4) { animation-delay: 0.9s; }
.stayi-window:nth-child(5) { animation-delay: 1.2s; }
.stayi-window:nth-child(6) { animation-delay: 1.5s; }

@keyframes stayi-window-glow {
  0%, 100% {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }
  40%, 60% {
    background: rgba(253, 224, 71, 0.95);
    box-shadow: 0 0 12px rgba(253, 224, 71, 0.55);
  }
}

.stayi-loader-brand {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #111827;
  margin-bottom: 0.5rem;
}

.stayi-loader-message {
  font-size: 0.95rem;
  color: #6b7280;
  min-height: 1.5rem;
  transition: opacity 0.3s ease;
}

.stayi-loader-message.is-changing {
  opacity: 0.35;
}

.stayi-loader-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 9998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stayi-loader-progress.is-visible {
  opacity: 1;
}

.stayi-loader-progress-bar {
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, #111827, #4b5563, #111827);
  background-size: 200% 100%;
  animation: stayi-progress-slide 1.1s ease-in-out infinite;
  border-radius: 0 2px 2px 0;
}

@keyframes stayi-progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

/* Skeleton loaders */
.stayi-skeleton {
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 0.5rem;
}

.stayi-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: stayi-shimmer 1.4s ease-in-out infinite;
}

@keyframes stayi-shimmer {
  100% { transform: translateX(100%); }
}

.stayi-skeleton-card {
  border-radius: 0.75rem;
  border: 1px solid #f3f4f6;
  background: #fff;
  padding: 1.5rem;
}

.stayi-skeleton-line {
  height: 0.875rem;
  margin-bottom: 0.75rem;
}

.stayi-skeleton-line-lg {
  height: 2rem;
  width: 55%;
  margin-bottom: 1rem;
}

.stayi-skeleton-line-sm {
  height: 0.625rem;
  width: 40%;
}

.stayi-page-content {
  opacity: 0;
  transition: opacity 0.35s ease;
}

html.stayi-page-ready .stayi-page-content {
  opacity: 1;
}

html.stayi-nav-loading .stayi-loader-overlay {
  opacity: 1;
  visibility: visible;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .stayi-window,
  .stayi-loader-progress-bar,
  .stayi-skeleton::after {
    animation: none !important;
  }

  .stayi-window:nth-child(odd) {
    background: rgba(253, 224, 71, 0.85);
  }

  .stayi-loader-overlay,
  .stayi-page-content {
    transition: none;
  }
}
