/* ==========================================================================
   شِحن — نظام Liquid Glass
   زجاج منحنٍ بضباب وانعكاسات ضوء وحدود شعاعية ناعمة + حركة سائلة
   ثلاث درجات: .glass (خفيف بلا blur للأداء) / .glass-blur (زجاج كامل)
   / .bezel (زجاج مزدوج الحواف — إطار خارجي وقلب داخلي بنصف قطر متحد المركز)
   ========================================================================== */

/* ---------- الطبقة الزجاجية الأساسية ---------- */
.glass {
  position: relative;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03) 42%, rgba(255, 255, 255, .06));
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .10);
}

/* انعكاس ضوء علوي — الشريط اللامع الذي يمنح الإحساس الزجاجي */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(115deg,
      rgba(255, 255, 255, .16) 0%,
      rgba(255, 255, 255, .05) 18%,
      transparent 38%,
      transparent 62%,
      rgba(255, 255, 255, .04) 82%,
      rgba(255, 255, 255, .10) 100%);
  opacity: .8;
  pointer-events: none;
}

/* زجاج بضباب حقيقي — للعناصر القليلة المهمة فقط (الأداء أولًا) */
.glass-blur {
  background: linear-gradient(160deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .08));
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}
.glass-blur::before { opacity: 1; }

/* ---------- الزجاج المزدوج الحواف (Bezel) ---------- */
.bezel {
  position: relative;
  padding: 7px; /* غلاف رقيق — القلب الداخلي أصغر بـ 7px من كل جهة */
  border-radius: var(--r-xl);
  background: linear-gradient(150deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04) 40%, rgba(255, 255, 255, .02) 70%, rgba(255, 255, 255, .09));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.bezel-core {
  position: relative;
  border-radius: calc(var(--r-xl) - 7px); /* نصف قطر متحد المركز مع الغلاف */
  background: linear-gradient(165deg, rgba(16, 17, 32, .72), rgba(16, 17, 32, .45));
  border: 1px solid rgba(255, 255, 255, .09);
  overflow: hidden;
}

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: 14px 26px;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 15.5px;
  transition: transform var(--t-med) var(--ease),
              box-shadow var(--t-med) var(--ease),
              background var(--t-med) var(--ease),
              border-color var(--t-med) var(--ease);
  will-change: transform;
}
.btn:active { transform: scale(.97); }

/* زر رئيسي كهرماني — بأسلوب الزر-داخل-الزر */
.btn-primary {
  background: linear-gradient(170deg, var(--accent-strong), var(--accent) 55%, #ef9f2e);
  color: var(--accent-ink);
  box-shadow: 0 14px 34px -12px rgba(255, 180, 67, .55), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px -14px rgba(255, 180, 67, .65), inset 0 1px 0 rgba(255, 255, 255, .55);
}
/* الدائرة الزجاجية الداخلية التي تحوي السهم */
.btn-primary .btn-orb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .30);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .6), 0 2px 6px rgba(36, 26, 4, .18);
  transition: transform var(--t-med) var(--ease);
}
.btn-primary:hover .btn-orb { transform: scale(1.06); }
.btn-primary:active .btn-orb { transform: scale(.94); }

/* زر زجاجي ثانوي */
.btn-glass {
  background: var(--glass-bg-2);
  border: 1px solid var(--glass-brd-2);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-glass:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, .13);
  border-color: rgba(255, 255, 255, .30);
}

.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ---------- حقول الإدخال الزجاجية ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.input {
  width: 100%;
  padding: 13px 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--ink-3); }
.input:hover { background: rgba(255, 255, 255, .08); }
.input:focus {
  outline: none;
  border-color: rgba(255, 180, 67, .6);
  background: rgba(255, 255, 255, .09);
  box-shadow: 0 0 0 3px rgba(255, 180, 67, .18);
}
/* خطأ بعد اللمس فقط (توقيت الحذار: عند الخروج من الحقل) */
.input:user-invalid {
  border-color: rgba(255, 138, 118, .7);
  box-shadow: 0 0 0 3px rgba(255, 138, 118, .14);
}
.error-msg { display: none; font-size: 13px; color: var(--danger); }
.error-msg.show { display: block; }

