:root{
  --auth-card-w: 460px;
  --auth-gap: 14px;
  --auth-pad: 18px;
}

/* Keep the auth screen clean (no header/drawer spacing) */
body.theam-auth-page{
  min-height: 100vh;
  background: var(--bg);
}

.auth-top{
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: color-mix(in srgb, var(--header-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-2);
}

.auth-top .auth-brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.auth-top .auth-brand__logo img{
  width: 28px;
  height: 28px;
  border-radius: 9px;
}
.auth-top .auth-brand__name{
  font-size: 14px;
  opacity: 0.95;
}

.auth-main{
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 14px 34px;
}

.auth-shell{
  width: 100%;
  max-width: var(--auth-card-w);
}

.auth-card{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Soft modern glow */
.auth-card:before,
.auth-card:after{
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
  opacity: 0.55;
  filter: blur(18px);
}
.auth-card:before{
  width: 220px;
  height: 220px;
  top: -120px;
  right: -120px;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 55%, transparent), transparent 65%);
}
.auth-card:after{
  width: 240px;
  height: 240px;
  bottom: -140px;
  left: -140px;
  background: radial-gradient(circle, color-mix(in srgb, var(--success) 35%, transparent), transparent 70%);
}

.auth-alert{
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  color: color-mix(in srgb, var(--text) 92%, var(--danger));
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.auth-head{
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
}
.auth-title{
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}
.auth-subtitle{
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-social{
  position: relative;
  z-index: 1;
}
.auth-social__grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.auth-social__btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--btn-bg-2);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
}
.auth-social__btn:active{ transform: scale(0.99); }
.auth-social__btn:hover{ background: var(--btn-bg-3); border-color: var(--border-strong); }

/* Disabled provider buttons remain clickable (to show "unavailable" message) */
.auth-social__btn.is-disabled{
  opacity: 0.65;
  border-style: dashed;
}
.auth-social__btn.is-disabled:hover{
  background: var(--btn-bg-2);
  border-color: var(--border);
}

.auth-social__btn--muted{
  background: var(--btn-bg);
}

.auth-social__ico{
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-social__ico svg{ width: 20px; height: 20px; }

.auth-social__txt{
  font-weight: 650;
  font-size: 13px;
}

.auth-more{
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.auth-more:active{ transform: translateY(1px); }
.auth-more__chev{ opacity: 0.75; display: inline-flex; align-items: center; }
.auth-more__chev svg{ width: 18px; height: 18px; transition: transform 0.18s ease; }
.auth-more.is-open .auth-more__chev svg{ transform: rotate(180deg); }
.auth-more__list{ margin-top: 10px; display: grid; gap: 10px; }

.auth-divider{
  position: relative;
  z-index: 1;
  margin: 16px 0;
  text-align: center;
}
.auth-divider:before{
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-2);
}
.auth-divider span{
  position: relative;
  display: inline-block;
  padding: 0 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.auth-tabs{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.auth-tab{
  width: 100%;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.auth-tab[aria-selected="true"]{
  background: color-mix(in srgb, var(--primary) 18%, var(--btn-bg-2));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border-strong));
}
.auth-tab:disabled{ opacity: 0.5; cursor: not-allowed; }
.auth-tab:active{ transform: scale(0.99); }

.auth-panel{ position: relative; z-index: 1; }

.auth-form{ display: grid; gap: var(--auth-gap); }

.auth-field{ display: grid; gap: 7px; }
.auth-label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 650;
}

.auth-input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input:focus{
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.auth-pass{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.auth-eye{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.auth-eye svg{ width: 20px; height: 20px; }
.auth-eye:active{ transform: scale(0.99); }

.auth-hint{
  margin-top: -4px;
  font-size: 12px;
  color: var(--muted);
}

.auth-submit{
  margin-top: 6px;
  width: 100%;
  padding: 12px 12px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.auth-submit:active{ transform: scale(0.99); }
.auth-submit[disabled]{ opacity: 0.7; cursor: not-allowed; }

.auth-submit__spin{
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: rgba(255,255,255,0.95);
  animation: authspin 0.8s linear infinite;
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

/* RTL: force all content inside the auth card to follow right-to-left layout */
.auth-shell[dir="rtl"] .auth-card{
  direction: rtl;
  text-align: right;
}
.auth-shell[dir="rtl"] .auth-title,
.auth-shell[dir="rtl"] .auth-subtitle,
.auth-shell[dir="rtl"] .auth-label,
.auth-shell[dir="rtl"] .auth-hint,
.auth-shell[dir="rtl"] .auth-foot,
.auth-shell[dir="rtl"] .auth-alert{
  text-align: right;
}
.auth-shell[dir="rtl"] .auth-social__btn,
.auth-shell[dir="rtl"] .auth-more{
  flex-direction: row-reverse;
}
.auth-shell[dir="rtl"] .auth-social__txt{
  text-align: right;
}
.auth-shell[dir="rtl"] .auth-input{
  text-align: right;
  direction: rtl;
  unicode-bidi: plaintext;
}
.auth-shell[dir="rtl"] .auth-submit__spin{
  right: 14px;
  left: auto;
}
@keyframes authspin{ to { transform: translateY(-50%) rotate(360deg); } }

.auth-foot{
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.6;
}


/* Cloudflare Turnstile wrapper (keeps widget centered without affecting the rest of the UI) */
.auth-captcha{
  margin: 10px 0 12px;
  display: flex;
  justify-content: center;
  direction: ltr;
}


@media (min-width: 520px){
  :root{ --auth-pad: 20px; }
  .auth-card{ padding: 22px; }
  .auth-title{ font-size: 24px; }
}
