/**
 * ox-ux-enhance — تفاعلات UX خفيفة ومعيارية
 * Classes: ox-ux-reveal, ox-ux-shake, ox-ux-toast-*, data-ox-ripple, data-ox-loading, …
 * يفعّل مع body.ox-ux-active (يضافه السكربت بعد init)
 */

:root {
  --ox-ux-ease-io: ease-in-out;
  --ox-ux-dur-fast: 180ms;
  --ox-ux-dur: 280ms;
  --ox-ux-dur-slow: 380ms;
  --ox-ux-mx: 0;
  --ox-ux-my: 0;
}

/* ─── خلفية تفاعلية (طبقات خلف المحتوى) ─── */
.ox-ux-bg-root {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
}

.ox-ux-bg-gradient {
  position: absolute;
  inset: -25%;
  background: linear-gradient(
    125deg,
    rgba(224, 60, 60, 0.07),
    rgba(26, 35, 126, 0.08),
    rgba(103, 58, 183, 0.05),
    rgba(224, 60, 60, 0.06)
  );
  background-size: 220% 220%;
  animation: ox-ux-bg-shift 24s var(--ox-ux-ease-io) infinite alternate;
  transform: translate3d(
    calc(var(--ox-ux-mx) * 14px),
    calc(var(--ox-ux-my) * 12px),
    0
  );
  will-change: transform, background-position;
}

@keyframes ox-ux-bg-shift {
  0% {
    background-position: 0% 40%;
  }
  100% {
    background-position: 100% 60%;
  }
}

.ox-ux-bg-bubbles {
  position: absolute;
  inset: 0;
}

.ox-ux-bg-bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(224, 60, 60, 0.09) 0%,
    rgba(26, 35, 126, 0.05) 45%,
    transparent 70%
  );
  animation: ox-ux-float var(--ox-float-dur, 16s) var(--ox-ux-ease-io) infinite;
  animation-delay: var(--ox-float-delay, 0s);
  opacity: 0.85;
}

@keyframes ox-ux-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  33% {
    transform: translate3d(2vw, -4vh, 0) scale(1.06);
  }
  66% {
    transform: translate3d(-1.5vw, 2vh, 0) scale(0.96);
  }
}

.ox-ux-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

/* ─── Ripple (طبقة فوق الزر) ─── */
.ox-ux-ripple-host {
  position: relative;
  overflow: hidden;
}

.ox-ux-ripple-el {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
  background: rgba(255, 255, 255, 0.42);
  mix-blend-mode: soft-light;
  transform: scale(0);
  opacity: 0.55;
  animation: ox-ux-ripple-expand 0.52s ease-out forwards;
}

.ox-btn-primary .ox-ux-ripple-el,
.auth-clean-submit .ox-ux-ripple-el {
  background: rgba(255, 255, 255, 0.35);
}

.ox-btn-outline .ox-ux-ripple-el {
  background: rgba(224, 60, 60, 0.18);
  mix-blend-mode: multiply;
}

@keyframes ox-ux-ripple-expand {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* ─── Shake (خطأ) ─── */
@keyframes ox-ux-shake-kf {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  15% {
    transform: translate3d(-6px, 0, 0);
  }
  30% {
    transform: translate3d(6px, 0, 0);
  }
  45% {
    transform: translate3d(-4px, 0, 0);
  }
  60% {
    transform: translate3d(4px, 0, 0);
  }
  75% {
    transform: translate3d(-2px, 0, 0);
  }
}

.ox-ux-shake {
  animation: ox-ux-shake-kf var(--ox-ux-dur-slow) var(--ox-ux-ease-io);
}

/* ─── Scroll reveal ─── */
.ox-ux-reveal {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition:
    opacity var(--ox-ux-dur-slow) var(--ox-ux-ease-io),
    transform var(--ox-ux-dur-slow) var(--ox-ux-ease-io);
}

.ox-ux-reveal.ox-ux-reveal--visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.ox-ux-reveal[data-ox-reveal-axis="left"] {
  transform: translate3d(-20px, 0, 0);
}
.ox-ux-reveal[data-ox-reveal-axis="left"].ox-ux-reveal--visible {
  transform: translate3d(0, 0, 0);
}

.ox-ux-reveal[data-ox-reveal-axis="right"] {
  transform: translate3d(20px, 0, 0);
}
.ox-ux-reveal[data-ox-reveal-axis="right"].ox-ux-reveal--visible {
  transform: translate3d(0, 0, 0);
}

/* ─── Toasts ─── */
.ox-ux-toast-host {
  position: fixed;
  z-index: 100000;
  bottom: max(16px, env(safe-area-inset-bottom));
  right: 16px;
  left: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

[dir="rtl"] .ox-ux-toast-host {
  right: auto;
  left: 16px;
}

.ox-ux-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
  animation: ox-ux-toast-in var(--ox-ux-dur) var(--ox-ux-ease-io);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

@keyframes ox-ux-toast-in {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

.ox-ux-toast--success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.98));
  color: #fff;
}

