/* =========================================================
   Sada — Floating-label inputs + flip checkbox
   Themed with the site's CSS variables (--ink, --line, --accent...)
   so it follows light/dark mode automatically.
   ========================================================= */

/* ---------- Floating label text inputs ----------
   الخط نفسه (الحدّ) ما عاد مرسوم مباشرة على .input-shell — صار مرسوم
   عبر <fieldset class="notch"> بالداخل. السبب: fieldset/legend تعطينا
   "فجوة" حقيقية داخل خط الحدّ نفسه (يعني الخط ببساطة ما يترسم بذيك
   المنطقة)، مو مربّع لون مرسوم فوق الخط. فالليبل يقعد بالضبط بنص
   الخط، ووراءه دائمًا خلفية .input-shell العادية (لون واحد ثابت
   بكامل الصندوق) — بدون ما نحتاج نطابق أي لون خلفية يدويًا، ومهما
   كان الثيم فاتح أو غامق. */
.field.floating{ position:relative; }
.field.floating .input-shell{
  position:relative;
  border-color:transparent !important; /* الحد الحقيقي صار على fieldset.notch */
}
.field.floating .notch{
  box-sizing:border-box;
  position:absolute;
  /* ملاحظة إصلاح: فَيَرفُكس يحجز مساحة فوق حدّ الـ fieldset مخصّصة
     لعنصر legend حتى لو كان عرضه صفر ومخفي — فيطلع كخط/طبقة زايدة
     فوق الصندوق المدوّر بدل ما يطابق حوافه بالضبط. الحل: نرفع صندوق
     الـ notch لأعلى بقيمة سالبة (top:-5px بدل 0) عشان تلك المساحة
     المحجوزة "تُمتَص" داخل الصندوق نفسه ويرجع الحد الحقيقي يطابق
     أعلى الحقل تمامًا. القيمة نفسها تشتغل بثبات عبر المتصفحات لأنها
     مرتبطة بارتفاع الـ legend (~11px) لا بحجم الخط الأساسي. */
  top:-5px; right:0; bottom:0; left:0;
  margin:0;
  min-width:0;
  min-height:0;
  padding-block:0;
  padding-inline:10px;
  border:1px solid var(--line);
  border-radius:inherit;
  background:none;
  appearance:none;
  -webkit-appearance:none;
  pointer-events:none;
  transition:border-color .15s ease;
}
.field.floating .input-shell:focus-within .notch{ border-color:var(--focus-border); }
.field.floating .input-shell.field-error .notch{ border-color:var(--danger); }
.field.floating .notch legend{
  display:block;
  margin:0;
  padding:0;
  width:0;
  min-width:0;
  height:11px; /* ثابت — يطابق القيمة اللي بُني عليها تعويض top أعلاه */
  border:0;
  overflow:hidden;
  white-space:nowrap;
  visibility:hidden; /* هذا النص بس يفتح الفجوة بالخط — النص المرئي هو الـ label */
  font-size:11px;
  font-weight:600;
  letter-spacing:.2px;
  line-height:1;
  /* نفس منحنى ومدة حركة الـ label تحت — عشان فتحة الخط تنفتح بالضبط
     بنفس إيقاع طلوع النص، مو أسرع أو أبطأ منه. */
  transition:width .12s ease .28s;
}
.field.floating .notch legend > span{ display:inline-block; padding-inline:5px; }
.field.floating .input-shell input:focus ~ .notch legend,
.field.floating .input-shell input:not(:placeholder-shown) ~ .notch legend{
  width:auto;
}

.field.floating label{
  position:absolute;
  inset-inline-start:13px;
  top:50%;
  transform:translateY(-50%);
  margin:0;
  padding:0 5px;
  font-size:14.5px;
  font-weight:500;
  color:var(--ink-faint);
  background:transparent;
  pointer-events:none;
  /* حركة بسيطة وخفيفة: بس طلوع/نزول وتصغير حجم الخط، بدون تلاشي
     (opacity ثابت 1 طول الوقت) وبدون أي تأثيرات إضافية. */
  transition:
    top .22s ease,
    font-size .22s ease,
    color .22s ease;
  z-index:1;
  max-width:calc(100% - 26px);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  will-change:top, transform;
}
.field.floating .input-shell input{
  padding-top:19px;
  padding-bottom:9px;
}
.field.floating .input-shell input:focus ~ label,
.field.floating .input-shell input:not(:placeholder-shown) ~ label{
  top:0;
  transform:translateY(-50%);
  font-size:11px;
  font-weight:600;
  letter-spacing:.2px;
  color:var(--focus-border);
}

