/* ============================================================
   SmartZone — Split login (silk art + clean white form, RTL)
   Inspired by reference "Cogie" layout.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&display=swap');

body.login-mode { overflow: hidden; }

.auth {
  --ink: #0b0b12;
  --line: #e7e7ee;
  --muted: #8a8a99;
  --field-bg: #f4f5f8;
  --accent: #1a1a24;

  position: relative;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 2vh, 2rem);
  box-sizing: border-box;
  font-family: 'Vazirmatn', sans-serif;
  background: #08080c;
  overflow: visible;
}

/* ── Silk ribbons peeking behind the card (reference style) ── */
.auth__peek {
  position: absolute;
  z-index: 1;
  width: min(68rem, calc(100% - 0.5rem));
  height: min(46rem, 92vh);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.auth__peek-ribbon {
  position: absolute;
  background: url('../assets/images/login-silk.png') center/cover no-repeat;
  border-radius: 1.5rem;
  opacity: 0.95;
  filter: saturate(1.12) brightness(1.04);
  box-shadow: 0 30px 80px -20px rgba(120, 40, 180, 0.45);
}
.auth__peek-ribbon--left {
  width: 44%;
  height: 96%;
  left: -10%;
  bottom: -7%;
  transform: rotate(-11deg);
  animation: ribbonDriftL 14s ease-in-out infinite alternate;
}
.auth__peek-ribbon--bottom {
  width: 82%;
  height: 48%;
  left: 9%;
  bottom: -11%;
  transform: rotate(-3deg);
  animation: ribbonDriftB 18s ease-in-out infinite alternate;
}
@keyframes ribbonDriftL { from { transform: rotate(-11deg) translateY(0); } to { transform: rotate(-9deg) translateY(-8px); } }
@keyframes ribbonDriftB { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(-1deg) scale(1.03); } }
@media (max-width: 899px) {
  .auth__peek-ribbon--left { left: -12%; width: 46%; opacity: 0.55; }
  .auth__peek-ribbon--bottom { bottom: -10%; height: 36%; opacity: 0.45; }
}

/* ── Card ── */
.auth__card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: row-reverse;        /* RTL: form on right, art on left */
  width: 100%;
  max-width: 64rem;
  height: 44rem;
  max-height: 94vh;
  background: #fff;
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.9);
  animation: cardIn 0.7s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px) scale(0.99); } to { opacity: 1; transform: none; } }

/* ── Art (silk) panel ── */
.auth__art {
  position: relative;
  display: none;
  width: 48%;
  flex-shrink: 0;
  padding: 2.25rem;
  color: #fff;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: #000;
  margin: 0.75rem;
  margin-right: 0;                    /* art sits on the left edge */
  border-radius: 1.1rem;
}
@media (min-width: 900px) { .auth__art { display: flex; } }
.auth__art-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  animation: artZoom 18s ease-in-out infinite alternate;
}
@keyframes artZoom { from { transform: scale(1); } to { transform: scale(1.08); } }
.auth__art::after {            /* gradient for text legibility */
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.45) 0%, transparent 30%, transparent 55%, rgba(0,0,0,0.7) 100%);
}

.art__eyebrow {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 0.85rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255,255,255,0.92);
}
.art__eyebrow::after { content: ''; flex: 1; max-width: 5rem; height: 1px; background: rgba(255,255,255,0.5); }