.ox-ux-toast--error {
  background: linear-gradient(135deg, rgba(224, 60, 60, 0.95), rgba(185, 28, 28, 0.98));
  color: #fff;
}

.ox-ux-toast--info {
  background: rgba(255, 255, 255, 0.94);
  color: #1e293b;
  border-color: rgba(26, 35, 126, 0.12);
}

/* ─── Loading: زر ─── */
.ox-ux-btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.88;
}

.ox-ux-btn-loading::after {
  content: "";
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  top: 50%;
  left: 50%;
  margin-top: -0.55rem;
  margin-left: -0.55rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ox-ux-spin 0.7s linear infinite;
}

.ox-ux-btn-loading > * {
  opacity: 0.15;
}

@keyframes ox-ux-spin {
  to {
    transform: rotate(360deg);
  }
}

.ox-btn-outline.ox-ux-btn-loading::after {
  border-color: rgba(224, 60, 60, 0.25);
  border-top-color: var(--primary, #e03c3c);
}

/* ─── Loading: نموذج / شاشة ─── */
.ox-ux-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ox-ux-dur) var(--ox-ux-ease-io),
    visibility var(--ox-ux-dur) var(--ox-ux-ease-io);
}

.ox-ux-loading-overlay.ox-ux-loading-overlay--open {
  opacity: 1;
  visibility: visible;
}

.ox-ux-loading-card {
  background: #fff;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  color: #1e293b;
}

.ox-ux-loading-dots {
  display: flex;
  gap: 6px;
}

.ox-ux-loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e03c3c;
  animation: ox-ux-dot 0.9s var(--ox-ux-ease-io) infinite alternate;
}

.ox-ux-loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
  background: #1a237e;
}
.ox-ux-loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
  background: #e03c3c;
}

@keyframes ox-ux-dot {
  to {
    transform: translate3d(0, -6px, 0);
    opacity: 0.5;
  }
}

/**
 * طبقة «أجسام حيّة» داخل كل قسم — تُحقن قبل .ox-container عبر ox-ux-enhance.js
 * سببها: الخلفية العامة (canvas/فقاعات) كانت أسفل طبقات القسم المعتمة ولا تُرى.
 */
.ox-ux-section-live {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.ox-ux-hero-live {
  z-index: 1;
}

/* الهيرو له وهج خاص — لا نكرر شريط التدرج هنا */
.ox-ux-hero-live::before {
  display: none;
}

.ox-ux-section-live::before {
  content: "";
  position: absolute;
  inset: -35% -25%;
  background: linear-gradient(
    118deg,
    transparent 0%,
    rgba(224, 60, 60, 0.1) 22%,
    rgba(255, 255, 255, 0.07) 45%,
    rgba(26, 35, 126, 0.11) 68%,
    transparent 100%
  );
  background-size: 280% 280%;
  animation: ox-ux-live-ribbon 30s ease-in-out infinite alternate;
  opacity: 0.62;
}

.ox-ux-section-live--alt::before {
  background: linear-gradient(
    125deg,
    transparent 0%,
    rgba(224, 60, 60, 0.14) 28%,
    rgba(103, 58, 183, 0.1) 52%,
    rgba(26, 35, 126, 0.13) 78%,
    transparent 100%
  );
  animation-duration: 28s;
}

@keyframes ox-ux-live-ribbon {
  0% {
    background-position: 0% 40%;
    transform: translate3d(-3%, 1%, 0) scale(1);
  }
  100% {
    background-position: 100% 60%;
    transform: translate3d(3%, -2%, 0) scale(1.06);
  }
}

/* كرات ضبابية — حركة واضحة */
.ox-ux-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.42;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.ox-ux-orb--1 {
  width: min(36vw, 260px);
  height: min(36vw, 260px);
  background: radial-gradient(
    circle,
    rgba(224, 60, 60, 0.58) 0%,
    rgba(224, 60, 60, 0.14) 44%,
    transparent 71%
  );
  left: -12%;
  top: 3%;
  animation: ox-ux-orb-a 32s ease-in-out infinite;
}

.ox-ux-orb--2 {
  width: min(32vw, 230px);
  height: min(32vw, 230px);
  background: radial-gradient(
    circle,
    rgba(57, 73, 171, 0.48) 0%,
    rgba(26, 35, 126, 0.12) 50%,
    transparent 72%
  );
  right: -10%;
  bottom: 5%;
  animation: ox-ux-orb-b 36s ease-in-out infinite;
}

.ox-ux-orb--3 {
  width: min(30vw, 190px);
  height: min(30vw, 190px);
  background: radial-gradient(
    circle,
    rgba(224, 60, 60, 0.28) 0%,
    rgba(147, 51, 234, 0.14) 48%,
    transparent 68%
  );
  left: 38%;
  top: 48%;
  animation: ox-ux-orb-c 28s ease-in-out infinite;
}

.ox-ux-orb--4 {
  width: min(32vw, 220px);
  height: min(32vw, 220px);
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(224, 60, 60, 0.1) 52%,
    transparent 72%
  );
  right: 22%;
  top: -8%;
  display: none;
}

