/*
 * WebPlus — Global UI Components (v4.0)
 * المؤشر التفاعلي، Chapter Dock، الهيدر المتكيف، والستائر
 * بادئة الأصناف: wx-
 */

/* ════════════════════════════════════════════════
   1. INTERACTIVE CURSOR (ديسكتوب فقط)
   ════════════════════════════════════════════════ */
@media (hover: hover) and (pointer: fine) {
  body.wx-custom-cursor-active,
  body.wx-custom-cursor-active a,
  body.wx-custom-cursor-active button {
    cursor: none !important;
  }

  .wx-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffffff;
    pointer-events: none;
    z-index: 99999;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: width 0.3s var(--wx-ease-smooth),
                height 0.3s var(--wx-ease-smooth),
                background-color 0.3s var(--wx-ease-smooth),
                border-radius 0.3s var(--wx-ease-smooth),
                opacity 0.3s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .wx-cursor-dot.is-visible {
    opacity: 1;
  }

  /* حالة الرابط (Link) */
  .wx-cursor-dot.is-link {
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1.5px solid #ffffff;
    backdrop-filter: blur(2px);
  }

  /* حالة السحب (Drag) */
  .wx-cursor-dot.is-drag {
    width: 68px;
    height: 68px;
    background-color: rgba(0, 102, 255, 0.3);
    border: 1.5px solid var(--wx-sky);
    mix-blend-mode: normal;
  }

  .wx-cursor-label {
    font-family: var(--wx-font-ar);
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.2s ease;
  }

  .wx-cursor-dot.is-drag .wx-cursor-label,
  .wx-cursor-dot.has-label .wx-cursor-label {
    opacity: 1;
  }
}

/* ════════════════════════════════════════════════
   2. UNIFIED DEV DOCK (B04 Unified Bottom Controls)
   ════════════════════════════════════════════════ */
.wx-dev-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: rgba(5, 14, 36, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--wx-radius-pill, 9999px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 102, 255, 0.15);
  opacity: 0;
  transition: transform 0.5s var(--wx-ease-expo), opacity 0.4s ease;
  font-family: var(--wx-font-ar, 'Tajawal', sans-serif);
  font-size: 13px;
  color: #F8FAFC;
  pointer-events: auto;
}

.wx-dev-dock.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.wx-dev-dock__divider {
  color: rgba(255, 255, 255, 0.2);
  font-weight: 300;
  user-select: none;
}

.wx-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #F8FAFC;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--wx-radius-pill, 9999px);
  transition: all 0.25s ease;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.wx-dock-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--wx-sky, #38BDF8);
}

.wx-dock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  flex-shrink: 0;
}

.wx-dock-chevron {
  transition: transform 0.25s ease;
}

.wx-dock-chapters-wrap {
  position: relative;
}

.wx-dock-chapters-wrap.is-open .wx-dock-chevron {
  transform: rotate(180deg);
}

.wx-dock-chapters-menu {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  max-height: 380px;
  overflow-y: auto;
  background: rgba(5, 14, 36, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.wx-dock-chapters-title {
  font-size: 11px;
  font-weight: 700;
  color: #64748B;
  padding: 4px 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.wx-dock-chapters-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wx-dock-chapter-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #94A3B8;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: start;
}

.wx-dock-chapter-link:hover,
.wx-dock-chapter-link.is-active {
  background: rgba(0, 102, 255, 0.25);
  color: #F8FAFC;
}

.wx-dock-chapter-link.is-active .wx-dock-dot {
  background: var(--wx-sky, #38BDF8);
  box-shadow: 0 0 8px var(--wx-sky, #38BDF8);
}

.wx-dev-dock__metrics {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--wx-font-lat, -apple-system, sans-serif);
  font-size: 12px;
  color: var(--wx-slate-300, #CBD5E1);
  white-space: nowrap;
}

.wx-dev-dock__metric {
  font-weight: 600;
}

.wx-dev-dock__dot-sep {
  color: #475569;
}

.wx-dev-dock__zero {
  color: #10B981;
  font-weight: 700;
  font-size: 11px;
}

@media (max-width: 640px) {
  .wx-dev-dock {
    padding: 6px 12px;
    gap: 8px;
    bottom: 16px;
    max-width: calc(100vw - 110px);
  }
  .wx-dev-dock__metrics {
    display: none;
  }
  .wx-dev-dock__divider {
    display: none;
  }
}

/* ════════════════════════════════════════════════
   3. ADAPTIVE HEADER (الهيدر المتكيف)
   ════════════════════════════════════════════════ */
.wx-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 76px;
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: transform 0.4s var(--wx-ease-smooth),
              background 0.4s var(--wx-ease-smooth),
              box-shadow 0.4s var(--wx-ease-smooth);
}

.wx-header.is-hidden {
  transform: translateY(-100%);
}

.wx-header.is-glass {
  background: rgba(7, 21, 48, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--wx-border-dark);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.wx-header.is-light-mode {
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--wx-slate-300);
}

.wx-header.is-light-mode .wx-nav-link {
  color: var(--wx-navy);
}

.wx-header.is-light-mode .wx-header-logo svg text {
  fill: var(--wx-navy);
}

/* ════════════════════════════════════════════════
   4. CURTAIN OVERLAP SYSTEM (مصفوفة الستائر)
   ════════════════════════════════════════════════ */
.wx-curtain-wrap {
  position: relative;
  z-index: 1;
}

.wx-curtain-top {
  position: relative;
  margin-top: calc(var(--wx-curve) * -1);
  border-radius: var(--wx-curve) var(--wx-curve) 0 0;
  box-shadow: var(--wx-shadow-curtain);
  overflow: hidden;
}

/* ════════════════════════════════════════════════
   5. WHATSAPP FLOATING BUTTON (B01 Fixed)
   ════════════════════════════════════════════════ */
.wp-whatsapp {
  position: fixed !important;
  bottom: 24px !important;
  inset-inline-end: 24px !important;
  z-index: 995 !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: #25D366 !important;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.45) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  transition: transform 0.3s var(--wx-ease-smooth), box-shadow 0.3s ease !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.wp-whatsapp:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 12px 32px rgba(37, 211, 102, 0.6) !important;
}

.wp-whatsapp__icon {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  fill: #ffffff !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.wp-whatsapp__label {
  display: none !important;
}
