/* ============================================================
   TOOLBAYAN ORBIT LOADER — MINIMALIST FLOATING EDITION
   File: public/assets/loading/toolbayan-loader.css
   - Cardless, panel-free floating composition
   - Subtle translucent page overlay with backdrop blur
   - Exactly 3 evenly spaced orbiting dots (Blue, Yellow, Red)
   - Original ToolBayan logo preserved at center
   - Light Mode, Dark Mode, Night Mode & Reduced-Motion ready
   ============================================================ */

:root {
  /* Official ToolBayan Tri-Color Orbit Palette */
  --tb-dot-blue: var(--gov-blue, #0038A8);
  --tb-dot-yellow: var(--gov-yellow, #FCD116);
  --tb-dot-red: var(--gov-red, #CE1126);

  /* Light Mode Translucent Blur Overlay & Floating Text (No Excessive Gray Dimming) */
  --tb-overlay-bg: rgba(255, 255, 255, 0.38);
  --tb-overlay-bg-fallback: rgba(255, 255, 255, 0.78);
  --tb-floating-title-color: #0F2040;
  --tb-floating-subtitle-color: #334155;
  --tb-floating-title-shadow: 0 2px 12px rgba(255, 255, 255, 0.96), 0 0 3px rgba(255, 255, 255, 1);
  --tb-floating-subtitle-shadow: 0 1px 10px rgba(255, 255, 255, 0.94), 0 0 2px rgba(255, 255, 255, 0.98);
}

/* ── Dark Mode & Night Mode Tokens ── */
[data-bs-theme="dark"],
.dark-theme,
#reviewer-page-shell.reviewer-theme-dark,
#reviewer-page-shell.reviewer-theme-night {
  --tb-dot-blue: #3B82F6;
  --tb-dot-yellow: #FCD116;
  --tb-dot-red: #EF4444;

  --tb-overlay-bg: rgba(10, 22, 40, 0.44);
  --tb-overlay-bg-fallback: rgba(10, 22, 40, 0.78);
  --tb-floating-title-color: #F8FAFC;
  --tb-floating-subtitle-color: #CBD5E1;
  --tb-floating-title-shadow: 0 2px 14px rgba(4, 10, 22, 0.95), 0 0 4px rgba(0, 0, 0, 0.92);
  --tb-floating-subtitle-shadow: 0 1px 10px rgba(4, 10, 22, 0.9), 0 0 3px rgba(0, 0, 0, 0.88);
}

/* ── Scroll Lock for Manual Async Modal Operations ── */
body.tb-loading-locked {
  overflow: hidden !important;
  touch-action: none;
}

/* ── Full-Viewport Translucent Overlay with Subtle Backdrop Blur ── */
.tb-loading-overlay,
[data-bs-theme="dark"] .tb-loading-overlay,
.dark-theme .tb-loading-overlay,
#reviewer-page-shell.reviewer-theme-dark .tb-loading-overlay,
#reviewer-page-shell.reviewer-theme-night .tb-loading-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--tb-overlay-bg-fallback) !important;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  box-sizing: border-box;
}

@supports ((backdrop-filter: blur(5px)) or (-webkit-backdrop-filter: blur(5px))) {
  .tb-loading-overlay,
  [data-bs-theme="dark"] .tb-loading-overlay,
  .dark-theme .tb-loading-overlay,
  #reviewer-page-shell.reviewer-theme-dark .tb-loading-overlay,
  #reviewer-page-shell.reviewer-theme-night .tb-loading-overlay {
    background: var(--tb-overlay-bg) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
}

.tb-loading-overlay.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Cardless Floating Container (Neutralizes Any Legacy Card Styles) ── */
.tb-loading-floating,
.tb-loading-card,
[data-bs-theme="dark"] .tb-loading-card,
.dark-theme .tb-loading-card,
#reviewer-page-shell.reviewer-theme-dark .tb-loading-card,
#reviewer-page-shell.reviewer-theme-night .tb-loading-card {
  background: transparent !important;
  border: none !important;
  border-top: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: auto !important;
  max-width: min(90vw, 420px) !important;
  text-align: center;
  position: relative;
  overflow: visible !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translateY(6px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.tb-loading-card::before,
.tb-loading-card::after,
.tb-loading-floating::before,
.tb-loading-floating::after {
  display: none !important;
  content: none !important;
}

.tb-loading-overlay.is-active .tb-loading-floating,
.tb-loading-overlay.is-active .tb-loading-card {
  transform: translateY(0) scale(1);
}

/* ── ToolBayan Orbit Stage (132px overall — within 120–140px target) ── */
.tb-loading-visual-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.15rem;
}

.tb-orbit-stage {
  position: relative;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── SVG Tri-Dot Orbit (Exactly 3 Dots: Blue, Yellow, Red) ── */
.tb-orbit-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tb-orbit-triad {
  transform-box: view-box;
  transform-origin: 66px 66px;
  animation: tb-orbit-triad-spin 2.2s linear infinite;
  will-change: transform;
}

.tb-orbit-dot {
  transform-box: fill-box;
  transform-origin: center;
}

.tb-orbit-dot-blue {
  fill: var(--tb-dot-blue);
  filter: drop-shadow(0 0 5px rgba(0, 56, 168, 0.5));
}

[data-bs-theme="dark"] .tb-orbit-dot-blue,
.dark-theme .tb-orbit-dot-blue,
#reviewer-page-shell.reviewer-theme-dark .tb-orbit-dot-blue,
#reviewer-page-shell.reviewer-theme-night .tb-orbit-dot-blue {
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.7));
}