.ox-ux-orb--5 {
  width: min(30vw, 200px);
  height: min(30vw, 200px);
  background: radial-gradient(
    circle,
    rgba(26, 35, 126, 0.4) 0%,
    transparent 66%
  );
  left: 5%;
  bottom: -6%;
  display: none;
}

@keyframes ox-ux-orb-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14vw, 9vh, 0) scale(1.14);
  }
}

@keyframes ox-ux-orb-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1.05);
  }
  50% {
    transform: translate3d(-12vw, -7vh, 0) scale(0.9);
  }
}

@keyframes ox-ux-orb-c {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  33% {
    transform: translate3d(9vw, -12vh, 0) scale(1.1);
  }
  66% {
    transform: translate3d(-7vw, 7vh, 0) scale(0.93);
  }
}

@keyframes ox-ux-orb-d {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(-6vw, 14vh, 0) rotate(10deg);
  }
}

@keyframes ox-ux-orb-e {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(16vw, -5vh, 0) scale(1.18);
  }
}

/* نقاط صغيرة تطفو */
.ox-ux-drift-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(26, 35, 126, 0.42);
  box-shadow: 0 0 8px rgba(224, 60, 60, 0.28);
  animation: ox-ux-drift-dot-move 24s ease-in-out infinite;
  opacity: 0.55;
}

.ox-ux-drift-dot[data-dot="0"] {
  left: 10%;
  top: 24%;
  animation-duration: 19s;
}
.ox-ux-drift-dot[data-dot="1"] {
  left: 86%;
  top: 16%;
  animation-duration: 23s;
  animation-delay: -2s;
  background: rgba(224, 60, 60, 0.48);
}
.ox-ux-drift-dot[data-dot="2"] {
  left: 22%;
  top: 78%;
  animation-duration: 21s;
  animation-delay: -4s;
}
.ox-ux-drift-dot[data-dot="3"] {
  display: none;
}
.ox-ux-drift-dot[data-dot="4"] {
  display: none;
}
.ox-ux-drift-dot[data-dot="5"] {
  display: none;
}

@keyframes ox-ux-drift-dot-move {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 0.55;
  }
  25% {
    transform: translate3d(32px, -38px, 0);
    opacity: 1;
  }
  50% {
    transform: translate3d(-22px, 26px, 0);
    opacity: 0.7;
  }
  75% {
    transform: translate3d(28px, 32px, 0);
    opacity: 0.95;
  }
}

/* هيرو: دوائر إضافية فوق blobs */
.ox-ux-hero-live .ox-ux-orb {
  opacity: 0.58;
}

.ox-ux-orb--h1 {
  width: min(42vw, 380px);
  height: min(42vw, 380px);
  left: 12%;
  top: 6%;
  background: radial-gradient(circle, rgba(224, 60, 60, 0.45) 0%, transparent 68%);
  filter: blur(50px);
  animation: ox-ux-hero-orb1 17s ease-in-out infinite;
}

