/* ==========================================================================
   الشيمي في الرياضيات — صفحات الدخول والتسجيل (شاشة مقسومة)
   ========================================================================== */

body.shm-authBody { background-image: none; }

.shm-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.shm-auth--wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); }

/* ---------- داخل الصفحة بين الهيدر والفوتر ---------- */
.shm-auth--framed {
  width: min(1240px, calc(100% - 32px));
  min-height: 0;
  margin: 26px auto 0;
  border-radius: 30px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.shm-auth--framed .shm-auth__pane { background: var(--surface); padding-block: 10px; }
.shm-auth--framed .shm-auth__body { padding: 40px 0; }
.shm-auth--framed .shm-auth__aside--art picture {
  position: sticky;
  top: 100px;
  height: auto;
}
.shm-auth--framed .shm-auth__aside--art img { height: auto; object-fit: initial; }
.shm-authBody .shm-ftr { margin-top: 40px; }

/* ---------- Form pane ---------- */
.shm-auth__pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px clamp(20px, 5vw, 64px) 22px;
  background: var(--bg);
}
.shm-auth__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shm-auth__topEnd { display: flex; align-items: center; gap: 8px; }
.shm-auth__home {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
}
.shm-auth__home:hover { color: var(--accent); border-color: var(--accent); }

.shm-auth__body {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding: 44px 0;
}
.shm-auth--wide .shm-auth__body { max-width: 640px; }
.shm-auth__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 700;
}
.shm-auth__title { margin: 16px 0 8px; font-size: clamp(30px, 3.6vw, 42px); font-weight: 700; }
.shm-auth__title em { font-style: normal; color: var(--accent); }
.shm-auth__wave { display: inline-block; animation: shmWave 2.4s ease-in-out 1; transform-origin: 70% 70%; }
@keyframes shmWave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } }
.shm-auth__lead { color: var(--ink-mute); font-size: 16px; margin-bottom: 30px; }

/* ---------- Form controls ---------- */
.shm-form { display: grid; gap: 18px; }
.shm-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.shm-form__row { display: flex; justify-content: flex-end; margin-top: -6px; }
.shm-form__forgot { display: flex; justify-content: center; margin-top: -4px; }
.shm-form__forgot .shm-linkBtn { padding: 6px 12px; border-radius: 10px; font-size: 15px; }
.shm-form__forgot .shm-linkBtn:hover { background: var(--accent-soft); text-decoration: none; }
.shm-fieldset {
  margin: 0;
  padding: 20px 18px 18px;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.shm-fieldset__legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.shm-fieldset__legend .shm-math {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
}
.shm-field { display: grid; gap: 7px; min-width: 0; }
.shm-field__label { font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.shm-field__control { position: relative; display: block; }
.shm-field__ico {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  pointer-events: none;
  transition: color .2s ease;
}
.shm-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 46px 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
  -webkit-appearance: none;
  appearance: none;
}
.shm-fieldset .shm-input { background: var(--surface-2); }
select.shm-input {
  padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7c8b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  background-position: left 14px center;
}
.shm-input[dir="ltr"] { text-align: right; }
.shm-input::placeholder { color: var(--ink-mute); opacity: .7; }
.shm-input:hover { border-color: var(--ink-mute); }
.shm-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background-color: var(--surface); }
.shm-field__control:focus-within .shm-field__ico { color: var(--accent); }
.shm-field__eye {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-mute);
}
.shm-field__eye:hover, .shm-field__eye.is-on { color: var(--accent); background: var(--accent-soft); }
.shm-field__control:has(.shm-field__eye) .shm-input { padding-inline-end: 50px; }

.shm-linkBtn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.shm-linkBtn:hover { text-decoration: underline; text-underline-offset: 4px; }

.shm-auth__divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 18px;
  color: var(--ink-mute);
  font-size: 13px;
}
.shm-auth__divider::before, .shm-auth__divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.shm-auth__alts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shm-auth__alt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.shm-auth__alt:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.shm-auth__alt b { display: block; font-size: 15px; }
.shm-auth__alt small { color: var(--ink-mute); font-size: 13px; }
.shm-auth__altIco {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--primary);
}
html[data-theme="dark"] .shm-auth__altIco { color: var(--brand-600); }
.shm-auth__switch { text-align: center; color: var(--ink-mute); font-size: 15px; }
.shm-auth__switch a { color: var(--accent); font-weight: 700; }
.shm-auth__copy { text-align: center; color: var(--ink-mute); font-size: 13px; }

