/**
 * Preloader / Loading Screen Styles
 * Tuân thủ quy tắc: Không dùng tên dự án làm tiền tố biến/class, 100% CSS thuần ngữ nghĩa
 */

/* 1. LỚP PHỦ TOÀN MÀN HÌNH (PRELOADER OVERLAY) */
.site-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.22s ease;
  opacity: 1;
  visibility: visible;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

[data-theme="dark"] .site-preloader {
  background-color: #0b0f19;
}

.site-preloader.is-loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 2. KHUNG CHỨA VÒNG XOAY VÀ LOGO (SPINNER STAGE) */
.preloader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.preloader-spinner-stage {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Quầng sáng tản mềm phía sau logo */
.preloader-ambient-glow {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(211, 47, 47, 0.12) 0%, rgba(211, 47, 47, 0.03) 55%, transparent 75%);
  pointer-events: none;
}

[data-theme="dark"] .preloader-ambient-glow {
  background: radial-gradient(circle, rgba(211, 47, 47, 0.24) 0%, rgba(211, 47, 47, 0.06) 55%, transparent 75%);
}

/* 3. VÒNG NÉT ĐỨT DUY NHẤT XOAY NHẸ QUANH LOGO */
.preloader-ring-dashed {
  position: absolute;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: 2.5px dashed #D32F2F;
  box-shadow: 0 0 22px rgba(211, 47, 47, 0.18);
  animation: ringRotateClockwise 7.5s linear infinite;
  pointer-events: none;
}

[data-theme="dark"] .preloader-ring-dashed {
  border-color: #EF4444;
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.25);
}

/* 5. LOGO MÀU Ở TRUNG TÂM */
.preloader-logo-core {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: logoPulse 2.8s ease-in-out infinite;
}

.preloader-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

[data-theme="dark"] .preloader-logo-img {
  filter: drop-shadow(0 2px 12px rgba(255, 255, 255, 0.2));
}

/* 6. THÔNG TIN THƯƠNG HIỆU & THANH TIẾN ĐỘ DƯỚI SPINNER */
.preloader-meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.preloader-brand-title {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 2.8px;
  color: #0f172a;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

[data-theme="dark"] .preloader-brand-title {
  color: #f8fafc;
}

.preloader-slogan {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #64748b;
  margin: 0;
  line-height: 1;
}

[data-theme="dark"] .preloader-slogan {
  color: #94a3b8;
}

/* Thanh chuyển động shimmer mỏng bên dưới */
.preloader-progress-track {
  width: 120px;
  height: 2.5px;
  border-radius: 99px;
  background: rgba(211, 47, 47, 0.12);
  overflow: hidden;
  position: relative;
  margin-top: 0.25rem;
}

[data-theme="dark"] .preloader-progress-track {
  background: rgba(255, 255, 255, 0.08);
}

.preloader-progress-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, #D32F2F, #EF4444, transparent);
  animation: progressShimmer 1.8s ease-in-out infinite;
}

/* 7. HIỆU ỨNG CHUYỂN ĐỘNG KEYFRAMES */
@keyframes ringRotateClockwise {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}


@keyframes logoPulse {
  0%, 100% {
    transform: scale(0.95);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes progressShimmer {
  0% {
    left: -50%;
  }
  100% {
    left: 110%;
  }
}
