/* ── ui.css — Loading indicator, CORS fallback, shared UI ── */

/* Loading indicator */
#loading-indicator {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #777;
  background: #fff;
  padding: 14px 24px;
  border: 1px solid #e0e0e0;
  border-radius: 99px;
  pointer-events: none;
  transition: opacity .4s ease;
}

#loading-indicator.hidden { display: none; }

/* CORS fallback overlay */
#cors-fallback {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(250,250,250,.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

#cors-fallback.active { display: flex; }

.kicker {
  font-size: 10px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #888;
  font-weight: 700;
  margin-bottom: 8px;
}

#cors-fallback p {
  max-width: 360px;
  font-size: 13px;
  line-height: 1.7;
  color: #555;
  margin: 10px 0 22px;
}

#cors-fallback button {
  border: 1px solid #ccc;
  background: #fff;
  color: #111;
  border-radius: 99px;
  padding: 11px 22px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s;
}

#cors-fallback button:hover { background: #111; color: #fff; }

/* ── Luxury Scroll to Top Floating Button with Frosted Glass & Progress Ring ── */
.scroll-to-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 30px rgba(7, 25, 27, 0.08), inset 0 1px 1px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  z-index: 99999;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s,
              background 0.25s,
              border-color 0.25s,
              box-shadow 0.25s;
}

.scroll-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto !important;
}

.scroll-to-top-btn * {
  pointer-events: none !important;
}

.scroll-to-top-btn:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(255, 255, 255, 0.45);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.95);
}

.scroll-to-top-btn:active {
  transform: translateY(-1px) scale(0.97);
}

/* Circular SVG Progress Ring */
.scroll-progress-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.scroll-circle-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 2.2;
}

.scroll-circle-bar {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 131.95;
  stroke-dashoffset: 131.95;
  transition: stroke-dashoffset 0.08s linear, stroke 0.25s;
}

/* Arrow Icon */
.scroll-to-top-icon {
  position: relative;
  z-index: 2;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s;
}

.scroll-to-top-btn:hover .scroll-to-top-icon {
  transform: translateY(-2px);
  color: var(--accent);
}

/* Dark Mode Overrides */
body.dark .scroll-to-top-btn {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

body.dark .scroll-to-top-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(0, 255, 165, 0.45);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75), 0 0 24px rgba(0, 255, 165, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

body.dark .scroll-circle-bg {
  stroke: rgba(255, 255, 255, 0.08);
}

body.dark .scroll-circle-bar {
  stroke: #00ffa5;
}

body.dark .scroll-to-top-icon {
  color: #ffffff;
}

body.dark .scroll-to-top-btn:hover .scroll-to-top-icon {
  color: #00ffa5;
}

/* Positioned strictly on the right side across all languages including Arabic */
body.lang-ar .scroll-to-top-btn,
html[dir="rtl"] .scroll-to-top-btn {
  right: 28px !important;
  left: auto !important;
}

@media (max-width: 768px) {
  .scroll-to-top-btn {
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
  }
  body.lang-ar .scroll-to-top-btn,
  html[dir="rtl"] .scroll-to-top-btn {
    right: 20px !important;
    left: auto !important;
  }
}
