/* ============================================
   صفحات المصادقة
   ============================================ */

html,
body {
  min-height: 100%;
}

body.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--surface);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(430px, 0.88fr) minmax(520px, 1.12fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-form-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 34px clamp(34px, 5vw, 82px) 28px;
  background: var(--surface);
}

.auth-form-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--gold-500), var(--brand-500), var(--brand-800));
  content: "";
}

.auth-logo-link {
  display: block;
  width: 224px;
  max-width: 100%;
}

.auth-logo-viewport {
  position: relative;
  display: block;
  width: 224px;
  max-width: 100%;
  height: 64px;
  overflow: hidden;
}

.auth-logo-viewport img {
  position: absolute;
  top: -121px;
  left: -40px;
  width: 300px;
  max-width: none;
  height: 300px;
  object-fit: contain;
}

.auth-form-wrap {
  width: min(100%, 480px);
  margin: auto;
  padding: 52px 0 38px;
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--brand-600);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.auth-eyebrow::before {
  width: 24px;
  height: 3px;
  border-radius: 99px;
  background: var(--gold-500);
  content: "";
}

.auth-title {
  margin-bottom: 12px;
  color: var(--brand-900);
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.auth-description {
  max-width: 440px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.85;
}

.auth-form {
  margin-top: 38px;
}

.field-group {
  margin-bottom: 22px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.field-hint {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.input-shell {
  position: relative;
}

.input-shell__icon {
  position: absolute;
  top: 50%;
  right: 17px;
  display: grid;
  width: 22px;
  height: 22px;
  color: var(--text-soft);
  transform: translateY(-50%);
  transition: color var(--transition);
  place-items: center;
  pointer-events: none;
}

.input-shell__icon svg {
  width: 21px;
  height: 21px;
}

.text-input {
  width: 100%;
  height: 58px;
  padding: 0 52px 0 18px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.text-input::placeholder {
  color: #aaa7b8;
  font-weight: 400;
}

.text-input:hover {
  border-color: var(--brand-300);
}

.text-input:focus {
  border-color: var(--brand-500);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.input-shell:focus-within .input-shell__icon {
  color: var(--brand-600);
}

.text-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.field-error {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.field-error.visible {
  display: flex;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  padding: 13px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-800), var(--brand-600));
  box-shadow: var(--shadow-brand);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.primary-button:hover {
  box-shadow: 0 14px 34px rgba(46, 17, 64, 0.4);
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(0);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  filter: none;
}

.primary-button:focus-visible,
.text-link:focus-visible,
.otp-input:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.22);
  outline-offset: 3px;
}

.primary-button svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition);
}

.primary-button:hover svg {
  transform: translateX(-3px);
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  padding: 13px 14px;
  border: 1px solid #ebe7f3;
  border-radius: 12px;
  background: var(--brand-50);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}

.security-note svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--brand-600);
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-soft);
  font-size: 12px;
}

.auth-footer__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.auth-footer__status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-bg);
  content: "";
}

/* اللوحة البصرية */
.auth-showcase {
  position: relative;
  display: flex;
  min-width: 0;
  overflow: hidden;
  padding: clamp(48px, 7vw, 100px);
  background:
    radial-gradient(circle at 15% 15%, rgba(157, 109, 240, 0.3), transparent 28%),
    radial-gradient(circle at 90% 85%, rgba(212, 161, 59, 0.2), transparent 28%),
    linear-gradient(145deg, #190824 0%, var(--brand-800) 48%, #42165f 100%);
  color: #fff;
  isolation: isolate;
}

.auth-showcase::before,
.auth-showcase::after {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.auth-showcase::before {
  top: -180px;
  left: -160px;
  width: 520px;
  height: 520px;
}

.auth-showcase::after {
  right: -260px;
  bottom: -300px;
  width: 720px;
  height: 720px;
}

.showcase-grid {
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.055;
  background-image: linear-gradient(rgba(255,255,255,.8) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.8) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
}

.showcase-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(100%, 650px);
  margin: auto;
}

.showcase-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 9px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.showcase-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-400);
  box-shadow: 0 0 14px var(--gold-400);
}

.showcase-title {
  max-width: 610px;
  margin-top: 26px;
  font-size: clamp(38px, 4.5vw, 64px);
  font-weight: 900;
  line-height: 1.28;
  letter-spacing: -0.04em;
}

.showcase-title span {
  color: var(--gold-400);
}

.showcase-description {
  max-width: 570px;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 17px;
  line-height: 1.9;
}

.showcase-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 42px;
}

.showcase-feature {
  padding: 17px 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
}

