/* ==========================================================================
   يلا نكود — Login page (builds on the tokens and components in styles.css)
   ========================================================================== */

.auth { min-height: 100vh; background: var(--white); }
.auth__layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr); }

/* ---------- Visual panel (right in RTL) ---------- */
.auth__visual {
  position: sticky; top: 0; height: 100vh; margin: 16px; margin-inline-end: 0; overflow: hidden; isolation: isolate;
  height: calc(100vh - 32px); top: 16px;
  display: flex; flex-direction: column; border-radius: var(--r-xl);
  background: radial-gradient(120% 80% at 80% 0%, #5FCB74 0%, var(--green-500) 38%, var(--green-700) 100%);
  color: var(--white);
}
.visual__pattern {
  position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .16) 1.2px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(80% 60% at 50% 40%, #000, transparent);
  mask-image: radial-gradient(80% 60% at 50% 40%, #000, transparent);
}
.auth__visual::after { /* soft light behind the image */
  content: ""; position: absolute; inset: 14% 10% 30%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .32), transparent); filter: blur(10px);
}
.visual__logo { position: absolute; top: 24px; inset-inline-start: 28px; z-index: 3; }
.visual__logo img { height: 48px; width: auto; filter: drop-shadow(0 3px 0 rgba(5, 63, 33, .35)); }

/* Each role has its own deck of slides that rotate on their own */
.deck { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 600ms var(--ease), visibility 0s linear 600ms; }
.deck.is-active { opacity: 1; visibility: visible; transition: opacity 600ms var(--ease), visibility 0s; }
.slide {
  position: absolute; inset: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 84px 40px 128px; opacity: 0; visibility: hidden; transform: scale(.985);
  transition: opacity 700ms var(--ease), transform 900ms var(--ease), visibility 0s linear 700ms;
}
.slide.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 700ms var(--ease), transform 900ms var(--ease), visibility 0s; }
.visual__art {
  width: min(100%, 520px); flex: 1; min-height: 0; object-fit: contain; object-position: bottom;
  filter: drop-shadow(0 30px 40px rgba(5, 63, 33, .35));
  animation: drift 9s ease-in-out infinite;
}
@keyframes drift { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.015); } }
.slide .visual__copy { opacity: 0; transform: translateY(10px); transition: opacity 600ms var(--ease) 150ms, transform 700ms var(--ease) 150ms; }
.slide.is-active .visual__copy { opacity: 1; transform: none; }
.deck__dots { position: absolute; bottom: 70px; inset-inline: 0; z-index: 3; display: flex; justify-content: center; gap: 8px; }
.deck__dots button { position: relative; width: 34px; height: 5px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; cursor: pointer; }
.deck__dots button::after { content: ""; position: absolute; inset: 0; background: var(--white); transform: scaleX(0); transform-origin: right; }
.deck__dots button.is-done::after { transform: scaleX(1); }
.deck__dots button.is-active::after { animation: fillbar 5s linear forwards; }
@keyframes fillbar { to { transform: scaleX(1); } }
.visual__copy { text-align: center; margin-top: 18px; max-width: 420px; }
.visual__copy h2 { color: var(--white); font-size: clamp(1.5rem, 1rem + 1.2vw, 2rem); text-shadow: 0 2px 0 rgba(5, 63, 33, .25); }
.visual__copy p { margin-top: 6px; color: rgba(255, 255, 255, .88); font-size: 15px; }
.visual__trust {
  position: absolute; bottom: 24px; inset-inline: 0; z-index: 3;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .92);
}
.visual__trust li { display: inline-flex; align-items: center; gap: 6px; }
.visual__trust .icon { width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: rgba(255, 255, 255, .2); stroke-width: 3; }

/* ---------- Form side ---------- */
.auth__main { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: 24px clamp(16px, 4vw, 48px) 28px; isolation: isolate; overflow: hidden; }
.auth__main::before { /* faint glow + dot grid, like the hero */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(40% 35% at 50% 45%, rgba(147, 225, 157, .28), transparent 70%),
    radial-gradient(rgba(8, 93, 49, .09) 1px, transparent 1.2px) 0 0 / 24px 24px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 85%);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent 85%);
}
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.auth__logo { visibility: hidden; }
.auth__logo img { height: 42px; width: auto; }
.auth__back { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; padding: 8px 14px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600; color: var(--ink-2); transition: background-color var(--dur) var(--ease); }
.auth__back:hover { background: var(--surface); color: var(--ink); }
.auth__back .icon { width: 16px; height: 16px; }