.tb-orbit-dot-yellow {
  fill: var(--tb-dot-yellow);
  filter: drop-shadow(0 0 5px rgba(252, 209, 22, 0.6));
}

.tb-orbit-dot-red {
  fill: var(--tb-dot-red);
  filter: drop-shadow(0 0 5px rgba(206, 17, 38, 0.5));
}

/* ── Center ToolBayan Logo (82px — within 75–90px target, Floating Directly, No Panel/Border) ── */
.tb-orbit-logo-wrap,
.tb-loading-spinner-core {
  position: relative;
  z-index: 2;
  width: 82px;
  height: 82px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: none !important;
}

.tb-loading-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(10, 22, 40, 0.16));
  animation: tb-orbit-logo-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}

[data-bs-theme="dark"] .tb-loading-logo,
.dark-theme .tb-loading-logo,
#reviewer-page-shell.reviewer-theme-dark .tb-loading-logo,
#reviewer-page-shell.reviewer-theme-night .tb-loading-logo {
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.55));
}

/* ── Floating Destination Title (22–25px) & Supporting Message (14–16px) ── */
.tb-loading-content {
  margin: 0;
  padding: 0 0.5rem;
}

.tb-loading-title,
[data-bs-theme="dark"] .tb-loading-title,
.dark-theme .tb-loading-title,
#reviewer-page-shell.reviewer-theme-dark .tb-loading-title,
#reviewer-page-shell.reviewer-theme-night .tb-loading-title {
  font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 23.5px;
  font-weight: 700;
  color: var(--tb-floating-title-color) !important;
  text-shadow: var(--tb-floating-title-shadow);
  margin: 0 0 0.38rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.tb-loading-subtitle,
[data-bs-theme="dark"] .tb-loading-subtitle,
.dark-theme .tb-loading-subtitle,
#reviewer-page-shell.reviewer-theme-dark .tb-loading-subtitle,
#reviewer-page-shell.reviewer-theme-night .tb-loading-subtitle {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--tb-floating-subtitle-color) !important;
  text-shadow: var(--tb-floating-subtitle-shadow);
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

/* Hide non-essential legacy elements so only the 4 required elements appear */
.tb-loading-badge-wrap,
.tb-loading-progress-wrap,
.tb-loading-actions,
.tb-loading-icon {
  display: none !important;
}

/* ── Keyframes ── */
@keyframes tb-orbit-triad-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes tb-orbit-logo-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

/* ── Responsive Adjustments ── */
@media (max-width: 575.98px) {
  .tb-orbit-stage {
    width: 124px;
    height: 124px;
  }

  .tb-orbit-logo-wrap,
  .tb-loading-spinner-core {
    width: 76px;
    height: 76px;
  }

  .tb-loading-logo {
    width: 76px;
    height: 76px;
  }

  .tb-loading-title,
  [data-bs-theme="dark"] .tb-loading-title,
  .dark-theme .tb-loading-title,
  #reviewer-page-shell.reviewer-theme-dark .tb-loading-title,
  #reviewer-page-shell.reviewer-theme-night .tb-loading-title {
    font-size: 22px;
  }

  .tb-loading-subtitle,
  [data-bs-theme="dark"] .tb-loading-subtitle,
  .dark-theme .tb-loading-subtitle,
  #reviewer-page-shell.reviewer-theme-dark .tb-loading-subtitle,
  #reviewer-page-shell.reviewer-theme-night .tb-loading-subtitle {
    font-size: 14px;
  }
}

/* ── Accessibility: Respect prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .tb-loading-overlay,
  .tb-loading-floating,
  .tb-loading-card,
  .tb-orbit-triad,
  .tb-loading-logo {
    animation: none !important;
    transition: none !important;
  }

  .tb-loading-overlay.is-active .tb-loading-floating,
  .tb-loading-overlay.is-active .tb-loading-card {
    transform: none !important;
  }
}

/* ── Print Media Safety ── */
@media print {
  .tb-loading-overlay {
    display: none !important;
    visibility: hidden !important;
  }
}