/* ---------- Aside board ---------- */
.shm-auth__aside {
  position: relative;
  overflow: hidden;
  color: #dbe7f1;
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(184, 67, 90, .38), transparent 60%),
    radial-gradient(60% 60% at 0% 100%, rgba(61, 110, 150, .45), transparent 60%),
    linear-gradient(160deg, var(--shm-navy-800), var(--shm-navy-950));
}
.shm-auth__aside--art { background: var(--art-bg-light, var(--shm-navy-900)); transition: background-color .3s ease; }
html[data-theme="dark"] .shm-auth__aside--art { background: var(--art-bg-dark, var(--shm-navy-900)); }
.shm-auth__aside--art .shm-auth__art--dark,
html[data-theme="dark"] .shm-auth__aside--art .shm-auth__art--light { display: none; }
html[data-theme="dark"] .shm-auth__aside--art .shm-auth__art--dark { display: block; }
.shm-auth__aside--art picture {
  position: sticky;
  top: 0;
  display: block;
  height: 100vh;
  height: 100dvh;
}
.shm-auth__aside--art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 50%;
}
.shm-auth__asideGrid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(157, 184, 207, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(157, 184, 207, .08) 1px, transparent 1px);
  background-size: 36px 36px;
}
.shm-auth__asideSym {
  position: absolute;
  inset-inline-start: -30px;
  bottom: -120px;
  font-size: 520px;
  line-height: 1;
  color: rgba(255, 255, 255, .04);
  pointer-events: none;
}
.shm-auth__asideIn {
  position: sticky;
  top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 56px clamp(28px, 5vw, 72px);
}
.shm-auth__asideLogo { width: 120px; height: 150px; }
.shm-auth__asideLogo img { width: 100%; height: 100%; object-fit: contain; }
.shm-auth__asideTitle { color: #fff; font-size: clamp(28px, 3vw, 40px); font-weight: 700; max-width: 520px; }
.shm-auth__asideText { color: rgba(219, 231, 241, .8); font-size: 17px; max-width: 460px; }
.shm-auth__cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; max-width: 420px; }
.shm-auth__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transform: translateX(calc(var(--i) * -18px));
  opacity: 0;
  animation: shmCardIn .6s cubic-bezier(.2, .8, .2, 1) forwards;
  animation-delay: calc(.25s + var(--i) * .12s);
}
@keyframes shmCardIn { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
.shm-auth__cardIco {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(207, 86, 112, .22);
  color: #ffc3cf;
}
.shm-auth__cardBody b { display: block; color: #fff; font-size: 17px; font-weight: 600; }
.shm-auth__cardBody small { color: rgba(219, 231, 241, .7); font-size: 13.5px; }
.shm-auth__asideSign { color: #ffd28a; font-weight: 600; font-size: 14.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .shm-auth, .shm-auth--wide { grid-template-columns: 1fr; }
  .shm-auth__aside { display: none; }
  .shm-auth__aside--art { display: block; order: -1; }
  .shm-auth__aside--art picture,
  .shm-auth--framed .shm-auth__aside--art picture { position: static; height: auto; max-width: 560px; margin-inline: auto; }
  .shm-auth__aside--art img,
  .shm-auth--framed .shm-auth__aside--art img { height: auto; object-fit: initial; }
  .shm-auth__body { padding: 32px 0; }
}
@media (max-width: 560px) {
  .shm-auth--framed { width: calc(100% - 20px); margin-top: 14px; border-radius: 22px; }
  .shm-auth__pane { padding: 14px 16px 18px; }
  .shm-auth__body { padding: 24px 0; }
  .shm-form__grid, .shm-auth__alts { grid-template-columns: 1fr; }
  .shm-fieldset { padding: 16px 14px 14px; }
}
.student-perf-lite .shm-auth__card { animation: none; opacity: 1; transform: none; }