.field.floating .input-shell.field-error input:focus ~ label,
.field.floating .input-shell.field-error input:not(:placeholder-shown) ~ label{
  color:var(--danger);
}
.field.floating .input-shell.field-ok input:not(:placeholder-shown) ~ label{
  color:var(--success);
}

/* ---------- Kill the browser's autofill background (Chrome/Edge/Safari) ----------
   Chrome paints its own yellow/blue background straight onto the <input> on
   autofill, which clashes with our theme. Forcing a huge inset box-shadow in
   our own theme color replaces that paint before it ever shows, and the
   near-infinite transition stops the one-frame yellow flash Chrome does on
   load. */
.field.floating .input-shell input:-webkit-autofill,
.field.floating .input-shell input:-webkit-autofill:hover,
.field.floating .input-shell input:-webkit-autofill:active{
  -webkit-text-fill-color:var(--ink) !important;
  caret-color:var(--ink);
  -webkit-box-shadow:0 0 0 1000px var(--input-bg) inset !important;
  box-shadow:0 0 0 1000px var(--input-bg) inset !important;
  transition:background-color 600000s ease-in-out 0s, color 600000s ease-in-out 0s;
}
.field.floating .input-shell:focus-within input:-webkit-autofill{
  -webkit-box-shadow:0 0 0 1000px var(--panel) inset !important;
  box-shadow:0 0 0 1000px var(--panel) inset !important;
}
/* Firefox: no autofill background quirk, but normalize the text/caret color
   it applies so it doesn't fight the theme in dark mode. */
.field.floating .input-shell input:autofill{
  -webkit-text-fill-color:var(--ink);
  caret-color:var(--ink);
}