.ox-ux-orb--h2 {
  width: min(36vw, 300px);
  height: min(36vw, 300px);
  right: 8%;
  top: 26%;
  background: radial-gradient(circle, rgba(26, 35, 126, 0.42) 0%, transparent 68%);
  filter: blur(48px);
  animation: ox-ux-hero-orb2 21s ease-in-out infinite;
}

.ox-ux-orb--h3 {
  width: min(32vw, 260px);
  height: min(32vw, 260px);
  left: 40%;
  bottom: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.48) 0%,
    rgba(224, 60, 60, 0.18) 52%,
    transparent 70%
  );
  filter: blur(42px);
  animation: ox-ux-hero-orb3 19s ease-in-out infinite;
}

@keyframes ox-ux-hero-orb1 {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(9vw, 7vh, 0) scale(1.16);
  }
}

@keyframes ox-ux-hero-orb2 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-9vw, 9vh, 0) scale(1.12);
  }
}

@keyframes ox-ux-hero-orb3 {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(6vw, -6vh, 0) scale(1.1);
  }
}

@media (max-width: 768px) {
  .ox-ux-orb,
  .ox-ux-orb--h1,
  .ox-ux-orb--h2,
  .ox-ux-orb--h3 {
    filter: blur(38px);
  }

  .ox-ux-orb {
    opacity: 0.52;
  }

  .ox-ux-drift-dot {
    width: 5px;
    height: 5px;
    opacity: 0.75;
  }
}

/* ─── Micro-interactions إضافية (روابط / بطاقات) ─── */
body.ox-ux-active .ox-nav a:not(.active) {
  transition: color var(--ox-ux-dur-fast) var(--ox-ux-ease-io),
    opacity var(--ox-ux-dur-fast) var(--ox-ux-ease-io);
}

body.ox-ux-active .ox-nav a:hover {
  opacity: 0.92;
}

body.ox-ux-active .ox-faq-item {
  transition: box-shadow var(--ox-ux-dur) var(--ox-ux-ease-io),
    border-color var(--ox-ux-dur) var(--ox-ux-ease-io),
    transform var(--ox-ux-dur) var(--ox-ux-ease-io);
}

body.ox-ux-active .ox-faq-item:hover {
  transform: translate3d(0, -2px, 0);
}

/* ظل ديناميكي اختياري */
body.ox-ux-active .ox-btn.ox-ux-btn-glow:hover {
  filter: brightness(1.06)
    drop-shadow(0 12px 28px rgba(224, 60, 60, 0.32));
  transition: filter var(--ox-ux-dur) var(--ox-ux-ease-io);
}

body.ox-ux-active .ox-btn-outline.ox-ux-btn-glow:hover {
  filter: drop-shadow(0 10px 24px rgba(26, 35, 126, 0.15));
}

/* ─── وضع تقليل الحركة ─── */
@media (prefers-reduced-motion: reduce) {
  .ox-ux-bg-gradient,
  .ox-ux-bg-bubble {
    animation: none !important;
  }

  .ox-ux-section-live::before,
  .ox-ux-section-live .ox-ux-orb,
  .ox-ux-section-live .ox-ux-drift-dot {
    animation: none !important;
  }

  .ox-ux-section-live::before {
    opacity: 0.35;
    transform: none;
  }

  .ox-ux-section-live .ox-ux-orb {
    opacity: 0.22;
  }

  .ox-ux-section-live .ox-ux-drift-dot {
    opacity: 0.4;
  }

  .ox-ux-bg-canvas {
    display: none !important;
  }

  .ox-ux-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .ox-ux-toast {
    animation: none !important;
  }

  .ox-ux-ripple-el {
    animation-duration: 0.01ms !important;
  }

  .ox-ux-shake {
    animation: none !important;
  }

  body.ox-ux-active .ox-faq-item:hover {
    transform: none;
  }
}

/* Force motion override (used by saas layout) */
.ox-motion-force .ox-ux-section-live::before {
  animation: ox-ux-live-ribbon 30s ease-in-out infinite alternate !important;
}
.ox-motion-force .ox-ux-section-live--alt::before {
  animation-duration: 28s !important;
}
.ox-motion-force .ox-ux-section-live .ox-ux-orb {
  opacity: 0.42 !important;
}
.ox-motion-force .ox-ux-section-live .ox-ux-drift-dot {
  opacity: 0.55 !important;
}
