/* SiteHub loading + video modal + anchor flash */

html[data-sitehub-pending] .app-shell,
html[data-sitehub-pending] .ember-view {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html[data-sitehub-ready] .app-shell,
html[data-sitehub-ready] .ember-view {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.sitehub-loading {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #fff;
}

html[data-sitehub-ready] .sitehub-loading {
  display: none;
}

.sitehub-loading__spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e5e7eb;
  border-top-color: #016fcd;
  border-radius: 50%;
  animation: sitehubSpin 0.75s linear infinite;
}

.sitehub-loading__text {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: #64748b;
}

@keyframes sitehubSpin {
  to {
    transform: rotate(360deg);
  }
}

.sitehub-anchor-flash {
  outline: 3px solid rgba(245, 158, 11, 0.95) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  animation: sitehubAnchorFlash 1.2s ease-in-out infinite;
  z-index: 5;
  position: relative;
}

/* Tránh bị sticky header che khi scroll tới key SiteHub */
[data-sitehub-anchor],
[data-sitehub="android_install_url"],
[data-sitehub="ios_install_url"],
[data-sitehub="android_guide_video_url"],
[data-sitehub="ios_guide_video_url"],
[data-sitehub="android_steps_images"],
[data-sitehub="ios_steps_images"],
[data-sitehub="urlPlatform"],
[data-sitehub="login"],
[data-sitehub="register"] {
  scroll-margin-top: 88px;
}

@keyframes sitehubAnchorFlash {
  0%,
  100% {
    outline-color: rgba(245, 158, 11, 0.45);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  }
  50% {
    outline-color: rgba(245, 158, 11, 1);
    outline-offset: 6px;
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.4);
  }
}

/* Video guide modal */
.modal__bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(28, 28, 28, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.modal__bg.active {
  opacity: 1;
  visibility: visible;
}

.modal__align {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;
  position: relative;
}

.modal__content {
  position: relative;
  z-index: 99;
  width: min(96vw, 1100px);
  background: transparent;
}

.modal__close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 32px;
  height: 32px;
  background-color: #fff;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10000;
  border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  padding: 0;
}

.modal__close:hover {
  transform: scale(1.08);
}

.modal__close svg {
  width: 18px;
  height: 18px;
  color: #000;
  stroke: #000;
}

.modal__video-align {
  position: relative;
  width: 100%;
}

.modal__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sitehubVideoSpin 1s linear infinite;
  z-index: 10;
  display: none;
}

.modal__spinner.active {
  display: block;
}

@keyframes sitehubVideoSpin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#videoWrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 90px);
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

#videoWrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

@media screen and (max-width: 768px) {
  .modal__align {
    padding: 16px;
  }

  #videoWrapper {
    max-height: calc(100vh - 60px);
  }
}