/* ---------- Flip checkbox (remember me) ---------- */
.remember{ display:flex; align-items:center; gap:9px; color:var(--ink-soft); cursor:pointer; }
.cbx{
  position:relative;
  width:19px;
  height:19px;
  flex-shrink:0;
  border:1.6px solid var(--line);
  background:var(--panel);
  border-radius:5px;
  transition:border-color .2s ease;
  -webkit-perspective:20;
  perspective:20;
}
.remember:hover .cbx{ border-color:var(--accent); }
.cbx input{ position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; }
.cbx input:checked ~ .flip{ transform:rotateY(180deg); }
.cbx input:checked{ border-color:var(--accent); }
.flip{
  display:block;
  width:100%;
  height:100%;
  transition:transform .4s ease;
  transform-style:preserve-3d;
  position:relative;
}
.front,.back{
  backface-visibility:hidden;
  position:absolute;
  inset:0;
  border-radius:3px;
}
.front{ background:transparent; }
.back{
  transform:rotateY(180deg);
  background:var(--accent);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 0 1px var(--accent);
}
.back svg{ width:12px; height:11px; fill:none; }
.back svg path{ stroke:#fff; stroke-width:2.6; stroke-linecap:round; stroke-linejoin:round; }

/* ---------- Sign in / Sign up switch ---------- */
.radio-inputs{
  position:relative;
  display:flex;
  border-radius:999px;
  background:var(--ink);
  padding:4px;
  width:100%;
  max-width:270px;
  margin:0 auto;
  height:42px;
  box-sizing:border-box;
  overflow:hidden; /* يمنع أي عنصر داخلي (زي المؤشر المتحرك) من يطلع خارج حدود القائمة لأي سبب */
  isolation:isolate; /* يضمن طبقة z-index مستقلة عشان النص يفضل فوق المؤشر المتحرك */
}

/* المؤشر المتحرك (thumb) — ينزلق بين الخيارين بدل ما اللون يتغير فجأة،
   وهو اللي يعطي إحساس "في انتقال حي" لما تبدّل بين تسجيل الدخول وإنشاء
   الحساب. */
.radio-inputs::before{
  content:"";
  position:absolute;
  top:4px; bottom:4px;
  inset-inline-start:4px;
  width:calc(50% - 4px);
  background:var(--panel);
  border-radius:999px;
  box-shadow:0 1px 5px rgba(0,0,0,.22);
  transition:transform .35s cubic-bezier(.65,0,.35,1);
  z-index:0;
  pointer-events:none;
}
.radio-inputs:has(.radio:last-child input:checked)::before{
  transform:translateX(-100%);
}
html[dir="ltr"] .radio-inputs:has(.radio:last-child input:checked)::before{
  transform:translateX(100%);
}

.radio-inputs .radio{ position:relative; z-index:1; flex:1 1 0; }
.radio-inputs .radio input{ display:none; }
.radio-inputs .radio .radio-item{
  display:flex;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  gap:6px;
  height:100%;
  border-radius:999px;
  color:#8f9094;
  font-size:13.5px;
  font-weight:600;
  transition:color .35s ease, background-color .2s ease, transform .15s ease;
  user-select:none;
}
.radio-inputs .radio .radio-item .radio-icon{
  width:15px;
  height:15px;
  flex-shrink:0;
  stroke:currentColor;
  transition:stroke .35s ease;
}
.radio-inputs input:checked ~ .radio-item{
  color:var(--ink);
}

/* Hover — تلميح بسيط للخيار الغير محدد إنه قابل للنقر، بدون ما يزاحم
   لون المؤشر المتحرك حق الخيار المحدد. */
.radio-inputs .radio input:not(:checked) ~ .radio-item:hover{
  color:#d6d7db;
  background:rgba(255,255,255,.06);
}
.radio-inputs .radio .radio-item:active{
  transform:scale(.96);
}

@media (prefers-reduced-motion: reduce){
  .radio-inputs::before{ transition:none; }
  .radio-inputs .radio .radio-item{ transition:color .15s ease; }
}

/* ---------- Glow submit button ---------- */
.btn-glow{
  position:relative;
  background:transparent;
  border:none;
  padding:0;
  overflow:visible;
}
.btn-glow .glow,
.btn-glow .glow-hover,
.btn-glow .stroke,
.btn-glow .stroke-hover{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:8px;
  transition:opacity 1s ease;
}
.btn-glow .glow{
  background:radial-gradient(15% 60% at 50% 100%, #fff 0%, transparent 100%);
  filter:blur(15px);
  opacity:.9;
}
.btn-glow .glow-hover{
  background:radial-gradient(55% 60% at 50% 100%, #fff 0%, transparent 100%);
  filter:blur(18px);
  opacity:0;
}
.btn-glow:hover .glow{ opacity:0; }
.btn-glow:hover .glow-hover{ opacity:.9; }
.btn-glow .stroke{
  background:radial-gradient(10% 60% at 50% 100%, #fff 0%, transparent 100%);
  opacity:.5;
}
.btn-glow .stroke-hover{
  background:radial-gradient(55% 60% at 50% 100%, #fff 0%, transparent 100%);
  opacity:0;
}
.btn-glow:hover .stroke{ opacity:0; }
.btn-glow:hover .stroke-hover{ opacity:.5; }
.btn-glow .fill{
  position:absolute;
  inset:1px;
  border-radius:7px;
  z-index:1;
  background:var(--btn-bg);
  transition:opacity .15s ease;
}
.btn-glow .btn-content{
  position:relative;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  height:100%;
  padding:12.5px;
  box-sizing:border-box;
  color:var(--btn-text);
  font-weight:700;
  font-size:14.5px;
}
.btn-glow:hover{ opacity:1; }
.btn-glow:active{ transform:scale(.97); }
.btn-glow[disabled]{ cursor:default; }
.btn-glow[disabled] .glow-hover,
.btn-glow[disabled] .stroke-hover{ opacity:0 !important; }
.btn-glow.is-success .fill{ background:var(--success); }


