:root {
  --auth-navy: #0f172a;
  --auth-navy-soft: #1e293b;
  --auth-blue: #0369a1;
  --auth-blue-dark: #075985;
  --auth-sky: #e0f2fe;
  --auth-bg: #f8fafc;
  --auth-surface: #ffffff;
  --auth-text: #0f172a;
  --auth-muted: #475569;
  --auth-line: #dbe5ec;
  --auth-error: #b91c1c;
  --auth-success: #047857;
  --auth-ring: #f59e0b;
}

.auth-page {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  overflow-x: clip;
  direction: ltr;
  background:
    radial-gradient(circle at 90% 4%, rgba(14, 165, 233, .13), transparent 29rem),
    linear-gradient(145deg, #f8fafc, #eef8fc);
  color: var(--auth-text);
  font-family: 'Noto Sans Arabic', 'Cairo', system-ui, sans-serif;
}

.auth-page.hidden { display: none; }
.auth-page * { box-sizing: border-box; }
.auth-page a, .auth-page button, .auth-page label, .auth-page select { touch-action: manipulation; }

.auth-topbar {
  direction: rtl;
  width: min(1180px, calc(100% - 32px));
  min-height: 76px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.auth-brand, .auth-home-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--auth-navy);
  text-decoration: none;
  font-weight: 900;
}

.auth-brand { font-size: 21px; }
.auth-brand img { width: 46px; height: 46px; border-radius: 13px; object-fit: cover; }
.auth-home-link { padding: 8px 13px; border: 1px solid var(--auth-line); border-radius: 11px; background: rgba(255,255,255,.78); font-size: 14px; }
.auth-home-link svg { width: 20px; height: 20px; }

.auth-layout {
  direction: rtl;
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 40px;
  display: grid;
  grid-template-columns: minmax(300px, .82fr) minmax(500px, 1.18fr);
  align-items: start;
  gap: 34px;
}

.auth-layout > * { min-width: 0; }

.auth-intro {
  position: sticky;
  top: 24px;
  padding: 38px;
  border-radius: 28px;
  background: var(--auth-navy);
  color: white;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .18);
  overflow: hidden;
}

.auth-intro::after {
  content: '';
  position: absolute;
  width: 260px;
  height: 260px;
  inset: auto auto -130px -100px;
  border-radius: 50%;
  background: rgba(56, 189, 248, .12);
}

