/* =========================================================
   Login / sign-up – split card layout
   ========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--ts-font, 'Tajawal', sans-serif); }

:root { --page: #ffffff; --card: #ffffff; --field-line: #d1d5db; }
body.page-dark-mode { --page: #080c14; --card: #111827; --field-line: #374151; }

html, body { min-height: 100%; }
body {
  background: var(--page);
  color: var(--ts-ink);
  direction: rtl;
  display: grid;
  place-items: center;
  padding: 24px;
  transition: background 0.3s;
}

.auth-shell {
  width: min(1400px, 100%);
  min-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ---------- picture side ---------- */
.auth-visual {
  order: 2;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.18), transparent 40%),
    linear-gradient(150deg, var(--ts-primary) 0%, var(--ts-primary-dark) 55%, var(--ts-accent) 140%);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.auth-visual::after {
  content: '';
  position: absolute;
  width: 420px;
  height: 420px;
  left: -140px;
  bottom: -160px;
  border-radius: 50%;
  background: var(--ts-accent);
  opacity: 0.85;
}
.auth-home {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  margin: 22px 24px 0;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.auth-home:hover { background: rgba(255, 255, 255, 0.28); }
.auth-visual-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  text-align: center;
}
.auth-kicker { font-weight: 700; opacity: 0.9; font-size: 18px; }
.auth-visual-title { font-family: var(--ts-font-head); font-size: clamp(32px, 3.6vw, 52px); line-height: 1.2; }
.auth-photo {
  margin-top: 20px;
  width: min(300px, 70%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 46% 54% 48% 52% / 55% 45% 55% 45%;
  border: 6px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* ---------- form card ---------- */
.wrapper {
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--ts-line);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  padding: 40px clamp(22px, 5vw, 70px) 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
body.page-dark-mode .wrapper { border-color: #1f2937; box-shadow: none; }

.auth-logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ts-primary), var(--ts-primary-light));
  color: #fff;
  font-family: var(--ts-font-head);
  font-weight: 800;
  font-size: 18px;
  text-decoration: none;
  transform: rotate(-8deg);
  box-shadow: 0 10px 24px rgba(2, 127, 133, 0.3);
}

.title-text { margin-top: 22px; text-align: center; }
.wrapper .title { font-family: var(--ts-font-head); font-size: clamp(20px, 2.2vw, 26px); font-weight: 800; color: var(--ts-ink); }
.wrapper .title.signup { display: none; }
.wrapper:has(#signup:checked) .title.login { display: none; }
.wrapper:has(#signup:checked) .title.signup { display: block; }
.auth-sub { margin-top: 10px; color: var(--ts-muted); font-size: 14px; text-align: center; }

.wrapper .form-container { width: min(520px, 100%); margin-top: 26px; }

/* tabs with a sliding underline */
.wrapper .slide-controls {
  position: relative;
  display: flex;
  border-bottom: 1px solid var(--field-line);
  margin-bottom: 18px;
}
input[type='radio'] { display: none; }
.slide-controls .slide {
  flex: 1;
  padding: 12px 0;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--ts-muted);
  cursor: pointer;
  transition: color 0.3s;
}
.slide-controls .slider-tab {
  position: absolute;
  bottom: -1px;
  right: 0;
  width: 50%;
  height: 3px;
  border-radius: 3px;
  background: var(--ts-primary);
  transition: right 0.4s cubic-bezier(0.68, -0.4, 0.27, 1.4);
}
#signup:checked ~ .slider-tab { right: 50%; }
#login:checked ~ label.login,
#signup:checked ~ label.signup { color: var(--ts-primary); cursor: default; }
body.page-dark-mode #login:checked ~ label.login,
body.page-dark-mode #signup:checked ~ label.signup { color: var(--ts-primary-light); }

/* forms (sign.js switches display + .active) */
.form-container .form-inner {
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-inline-start: 4px;
}
.form-container .form-inner::-webkit-scrollbar { width: 6px; }
.form-container .form-inner::-webkit-scrollbar-thumb { background: var(--ts-primary-light); border-radius: 10px; }
.form-container .form-inner form.signup { display: none; }
form.login, form.signup { opacity: 0; transition: opacity 0.35s ease; }
form.login.active, form.signup.active { opacity: 1; }

.form-inner form .field { margin-top: 14px; }
.form-inner form .field input,
.form-inner form .field select {
  width: 100%;
  height: 52px;
  padding: 0 4px;
  border: none;
  border-bottom: 1.5px solid var(--field-line);
  border-radius: 0;
  background: transparent;
  color: var(--ts-ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.25s;
}
.form-inner form .field select { cursor: pointer; }
.form-inner form .field select option { color: #111827; }
.form-inner form .field input:focus,
.form-inner form .field select:focus { border-bottom-color: var(--ts-primary); }
.form-inner form .field input::placeholder { color: var(--ts-muted); }
.form-inner form .field input:focus::placeholder { color: var(--ts-primary); }

.form-inner form .signup-link { margin-top: 26px; text-align: center; color: var(--ts-muted); font-size: 14px; }
.form-inner form .signup-link a { color: var(--ts-coral); font-weight: 700; text-decoration: none; }
.form-inner form .signup-link a:hover { text-decoration: underline; }

form .btn { position: relative; margin-top: 26px; height: 50px; border-radius: 10px; overflow: hidden; }
form .btn .btn-layer { display: none; }
form .btn input[type='submit'] {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
  background: var(--ts-primary-light);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
form .btn input[type='submit']:hover { background: var(--ts-primary); }

/* success check */
.wrappeer {
  margin-top: 40px;
  width: 200px;
  height: 200px;
  border: 3px solid var(--ts-primary);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--card);
  box-shadow: 0 10px 25px rgba(2, 127, 133, 0.25);
}
.animated-check { height: 100px; width: 100px; }
.animated-check path {
  fill: none;
  stroke: var(--ts-primary);
  stroke-width: 4;
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  animation: draw 1s linear forwards;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.created { margin-top: 10px; padding: 0 16px; text-align: center; color: var(--ts-muted); font-size: 13px; }

/* errors */
.gg-danger {
  color: #dc2626;
  position: relative;
  display: block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid;
  border-radius: 40px;
}
.gg-danger::after,
.gg-danger::before {
  content: '';
  display: block;
  position: absolute;
  left: 6px;
  border-radius: 3px;
  width: 2px;
  background: currentColor;
}
.gg-danger::after { top: 2px; height: 7px; }
.gg-danger::before { height: 2px; bottom: 2px; }
.error { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.error-message { color: #dc2626; font-size: 13px; }
.red { color: #dc2626; }

/* spinner */
.spinner { display: flex; justify-content: center; margin-top: 50px; }
.loader {
  width: 65px;
  aspect-ratio: 1;
  --_c: no-repeat radial-gradient(farthest-side, var(--ts-primary) 92%, #0000);
  background: var(--_c) top, var(--_c) left, var(--_c) right, var(--_c) bottom;
  background-size: 12px 12px;
  animation: l7 1s infinite;
}
@keyframes l7 { to { transform: rotate(.5turn); } }

.hidden { display: none !important; }

@media (max-width: 900px) {
  body { padding: 12px; place-items: start center; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-visual { min-height: 0; order: 0; }
  .auth-visual-inner { padding: 16px 20px 26px; }
  .auth-photo { display: none; }
  .auth-visual-title { font-size: 28px; }
  .wrapper { padding: 30px 20px 24px; }
}
