/* =========================================================
   Serahin — Login page
   Loaded after style.css (tokens, reset, fonts).
   Desktop: photo pinned full-height on the left, form scrolls on the right.
   Mobile/tablet: form first, photo below.
   ========================================================= */

.page-login { background: #fff; }

/* ---------- 1. Layout ---------- */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
}

@media (min-width: 900px) {
  .auth {
    grid-template-columns: minmax(0, 667fr) minmax(0, 733fr);   /* 667px photo at 1440 wide, as in the design */
    padding: 20px;
  }
}

.auth__signup span.is-swap { display: inline-block; animation: wordSwap .45s var(--ease-out); }
.auth__or.is-swap, .auth__google.is-swap { animation: authStep .5s var(--ease-out); }

/* ---------- 2. Photo panel ---------- */
.auth__media {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--green-200);
}
.auth__photo {
  --photo-scale: 1;
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: 40% 50%;
  opacity: 0;
  transform: scale(calc(var(--photo-scale) * 1.06));
  transition: opacity .6s var(--ease-out), transform 1.2s var(--ease-out);
}
.auth__photo.is-active { opacity: 1; transform: scale(var(--photo-scale)); }
.auth__badge {
  position: absolute; left: clamp(16px, 2vw, 24px); top: clamp(16px, 2vw, 24px);
  width: clamp(54px, 5vw, 68px);
  filter: drop-shadow(0 10px 18px rgba(20, 50, 25, .25));
  transition: transform .5s var(--ease-spring);
}
.auth__badge:hover { transform: rotate(-8deg) scale(1.06); }
.auth__badge img { width: 100%; }

@media (min-width: 900px) {
  /* stays put while the form column scrolls */
  .auth__media { position: sticky; top: 20px; height: calc(100dvh - 40px); }
  /* tighter crop like the design: subject larger, head near the top */
  .auth__photo { object-position: 100% 50%; --photo-scale: 1.13; transform-origin: 6% 100%; }
}

@media (min-width: 900px) {
  .auth__photo[data-role-img="buyer"] { object-position: 50% 50%; --photo-scale: 1; transform-origin: 50% 100%; }
}
.auth__photo[data-role-img="buyer"] { object-position: 50% 30%; }   /* mobile/tablet */

/* ---------- 3. Form panel ---------- */
.auth__panel { display: flex; align-items: center; justify-content: center; padding: clamp(32px, 6vh, 64px) var(--gutter); }
.auth__inner { width: 100%; max-width: 500px; display: flex; flex-direction: column; }

.auth__brand { display: none; align-self: center; margin-bottom: 18px; }
.auth__brand img { width: 150px; }

.auth__back {
  align-self: center; display: inline-flex; align-items: center; gap: 12px;
  font-size: .95rem; color: var(--green); padding: 6px 4px;
  transition: gap .3s var(--ease-out);
}
.auth__back .icon { font-size: 20px; transition: transform .3s var(--ease-out); }
.auth__back:hover .icon { transform: translateX(-4px); }

/* Tabs (same look as the katalog switch) */
.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  margin-top: clamp(28px, 4vh, 44px);
  padding: 12px; border-radius: 18px; background: var(--ink);
}
.auth-tabs__indicator {
  position: absolute; top: 12px; bottom: 12px; left: 12px; width: calc(50% - 12px);
  border-radius: 10px; background: var(--yellow);
  transition: transform .55s var(--ease-out);
}
.auth-tabs[data-active="1"] .auth-tabs__indicator { transform: translateX(100%); }
.auth-tabs__btn {
  position: relative; z-index: 1; min-height: 52px; border-radius: 10px;
  font-size: .95rem; color: #fff; transition: color .4s;
}
.auth-tabs__btn[aria-selected="true"] { color: var(--ink); }

/* Title with underlined role word */
.auth__title {
  margin: clamp(28px, 4vh, 40px) 0 clamp(20px, 3vh, 28px);
  text-align: center;
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem); line-height: 1.1; letter-spacing: -.01em;
}
.auth__word { position: relative; display: inline-block; color: var(--green); }
.auth__word > span { display: inline-block; }
.auth__word > span.is-swap { animation: wordSwap .5s var(--ease-out); }
@keyframes wordSwap { from { opacity: 0; transform: translateY(40%); } }
.auth__swoosh { position: absolute; left: -2%; bottom: -.22em; width: 104%; height: .32em; color: var(--green); }
.auth__swoosh path { stroke-dasharray: 130; stroke-dashoffset: 0; }
.auth__swoosh.is-draw path { animation: swooshDraw .7s var(--ease-out) .1s backwards; }
@keyframes swooshDraw { from { stroke-dashoffset: 130; } }