.art__bottom { position: relative; z-index: 2; }
.art__title {
  margin: 0 0 0.85rem;
  font-family: 'Playfair Display', 'Vazirmatn', serif;
  font-weight: 600;
  font-size: clamp(2rem, 4.5vh, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 30px rgba(0,0,0,0.4);
}
.art__quote { margin: 0; max-width: 24rem; font-size: 0.84rem; line-height: 1.85; color: rgba(255,255,255,0.82); }

/* ── Form panel ── */
.auth__form {
  position: relative;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding: clamp(1.5rem, 3vh, 2.75rem) clamp(1.5rem, 4vw, 3.5rem);
  overflow-y: auto;
  color: var(--ink);
}

.auth__brand {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  margin-bottom: clamp(1.25rem, 4vh, 2.75rem);
}
.auth__brand img { width: 2rem; height: 2rem; }
.auth__brand span { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; color: var(--ink); }
.auth__brand span b { color: #2563eb; font-weight: 800; }

.auth__head { text-align: center; margin-bottom: clamp(1.1rem, 3vh, 1.85rem); }
.auth__title {
  margin: 0 0 0.5rem;
  font-family: 'Playfair Display', 'Vazirmatn', serif;
  font-weight: 600;
  font-size: clamp(1.7rem, 4vh, 2.4rem);
  letter-spacing: -0.01em; color: var(--ink);
}
.auth__subtitle { margin: 0; font-size: clamp(0.78rem, 1.6vh, 0.88rem); color: var(--muted); }

.login-form { display: flex; flex-direction: column; gap: clamp(0.7rem, 1.7vh, 1.05rem); }

.field-label { display: block; font-size: 0.8rem; font-weight: 600; color: #3a3a45; margin-bottom: 0.4rem; }

/* role selector — compact light pills */
.auth .role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
@media (max-width: 460px) { .auth .role-grid { grid-template-columns: repeat(2, 1fr); } }
.auth .role-card {
  position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 0.4rem; border-radius: 0.65rem;
  border: 1px solid var(--line); background: #fff; text-align: center;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
}
.auth .role-card i { font-size: 0.8rem; color: var(--muted); transition: color 0.18s; }
.auth .role-card__label { font-size: 0.72rem; font-weight: 600; color: #50505c; transition: color 0.18s; }
.auth .role-card:hover:not(.role-card--active) { border-color: #c8c8d4; background: #fafafc; }
.auth .role-card--active,
.auth .role-card--active:hover {
  border-color: var(--ink); background: var(--ink);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,0.5);
}
.auth .role-card--active i,
.auth .role-card--active:hover i,
.auth .role-card--active .role-card__label,
.auth .role-card--active:hover .role-card__label { color: #fff; }

/* fields */
.glass-field { display: block; }
.glass-field label { display: block; font-size: 0.8rem; font-weight: 600; color: #3a3a45; margin-bottom: 0.4rem; }
.glass-field__row {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--field-bg); border: 1px solid var(--line); border-radius: 0.7rem;
  padding: 0 0.85rem; transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.glass-field--focus .glass-field__row {
  border-color: var(--ink); background: #fff; box-shadow: 0 0 0 3px rgba(15,15,25,0.08);
}
.glass-field__icon { color: #b4b4c0; font-size: 0.85rem; flex-shrink: 0; }
.glass-input {
  flex: 1; min-width: 0; width: 100%; background: transparent; border: none; outline: none;
  padding: 0.72rem 0; font-family: inherit; font-size: 0.88rem; color: var(--ink);
}
.glass-input::placeholder { color: #b0b0bc; }
.ltr-input { direction: ltr; text-align: left; }
.glass-field__toggle {
  flex-shrink: 0; display: grid; place-items: center; width: 1.7rem; height: 1.7rem;
  border: none; background: transparent; color: #9a9aa6; cursor: pointer; border-radius: 0.4rem;
  transition: color 0.18s, background 0.18s;
}
.glass-field__toggle:hover { color: var(--ink); background: rgba(0,0,0,0.05); }

/* options row */
.auth__options { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.remember { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; font-size: 0.78rem; color: #50505c; user-select: none; }
.remember input { position: absolute; opacity: 0; pointer-events: none; }
.remember__box {
  width: 1.05rem; height: 1.05rem; border-radius: 0.3rem; border: 1.5px solid #c4c4d0;
  display: grid; place-items: center; font-size: 0.6rem; color: #fff; background: #fff; transition: background 0.18s, border-color 0.18s;
}
.remember__box i { opacity: 0; transition: opacity 0.15s; }
.remember input:checked + .remember__box { background: var(--ink); border-color: var(--ink); }
.remember input:checked + .remember__box i { opacity: 1; }
.forgot-link { font-size: 0.78rem; font-weight: 600; color: var(--ink); text-decoration: none; transition: opacity 0.18s; }
.forgot-link:hover { opacity: 0.6; }

/* error */
.login-error {
  display: flex; align-items: center; gap: 0.5rem;
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 0.6rem; padding: 0.55rem 0.75rem; font-size: 0.78rem; animation: shake 0.4s ease;
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }

/* actions */
.login-actions { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.2rem; }
.auth__submit {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.85rem 1.25rem; border: none; border-radius: 0.7rem;
  font-family: inherit; font-size: 0.9rem; font-weight: 700; color: #fff; cursor: pointer;
  background: var(--ink); transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,0.6);
}
.auth__submit:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(0,0,0,0.7); }
.auth__submit:active { transform: translateY(0); }
.auth__submit.is-loading .auth__submit-label { opacity: 0; }
.auth__submit.is-loading::before {
  content: ''; position: absolute; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.auth__alt {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; padding: 0.8rem 1.25rem; border-radius: 0.7rem;
  border: 1px solid var(--line); background: #fff;
  font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink); cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.auth__alt:hover { background: #fafafc; border-color: #c8c8d4; }

.demo-hint { margin: 0.5rem 0 0; text-align: center; font-size: 0.74rem; color: #6b7280; direction: ltr; font-weight: 600; }
.demo-hint::before { content: '🔑 '; }

.auth__signup { margin-top: auto; padding-top: 1.1rem; text-align: center; font-size: 0.8rem; color: var(--muted); }
.auth__signup a { color: var(--ink); font-weight: 700; text-decoration: none; }
.auth__signup a:hover { text-decoration: underline; }

/* staggered entrance */
.login-form > * { opacity: 0; transform: translateY(10px); animation: fieldIn 0.55s cubic-bezier(0.22,1,0.36,1) forwards; }
.login-form > *:nth-child(1) { animation-delay: 0.1s; }
.login-form > *:nth-child(2) { animation-delay: 0.17s; }
.login-form > *:nth-child(3) { animation-delay: 0.24s; }
.login-form > *:nth-child(4) { animation-delay: 0.31s; }
.login-form > *:nth-child(5) { animation-delay: 0.38s; }
.login-form > *:nth-child(6) { animation-delay: 0.45s; }
@keyframes fieldIn { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .auth__card, .auth__art-img, .auth__peek-ribbon, .login-form > * { animation: none !important; opacity: 1 !important; transform: none !important; }
}