.auth-intro-badge { display: inline-flex; padding: 6px 11px; border-radius: 999px; background: rgba(224,242,254,.1); color: #bae6fd; font-size: 13px; font-weight: 800; }
.auth-intro h2 { margin: 18px 0 13px; font-size: clamp(27px, 4vw, 39px); line-height: 1.4; }
.auth-intro > p { color: #cbd5e1; margin: 0; }
.auth-benefits { list-style: none; padding: 0; margin: 27px 0 0; display: grid; gap: 13px; }
.auth-benefits li { position: relative; padding: 12px 44px 12px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.055); color: #e2e8f0; font-size: 14px; }
.auth-benefits li svg { position: absolute; right: 13px; top: 12px; width: 22px; height: 22px; color: #67e8f9; }
.auth-data-note { margin-top: 22px !important; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }

.auth-card {
  background: var(--auth-surface);
  border: 1px solid var(--auth-line);
  border-radius: 28px;
  padding: clamp(24px, 4vw, 42px);
  box-shadow: 0 22px 60px rgba(15, 23, 42, .1);
}

.auth-card-header { text-align: center; margin-bottom: 24px; }
.auth-card-logo { width: 70px; height: 70px; object-fit: cover; border-radius: 20px; box-shadow: 0 12px 30px rgba(15,23,42,.14); }
.auth-card-header h1 { margin: 12px 0 5px; color: var(--auth-navy); font-size: 25px; font-weight: 900; }
.auth-card-header p { margin: 0; color: var(--auth-muted); font-size: 14px; }

.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 23px; border-radius: 13px; background: #f1f5f9; }
.auth-switch button { min-height: 46px; border: 0; border-radius: 10px; background: transparent; color: var(--auth-muted); font: inherit; font-weight: 800; cursor: pointer; transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.auth-switch button[aria-selected="true"] { background: white; color: var(--auth-blue-dark); box-shadow: 0 3px 12px rgba(15,23,42,.09); }

.auth-panel.hidden, .auth-step.hidden, .role-fields.hidden, .password-registration-fields.hidden, .google-profile-badge.hidden { display: none; }
.auth-panel { animation: auth-fade .22s ease-out both; }
@keyframes auth-fade { from { opacity: .25; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.auth-field { margin-bottom: 17px; }
.auth-field label, .auth-field-label { display: block; margin: 0 2px 7px; color: #334155; font-size: 14px; font-weight: 800; }
.auth-required { color: var(--auth-error); }
.auth-field input, .auth-field select, .auth-field textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: white;
  color: var(--auth-text);
  padding: 11px 14px;
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.auth-field textarea { min-height: 94px; resize: vertical; }
.auth-field input:focus, .auth-field select:focus, .auth-field textarea:focus { border-color: var(--auth-blue); box-shadow: 0 0 0 3px rgba(3,105,161,.15); }
.auth-field input[readonly] { background: #f1f5f9; color: #475569; }
.auth-field small { display: block; margin-top: 6px; color: #64748b; font-size: 12px; }
.auth-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-password { position: relative; }
.auth-password input { padding-left: 52px; }
.auth-password-toggle { position: absolute; left: 4px; top: 3px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #64748b; cursor: pointer; }
.auth-password-toggle:hover { background: #f1f5f9; color: var(--auth-navy); }
.auth-password-toggle svg { width: 21px; height: 21px; }

.auth-primary, .auth-secondary, .auth-text-button {
  min-height: 48px;
  border-radius: 11px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, opacity .2s ease, box-shadow .2s ease;
}
.auth-primary { border: 1px solid var(--auth-blue); background: var(--auth-blue); color: white; box-shadow: 0 9px 22px rgba(3,105,161,.2); }
.auth-primary:hover { background: var(--auth-blue-dark); border-color: var(--auth-blue-dark); }
.auth-secondary { border: 1px solid #cbd5e1; background: white; color: var(--auth-navy); }
.auth-secondary:hover { background: #f8fafc; border-color: #94a3b8; }
.auth-text-button { border: 0; background: transparent; color: var(--auth-blue-dark); padding-inline: 8px; }
.auth-primary:disabled, .auth-secondary:disabled { cursor: wait; opacity: .58; box-shadow: none; }
.auth-actions { display: flex; gap: 10px; margin-top: 22px; }
.auth-actions > * { flex: 1; }

.auth-error { padding: 11px 13px; margin: 12px 0; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; color: #991b1b; font-size: 13px; font-weight: 700; }
.auth-error.hidden { display: none; }
.auth-success { padding: 13px; border: 1px solid #a7f3d0; border-radius: 10px; background: #ecfdf5; color: #065f46; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 21px 0; color: #64748b; font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--auth-line); }
.google-button-wrap { min-height: 44px; display: flex; justify-content: center; overflow: hidden; }
.google-button-wrap > div { max-width: 100%; }
.google-button-wrap iframe { max-width: 100% !important; }
.google-status { min-height: 20px; margin: 8px 0 0; color: #64748b; text-align: center; font-size: 12px; }

.auth-progress { margin-bottom: 23px; }
.auth-progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; font-size: 13px; color: #64748b; }
.auth-progress-head strong { color: var(--auth-navy); }
.auth-progress-track { height: 7px; border-radius: 999px; overflow: hidden; background: #e2e8f0; }
.auth-progress-bar { height: 100%; width: 33.333%; border-radius: inherit; background: var(--auth-blue); transition: width .25s ease; }

.role-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.role-option { position: relative; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-option-content { min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 13px 8px; border: 1px solid #cbd5e1; border-radius: 13px; color: #475569; text-align: center; transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease; }
.role-option svg { width: 28px; height: 28px; color: var(--auth-blue); }
.role-option strong { color: var(--auth-navy); font-size: 13px; }
.role-option small { font-size: 10px; line-height: 1.5; }
.role-option input:checked + .role-option-content { border-color: var(--auth-blue); background: #f0f9ff; box-shadow: 0 0 0 2px rgba(3,105,161,.13); }
.role-option input:focus-visible + .role-option-content { outline: 3px solid var(--auth-ring); outline-offset: 3px; }

.auth-step-title { margin: 0 0 17px; color: var(--auth-navy); font-size: 19px; }
.auth-context { margin: 0 0 18px; padding: 12px 14px; border-right: 4px solid var(--auth-blue); border-radius: 9px; background: #f0f9ff; color: #0c4a6e; font-size: 13px; }
.google-profile-badge { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px; border: 1px solid #bae6fd; border-radius: 12px; background: #f0f9ff; }
.google-profile-badge img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.google-profile-badge strong, .google-profile-badge span { display: block; }
.google-profile-badge span { color: #475569; font-size: 12px; direction: ltr; text-align: right; }
.google-link-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.google-link-heading .auth-step-title { margin: 0 0 4px; }
.google-link-heading .auth-context { margin: 0; }
.google-link-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; background: #e0f2fe; color: var(--auth-blue); }
.google-link-icon svg { width: 26px; height: 26px; }
.google-link-profile { margin-bottom: 12px; }
.google-link-profile img:not([src]) { display: none; }
.google-link-explanation { margin-bottom: 18px; }
.google-link-explanation strong { display: block; margin-bottom: 4px; }
.google-link-explanation p { margin: 0; line-height: 1.75; }
.google-link-help { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }

.location-loading { padding: 12px; border-radius: 10px; background: #f8fafc; color: #64748b; text-align: center; font-size: 13px; }
.terms-check { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; color: #475569; font-size: 13px; cursor: pointer; }
.terms-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--auth-blue); flex: none; }
.terms-check a { color: var(--auth-blue-dark); font-weight: 800; }

.auth-footer { direction: rtl; width: min(1180px, calc(100% - 32px)); margin: 0 auto 30px; padding-top: 20px; border-top: 1px solid var(--auth-line); display: flex; justify-content: space-between; gap: 18px; color: #64748b; font-size: 13px; }
.auth-footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.auth-footer a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: #475569; text-decoration: none; font-weight: 700; }
.auth-footer a:hover { color: var(--auth-blue-dark); }

.auth-page :focus-visible { outline: 3px solid var(--auth-ring); outline-offset: 3px; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { position: static; padding: 26px; }
  .auth-benefits { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .auth-intro::after { display: none; }
  .auth-topbar, .auth-layout, .auth-footer { width: calc(100% - 24px); }
  .auth-topbar { min-height: 68px; }
  .auth-brand { font-size: 18px; }
  .auth-brand img { width: 40px; height: 40px; }
  .auth-home-link span { display: none; }
  .auth-layout { margin-top: 8px; gap: 16px; }
  .auth-intro { padding: 21px; border-radius: 19px; }
  .auth-intro h2 { font-size: 25px; margin-block: 13px 8px; }
  .auth-benefits { display: none; }
  .auth-data-note { margin-top: 14px !important; padding-top: 13px; }
  .auth-card { border-radius: 19px; padding: 20px 16px; }
  .auth-card-logo { width: 58px; height: 58px; border-radius: 16px; }
  .auth-grid-2, .role-options { grid-template-columns: 1fr; }
  .role-option-content { min-height: 76px; flex-direction: row; justify-content: flex-start; text-align: right; padding: 11px 14px; }
  .role-option small { margin-right: auto; max-width: 15ch; }
  .auth-actions { flex-direction: column-reverse; }
  .google-link-help { align-items: stretch; flex-direction: column; }
  .auth-footer { flex-direction: column; gap: 3px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .auth-topbar { min-height: 60px; }
  .auth-layout { grid-template-columns: .72fr 1.28fr; margin-top: 6px; }
  .auth-intro { position: static; padding: 20px; }
  .auth-intro h2 { font-size: 23px; }
  .auth-benefits { display: none; }
  .auth-card { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel { animation: none; }
  .auth-page *, .auth-page *::before, .auth-page *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