.auth__stage { position: relative; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; align-content: center; gap: 18px; padding-block: 80px 24px; }

/* Mascots sit around the card's top corners — big ones behind, small ones perched in front */
.card-wrap { position: relative; width: min(100%, 440px); }
.card-wrap .auth__card { width: 100%; }
.mascots { position: absolute; inset: 0; pointer-events: none; transition: translate 600ms var(--ease); }
.mascots--back { z-index: 0; translate: calc(var(--px, 0px) * .6) calc(var(--py, 0px) * .6); }
.mascots--front { z-index: 3; translate: calc(var(--px, 0px) * 1.1) calc(var(--py, 0px) * 1.1); }
.mascot {
  position: absolute; height: auto; filter: drop-shadow(0 14px 18px rgba(8, 93, 49, .16));
  animation: bob var(--d, 7s) ease-in-out infinite; animation-delay: calc(var(--d, 7s) * -.37);
}
.mascots--front .mascot { filter: drop-shadow(0 8px 12px rgba(8, 93, 49, .24)); }
.m-robo    { --d: 7s;   --r: -4deg; width: 132px; left: -98px;  top: -18px; }
.m-spark   { --d: 8s;   --r: 5deg;  width: 84px;  left: -72px;  top: 134px; }
.m-rocket  { --d: 6.5s; --r: 8deg;  width: 60px;  left: 92px;   top: -66px; }
.m-bracket { --d: 7.5s; --r: 4deg;  width: 122px; right: -92px; top: -14px; }
.m-shield  { --d: 8.5s; --r: -5deg; width: 92px;  right: -66px; top: 128px; }
.m-code    { --d: 9s;   --r: -6deg; width: 66px;  right: 88px;  top: -52px; }
.m-star    { --d: 6s;   --r: 10deg; width: 58px;  left: -4px;   top: -30px; }
.m-puzzle  { --d: 6.8s; --r: -8deg; width: 56px;  right: -4px;  top: -28px; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(var(--r)); }
  50% { transform: translateY(-8px) rotate(calc(var(--r) * .4)); }
}