/* ---------- الشفق المحيطي (خلف الزجاج) ---------- */
.aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.blob--violet { width: 46vw; height: 46vw; background: var(--aurora-violet); top: -14%; inset-inline-end: -12%; animation: drift-1 26s var(--ease) infinite alternate; }
.blob--teal   { width: 34vw; height: 34vw; background: var(--aurora-teal);   bottom: -18%; inset-inline-start: -10%; opacity: .34; animation: drift-2 32s var(--ease) infinite alternate; }
.blob--rose   { width: 24vw; height: 24vw; background: var(--aurora-rose);   top: 34%; inset-inline-start: 28%; opacity: .22; animation: drift-3 38s var(--ease) infinite alternate; }

@keyframes drift-1 { to { transform: translate(-8%, 10%) scale(1.08); } }
@keyframes drift-2 { to { transform: translate(10%, -8%) scale(1.12); } }
@keyframes drift-3 { to { transform: translate(-12%, -10%) scale(.92); } }

/* ---------- اللمعان عند المرور (Sheen) ---------- */
.sheen { position: relative; overflow: hidden; }
.sheen::after {
  content: "";
  position: absolute; top: 0; bottom: 0; inset-inline-start: -80%;
  width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .13), transparent);
  transform: skewX(-18deg);
  transition: inset-inline-start var(--t-slow) var(--ease);
  pointer-events: none;
}
.sheen:hover::after, .sheen:focus-visible::after { inset-inline-start: 130%; }

/* ---------- الشرائح والشارات ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--glass-bg); border: 1px solid var(--glass-brd);
  color: var(--ink-2);
}
/* شارة السعر التجريبي */
.chip--demo {
  background: rgba(255, 180, 67, .12);
  border-color: rgba(255, 180, 67, .4);
  color: var(--accent-strong);
  font-size: 10.5px;
  padding: 3px 9px;
}

/* ---------- زر الدعم العائم (تليجرام) ---------- */
.support-fab { position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 150; }
.fab-btn {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.06));
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  border: 1px solid var(--glass-brd-2);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med);
}
.fab-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 20px 48px -14px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.2); }
.fab-btn svg { width: 26px; height: 26px; }
.fab-panel {
  position: absolute; bottom: 72px; inset-inline-end: 0;
  width: 280px; padding: 16px;
  display: grid; gap: 8px;
  border-radius: var(--r-lg);
  animation: toast-in var(--t-med) var(--ease);
}
.fab-title { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.fab-link {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(255,255,255,.06); border: 1px solid var(--glass-brd);
  transition: background var(--t-fast), transform var(--t-med) var(--ease);
}
.fab-link:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }
.fab-link svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.fab-link span { font-weight: 600; font-size: 14px; }
.fab-link small { margin-inline-start: auto; font-size: 11px; color: var(--ink-3); direction: ltr; unicode-bidi: isolate; }
.badge {
  display: inline-block; padding: 4px 11px;
  font-size: 12px; font-weight: 700;
  border-radius: var(--r-pill);
  background: linear-gradient(170deg, var(--accent-strong), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 18px -6px rgba(255, 180, 67, .6);
}
.badge--glass { background: var(--glass-bg-2); color: var(--ink); border: 1px solid var(--glass-brd-2); box-shadow: none; }

/* ---------- الإشعار العائم (Toast) ---------- */
.toast-region {
  position: fixed; bottom: var(--s-5); inset-inline-start: 50%;
  transform: translateX(50%); /* اتجاه RTL: المنطقة في المنتصف */
  z-index: 300; display: grid; gap: var(--s-2);
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: rgba(16, 17, 32, .82);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--glass-brd-2);
  box-shadow: var(--glass-shadow);
  animation: toast-in var(--t-med) var(--ease);
  font-size: 14.5px; font-weight: 500;
}
.toast .icon { color: var(--accent); flex: none; }
.toast--success .icon { color: var(--success); }
.toast--error .icon { color: var(--danger); }
.toast.leaving { animation: toast-out var(--t-med) var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- هيكل التحميل (Skeleton) ---------- */
.skeleton {
  position: relative; overflow: hidden;
  background: rgba(255, 255, 255, .05);
  border-radius: var(--r-md);
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .07) 50%, transparent 70%);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer { from { transform: translateX(100%); } to { transform: translateX(-100%); } } /* RTL */
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* ---------- الظهور عند التمرير ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease), filter var(--t-slow) var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.in { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { filter: none; transform: none; opacity: 1; transition: opacity .15s; }
}