.showcase-feature__icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin-bottom: 15px;
  border-radius: 10px;
  background: rgba(224, 184, 98, 0.15);
  color: var(--gold-400);
  place-items: center;
}

.showcase-feature__icon svg {
  width: 19px;
  height: 19px;
}

.showcase-feature strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.showcase-feature span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

/* رمز التحقق */
.otp-recipient {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 25px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}

.otp-recipient__icon {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-100);
  color: var(--brand-600);
  place-items: center;
}

.otp-recipient__icon svg {
  width: 19px;
  height: 19px;
}

.otp-recipient__content {
  min-width: 0;
  flex: 1;
}

.otp-recipient__label {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
}

.otp-recipient__value {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-link {
  padding: 5px;
  border-radius: 7px;
  color: var(--brand-600);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.text-link:hover {
  color: var(--brand-800);
  background: var(--brand-100);
}

.otp-fieldset {
  min-width: 0;
  margin: 34px 0 0;
  padding: 0;
  border: 0;
}

.otp-legend {
  margin-bottom: 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.otp-inputs {
  display: flex;
  direction: ltr;
  justify-content: space-between;
  gap: clamp(6px, 1vw, 10px);
}

.otp-input {
  width: auto;
  min-width: 0;
  max-width: 64px;
  flex: 1;
  aspect-ratio: 1 / 1.05;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface-2);
  color: var(--brand-800);
  font-family: inherit;
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 900;
  text-align: center;
  caret-color: var(--brand-500);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.otp-input:hover {
  border-color: var(--brand-300);
}

.otp-input:focus,
.otp-input.filled {
  border-color: var(--brand-500);
  background: var(--surface);
  box-shadow: 0 7px 18px rgba(91, 36, 131, 0.1);
  transform: translateY(-2px);
}

.otp-inputs.invalid .otp-input {
  border-color: var(--danger);
  animation: otpShake 0.3s ease;
}

.otp-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  margin-top: 17px;
  color: var(--text-muted);
  font-size: 13px;
}

.resend-button {
  padding: 3px 5px;
  border-radius: 6px;
  color: var(--brand-600);
  font: inherit;
  font-weight: 800;
}

.resend-button:disabled {
  cursor: default;
  color: var(--text-soft);
}

.resend-button:not(:disabled):hover {
  background: var(--brand-100);
}

.otp-timer {
  direction: ltr;
  color: var(--brand-600);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@keyframes otpShake {
  25% { transform: translateX(3px); }
  50% { transform: translateX(-3px); }
  75% { transform: translateX(2px); }
}

@media (max-width: 1050px) {
  .auth-shell {
    grid-template-columns: minmax(410px, 0.95fr) 1.05fr;
  }

  .auth-showcase {
    padding: 54px 42px;
  }

  .showcase-features {
    grid-template-columns: 1fr;
  }

  .showcase-feature {
    display: grid;
    grid-template-columns: 36px 1fr;
    column-gap: 12px;
    padding: 13px;
  }

  .showcase-feature__icon {
    grid-row: 1 / 3;
    margin: 0;
  }
}

@media (max-width: 820px) {
  body.auth-page {
    background: var(--brand-900);
  }

  .auth-shell {
    display: flex;
    min-height: 100dvh;
    padding: 20px;
    background:
      radial-gradient(circle at 0 0, rgba(157, 109, 240, 0.3), transparent 35%),
      linear-gradient(145deg, var(--brand-900), var(--brand-800));
  }

  .auth-form-panel {
    width: min(100%, 600px);
    min-height: calc(100dvh - 40px);
    margin: auto;
    padding: 28px clamp(22px, 7vw, 50px) 24px;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  }

  .auth-form-panel::before {
    border-radius: 24px 24px 0 0;
  }

  .auth-showcase {
    display: none;
  }

  .auth-form-wrap {
    padding: 46px 0 38px;
  }
}

@media (max-width: 520px) {
  .auth-shell {
    padding: 0;
  }

  .auth-form-panel {
    min-height: 100dvh;
    padding: 25px 21px 22px;
    border-radius: 0;
  }

  .auth-form-panel::before {
    border-radius: 0;
  }

  .auth-logo-viewport {
    width: 196px;
    height: 55px;
  }

  .auth-logo-viewport img {
    top: -106px;
    left: -35px;
    width: 262px;
    height: 262px;
  }

  .auth-form-wrap {
    padding: 42px 0 30px;
  }

  .auth-title {
    font-size: 32px;
  }

  .auth-description {
    font-size: 14px;
  }

  .auth-form {
    margin-top: 30px;
  }

  .auth-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .otp-inputs {
    gap: 7px;
  }

  .otp-input {
    border-radius: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