.auth__card {
  position: relative; z-index: 2; width: min(100%, 440px);
  padding: 32px 30px 26px; border-radius: 28px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(229, 236, 231, .9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 40px 80px -32px rgba(8, 93, 49, .32), 0 12px 28px -14px rgba(8, 93, 49, .18);
  animation: cardIn 600ms var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.auth__card h1 { font-size: 1.875rem; text-align: center; }
.auth__sub { margin-top: 4px; text-align: center; color: var(--muted); font-size: 15px; }

.auth__role { margin-top: 22px; }
.auth__role span { gap: 8px; display: flex !important; align-items: center; justify-content: center; height: 44px; font-size: 14.5px; }
.auth__role .icon { width: 18px; height: 18px; }

.btn-google {
  width: 100%; height: 52px; margin-top: 14px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--white);
  font-size: 15.5px; font-weight: 600; color: var(--ink);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn-google:hover { background: #FAFCFB; border-color: #C3D1C8; box-shadow: var(--sh-sm); }
.btn-google:active { transform: translateY(1px); }
.btn-google__logo { width: 22px; height: 22px; }
.btn-google.is-loading { pointer-events: none; opacity: .7; }

.auth__or { position: relative; margin-block: 18px 14px; text-align: center; font-size: 13px; color: var(--muted); }
.auth__or::before { content: ""; position: absolute; inset-inline: 0; top: 50%; border-top: 1px solid var(--line); }
.auth__or span { position: relative; padding-inline: 12px; background: var(--white); }

.auth__form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.auth__form > * { min-width: 0; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.field > * { min-width: 0; }
.field__row { display: flex; align-items: center; justify-content: space-between; }
.field__label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field__link { font-size: 13px; text-decoration: none; }
.field__link:hover { text-decoration: underline; }
.field__box {
  display: flex; align-items: center; gap: 10px; height: 52px; padding-inline: 14px;
  background: var(--white); border: 1.5px solid var(--line-2); border-radius: 14px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field__box > .icon { width: 19px; height: 19px; color: var(--muted); flex: none; transition: color var(--dur) var(--ease); }
.field__box:focus-within { border-color: var(--green-400); box-shadow: 0 0 0 4px rgba(64, 182, 88, .15); }
.field__box:focus-within > .icon { color: var(--green-600); }
.field__box input { flex: 1; width: 0; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font: inherit; font-size: 16px; color: var(--ink); text-align: right; }
.field__box input::placeholder { color: #A9B6AE; }
.field__eye { flex: none; width: 36px; height: 36px; display: grid; place-items: center; margin-inline-end: -8px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.field__eye:hover { background: var(--surface); color: var(--ink); }
.field__eye .icon { width: 19px; height: 19px; }
.field__err { display: none; font-size: 12.5px; font-weight: 600; color: #D93B3B; }
.field.is-invalid .field__err { display: block; }
.field.is-invalid .field__box { border-color: #E5484D; }

.check { display: inline-flex; align-items: center; gap: 10px; justify-self: start; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; border: 1.5px solid var(--line-2); background: var(--white); color: transparent; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.check__box .icon { width: 14px; height: 14px; stroke-width: 3.2; }
.check input:checked + .check__box { background: var(--green-500); border-color: var(--green-500); color: var(--white); }
.check input:focus-visible + .check__box { outline: 3px solid var(--green-300); outline-offset: 2px; }

.auth__submit { margin-top: 4px; position: relative; }
.auth__spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: var(--white); animation: spin 700ms linear infinite; }
.auth__submit.is-loading { pointer-events: none; }
.auth__submit.is-loading .auth__spinner { display: block; }
.auth__submit.is-loading > .icon { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth__msg { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--sky-tint); color: var(--sky-ink); font-size: 13.5px; line-height: 1.7; }
.auth__msg .icon { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.auth__alt { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-2); text-align: center; font-size: 14.5px; color: var(--text-2); }
.auth__secure { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.auth__secure .icon { width: 14px; height: 14px; color: var(--green-600); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .auth__layout { grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); }
  .visual { padding-inline: 24px; }
    /* Narrower form column: no room at the sides, so the mascots rise above the card */
  .auth__stage { padding-top: 104px; }
  .m-spark, .m-shield { display: none; }
  .m-robo { width: 104px; left: -34px; top: -96px; }
  .m-bracket { width: 96px; right: -30px; top: -86px; }
  .m-rocket { left: 30%; top: -70px; }
  .m-code { right: 30%; top: -58px; }
}
@media (max-width: 900px) {
  .auth__layout { grid-template-columns: 1fr; }
  .auth__visual { display: none; }
  .auth__logo { visibility: visible; }
}
@media (max-width: 600px) {
  .auth__main { padding: 14px 16px 20px; }
  /* Phones: the same crown above the card, scaled down */
  .auth__stage { padding-block: 92px 8px; align-content: start; }
  .m-spark, .m-shield { display: none; }
  .m-robo { width: 86px; left: -4px; top: -80px; }
  .m-bracket { width: 80px; right: -2px; top: -72px; }
  .m-rocket { width: 46px; left: 31%; top: -56px; }
  .m-code { width: 50px; right: 31%; top: -46px; }
  .m-star { width: 44px; left: -12px; top: -20px; }
  .m-puzzle { width: 42px; right: -12px; top: -18px; }
  .auth__card { padding: 26px 18px 20px; border-radius: 24px; }
  .auth__card h1 { font-size: 1.625rem; }
}
@media (prefers-reduced-motion: reduce) {
  .mascots { transition: none; }
  .deck__dots button.is-active::after { transform: scaleX(1); }
}

/* ---------- English ---------- */
/* The page keeps its right-to-left layout in English; each line of text still reads left to right */
html[lang="en"] .auth :is(h1, h2, p, span, a, label, button, small, li) { unicode-bidi: plaintext; }
html[lang="en"] .auth :is(.field__label, .field__err, .auth__msg span) { text-align: right; }