/* Fields */
.auth__form { display: flex; flex-direction: column; }
.field + .field { margin-top: 20px; }
.field__label { display: block; margin-bottom: 10px; font-size: .95rem; font-weight: 500; color: var(--ink); }
.field__control { position: relative; display: flex; align-items: center; }
.field__icon { position: absolute; left: 16px; font-size: 20px; color: var(--ink-3); pointer-events: none; transition: color .25s; }
.field__input {
  width: 100%; height: 52px; padding: 0 48px 0 50px;
  border: 1.5px solid #d3d9d4; border-radius: 12px; background: #fff;
  font: inherit; font-size: .95rem; color: var(--ink);
  transition: border-color .25s, box-shadow .25s;
}
.field__input::placeholder { color: #a9afaa; }
.field__input:hover { border-color: #b9c3bb; }
.field__input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(43, 98, 51, .1); }
.field__control:focus-within .field__icon { color: var(--green); }
.field__toggle {
  position: absolute; right: 8px; width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; font-size: 20px; color: var(--ink-3);
  transition: color .2s, background-color .2s;
}
.field__toggle:hover { color: var(--green); background: var(--mist); }

.field.is-invalid .field__input { border-color: var(--red); box-shadow: 0 0 0 4px rgba(232, 71, 74, .1); }
.field.is-invalid .field__icon { color: var(--red); }
.field__error { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .85rem; color: var(--red); }
.field__error .icon { font-size: 15px; }
.field.is-invalid .field__control { animation: shake .35s; }

.auth__forgot { align-self: flex-end; margin-top: 16px; font-size: .95rem; color: var(--green); }
.auth__forgot:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Buttons */
.auth__submit {
  position: relative; display: grid; place-items: center;
  height: 54px; margin-top: 28px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 1rem; font-weight: 600;
  transition: background-color .3s, transform .3s var(--ease-out), box-shadow .3s;
}
.auth__submit:hover { background: var(--green-700); transform: translateY(-1px); box-shadow: 0 14px 28px -16px rgba(30, 60, 35, .7); }
.auth__submit:active { transform: translateY(0) scale(.99); }
.auth__spinner {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  opacity: 0; animation: spin .8s linear infinite;
}
.auth__submit.is-loading { pointer-events: none; }
.auth__submit.is-loading .auth__submit-label { opacity: 0; }
.auth__submit.is-loading .auth__spinner { opacity: 1; }

.auth__status { margin-top: 14px; padding: 10px 14px; border-radius: 10px; font-size: .9rem; text-align: center; }
.auth__status.is-ok { background: var(--mint); color: var(--green); }
.auth__status.is-error { background: #fdecec; color: var(--red); }

.auth__or { display: flex; align-items: center; gap: 22px; margin: 24px 0; font-size: .92rem; color: var(--ink-2); }
.auth__or::before, .auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth__google {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  height: 54px; border-radius: 999px; border: 1.5px solid #d3d9d4; background: #fff;
  font-size: .98rem; font-weight: 500; color: var(--ink);
  transition: border-color .25s, background-color .25s, transform .3s var(--ease-out);
}
.auth__google:hover { border-color: var(--green-200); background: #fbfdfb; transform: translateY(-1px); }

.auth__signup { margin-top: 44px; text-align: center; font-size: .95rem; color: var(--ink-2); }
.auth__signup a { margin-left: 4px; font-weight: 600; color: var(--green); }
.auth__signup a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 4. Page entrance ---------- */
/* Photo panel opens first, then the form rises in step by step (--i). */
.js:not(.is-ready) .auth__media,
.js:not(.is-ready) [data-step],
.js:not(.is-ready) .auth__badge { opacity: 0; }

.is-ready .auth__media { animation: authPanel 1.1s var(--ease-out) backwards; }
.is-ready .auth__photo { animation: authPhoto 1.8s var(--ease-out) backwards; }
.is-ready .auth__badge { animation: authBadge .9s var(--ease-spring) .55s backwards; }
.is-ready [data-step] { animation: authStep .8s var(--ease-out) calc(.25s + var(--i, 0) * .07s) backwards; }
.is-ready .auth__swoosh path { animation: swooshDraw .9s var(--ease-out) .75s backwards; }

@keyframes authPanel {
  from { clip-path: inset(10% 14% 10% 14% round 999px); opacity: 0; }
  35%  { opacity: 1; }
  to   { clip-path: inset(0 round var(--r-xl)); opacity: 1; }
}
@keyframes authPhoto { from { transform: scale(1.18); filter: saturate(.6); } }
@keyframes authBadge { from { opacity: 0; transform: scale(.4) rotate(-30deg); } }
@keyframes authStep  { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }

/* ---------- 5. Tablet + phone: form first, photo below ---------- */
@media (max-width: 899px) {
  .auth__brand { display: block; }
  .auth__panel { padding-top: 28px; padding-bottom: 32px; }
  .auth__media {
    order: 2;                           /* photo moves below the form */
    margin: 0 var(--gutter) var(--gutter);
    aspect-ratio: 4 / 3.4;
  }
  .auth__photo { object-position: 40% 35%; }
  .auth__badge { display: none; }     /* logo already shown above the form */
}

@media (max-width: 639px) {
  .auth-tabs { padding: 8px; border-radius: 16px; }
  .auth-tabs__indicator { top: 8px; bottom: 8px; left: 8px; width: calc(50% - 8px); }
  .auth-tabs__btn { min-height: 46px; font-size: .86rem; }
  .auth__title { font-size: 1.9rem; }
  .auth__signup { margin-top: 32px; }
  .auth__media { aspect-ratio: 1 / 1.05; }
}

@media (prefers-reduced-motion: reduce) {
  .js .auth__media, .js [data-step], .js .auth__badge { opacity: 1 !important; }
}
