/* Auth page wrapper: center box in the page area BELOW the fixed topbar */
.auth-page{
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: 100vw;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(14px, 2.2vh, 24px) 0 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sliding auth box */
#loginSection.login-section{
  position: relative;
  width: 400px;
  height: 450px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: height .18s ease-in-out;
}


/* Slide containers */
#loginSection .form-box{
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

/* REGISTER slide */
#loginSection .form-box.register{
  transform: translateX(430px);
  transition: transform .44s ease;
  transition-delay: 0s;
}
#loginSection.active .form-box.register{
  transform: translateX(0px);
  transition-delay: .66s;
}

/* LOGIN slide */
#loginSection .form-box.login{
  transform: translateX(0px);
  transition: transform .44s ease;
  transition-delay: .66s;
}
#loginSection.active .form-box.login{
  transform: translateX(430px);
  transition-delay: 0s;
}

/* FORGOT slide */
#loginSection .form-box.forgot{
  transform: translateX(430px);
  transition: transform .44s ease;
  transition-delay: 0s;
}
#loginSection.forgot-active .form-box.forgot{
  transform: translateX(0px);
  transition-delay: .66s;
}
#loginSection.forgot-active .form-box.login,
#loginSection.forgot-active .form-box.register{
  transform: translateX(430px);
  transition-delay: 0s;
}

/* RESET slide */
#loginSection .form-box.reset{
  transform: translateX(430px);
  transition: transform .44s ease;
  transition-delay: 0s;
}
#loginSection.reset-active .form-box.reset{
  transform: translateX(0px);
  transition-delay: .66s;
}
#loginSection.reset-active .form-box.login,
#loginSection.reset-active .form-box.register,
#loginSection.reset-active .form-box.forgot{
  transform: translateX(430px);
  transition-delay: 0s;
}

#loginSection.instant .form-box{ transition: none !important; }

/* Typography and inputs */
h2{
  font-size: 2em;
  color: #fff;
  text-align: center;
}
#loginSection .form-box h2{
  text-align: center;
  font-size: 25px;
}

.inputbox{
  position: relative;
  margin: 30px 0;
  width: 310px;
  border-bottom: 2px solid #fff;
}

.inputbox label{
  position: absolute;
  top: 50%;
  left: 5px;
  transform: translateY(-50%);
  color: #fff;
  font-size: 1em;
  pointer-events: none;
  transition: .5s;
}

/* use placeholder-shown instead of :valid */
.inputbox input:focus ~ label,
.inputbox input:not(:placeholder-shown) ~ label{
  top: -5px;
}

.inputbox input{
  width: 100%;
  height: 50px;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none;
  box-shadow: none !important;
  font-size: 1em;
  padding: 0 35px 0 5px;
  color: #fff;
}

.inputbox input::placeholder{
  color: transparent;
}

.inputbox ion-icon{
  position: absolute;
  right: 8px;
  color: #fff;
  font-size: 1.2em;
  top: 20px;
}

.forget{
  margin: -15px 0 15px;
  font-size: .9em;
  color: #fff;
  display: flex;
  justify-content: space-between;
}

.forget label input{ margin-right: 3px; }

.forget label a{
  color: #fff;
  text-decoration: none;
}
.forget label a:hover{ text-decoration: underline; }

.auth-page button,
#loginSection button{
  width: 100%;
  height: 40px;
  border-radius: 40px;
  background: #fff;
  border: none;
  outline: none;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  color: #111;
}


.create-account{
  font-size: .9em;
  color: #fff;
  text-align: center;
  margin: 25px 0 10px;
}

.create-account p a{
  text-decoration: none;
  color: #fff;
  font-weight: 600;
}
.create-account p a:hover{ text-decoration: underline; }

#result,
#forgotResult,
#resetResult,
#loginResult{
  color: red;
  font-weight: 600;
  position: relative;
  z-index: 2;
}

/* Strength bar */
.pw-meter{
  width: 310px;
  margin: 10px 0 6px;
}
.pw-meter-track{
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-bg, rgba(255,255,255,0.18));
  border: 1px solid var(--panel-border, rgba(255,255,255,0.20));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.pw-meter-bar{
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 160ms ease;
}
.pw-weak   { background: rgba(255, 80, 80, 0.85); }
.pw-ok     { background: rgba(255, 170, 0, 0.85); }
.pw-good   { background: rgba(90, 210, 120, 0.85); }
.pw-strong { background: rgba(80, 200, 255, 0.85); }

/* Popup tooltip LEFT of password input with triangle pointing to input */
.pw-hint-pop{
  position: fixed;        /* ✅ now truly viewport-based */
  z-index: 99999;
  width: 280px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px;
  border-radius: 16px;
  box-sizing: border-box;

  background: transparent;
  border: 2px solid var(--glass-border-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));

  color: rgba(255, 255, 255, 0.95);
  font-size: 0.85em;
  line-height: 1.25;

  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  visibility: hidden;

  --arrow-top: 18px;
}

.pw-hint-pop.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* Arrow pointing RIGHT toward the input */
.pw-hint-pop::before{
  content: "";
  position: absolute;
  top: var(--arrow-top, 18px);
  right: -16px;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 14px solid rgba(255, 255, 255, 0.5);
}
.pw-hint-pop::after{
  content: "";
  position: absolute;
  top: calc(var(--arrow-top, 18px) + 2px);
  right: -13px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 11px solid transparent;
}

.pw-hint-title{
  font-size: 0.95em;
  opacity: 0.95;
  margin-bottom: 6px;
}

.pw-hint-list{
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.pw-hint-item{
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 6px 0;
}

.pw-hint-icon{
  width: 18px;
  flex: 0 0 18px;
  font-weight: 700;
  line-height: 1;
  margin-top: 2px;
}

.pw-hint-item.ok  { color: rgba(0, 255, 0, 0.95); }
.pw-hint-item.bad { color: rgba(255, 0, 0, 0.95); }
.pw-hint-item.ok  .pw-hint-icon{ color: rgba(0, 255, 0, 0.95); }
.pw-hint-item.bad .pw-hint-icon{ color: rgba(255, 0, 0, 0.95); }

/* Mini popup for "Passwords do not match" (confirm password field) */
.pw-match-pop{
  position: fixed;
  z-index: 99998;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  border-radius: 14px;
  box-sizing: border-box;

  background: transparent;
  border: 2px solid var(--glass-border-strong);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));

  color: rgba(255, 255, 255, 0.95);
  font-size: 0.85em;
  line-height: 1.25;

  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  visibility: hidden;
}

.pw-match-pop.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;

}

/* Arrow for mismatch popup (default: popup on the RIGHT of input, arrow points LEFT to input) */
.pw-match-pop::before,
.pw-match-pop::after{
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}

/* Arrow on LEFT side (pointing to input on the left) */
.pw-match-pop::before{
  left: -14px;
  border-right: 12px solid rgba(255, 255, 255, 0.50);
}
.pw-match-pop::after{
  left: -11px;
  border-right: 9px solid rgba(0, 0, 0, 0.10);
}

/* When popup flips to the LEFT of input, arrow goes on RIGHT side */
.pw-match-pop.is-left::before{
  left: auto;
  right: -14px;
  border-right: 0;
  border-left: 12px solid rgba(255, 255, 255, 0.50);
}
.pw-match-pop.is-left::after{
  left: auto;
  right: -11px;
  border-right: 0;
  border-left: 9px solid rgba(0, 0, 0, 0.10);
}

.pw-match-icon{
  font-weight: 800;
  margin-right: 8px;
  color: rgba(255, 120, 120, 0.98);
}

/* Message coloring (register/login results) */
.msg-err { color: rgba(255, 120, 120, 0.98) !important; }
.msg-ok  { color: rgba(120, 255, 170, 0.98) !important; }


/* Modal overlay shown on top of the auth box (register success, etc.) */
.auth-modal{
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.auth-modal__card{
  position: relative;
  width: calc(100% - 52px);
  max-width: 380px;
  padding: 20px 20px 18px;
  border-radius: 20px;
  border: 2px solid var(--glass-border-strong);
  background: var(--glass-bg-dark);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 22px 70px rgba(0,0,0,0.45);

  /* entrance */
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  animation: authModalIn 180ms ease forwards;
}

@keyframes authModalIn{
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal.closing .auth-modal__card{
  transform: translateY(6px) scale(0.99);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  animation: none;
}

.auth-modal__close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.95);
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
  padding: 0;
}

.auth-modal__close:hover{
  background: rgba(255,255,255,0.16);
}

.auth-modal__title{
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 8px 0;
  color: rgba(255,255,255,0.96);
  letter-spacing: .2px;
}

.auth-modal__msg{
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255,255,255,0.90);
}

/* --- 2FA modal (login) --- */
.twofa-modal{
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
}

.twofa-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}

.twofa-modal__card{
  position: relative;
  width: min(420px, calc(100% - 28px));
  border-radius: 18px;
  border: 2px solid var(--glass-border-strong);
  background: rgba(0,0,0,0.20);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  padding: 14px 14px;
  color: rgba(255,255,255,0.95);
  transform: translateY(6px);
  transition: transform 160ms ease, opacity 160ms ease;
}

.twofa-modal.closing .twofa-modal__card{
  transform: translateY(6px);
  opacity: 0;
}

.twofa-modal__close{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.95);
  cursor: pointer;
  font-size: 18px;
}

.twofa-modal__title{
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 6px 0;
}

.twofa-modal__msg{
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255,255,255,0.90);
  margin: 0 0 12px 0;
}

.twofa-modal__row{
  display: flex;
  gap: 10px;
  align-items: center;
}

.twofa-modal__input{
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.18);
  color: var(--site-text, rgba(255,255,255,0.92));
  width: 160px;
  letter-spacing: 0.16em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.twofa-modal__btn{
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.92);
  color: rgba(0,0,0,0.90);
  cursor: pointer;
  font-weight: 900;
}

.twofa-modal__btn:disabled{
  opacity: 0.65;
  cursor: default;
}

.twofa-modal__error{
  margin-top: 10px;
  color: rgba(255,170,170,0.98);
  min-height: 18px;
  font-weight: 800;
}


/* --- FIX: mismatch popup arrow (signup + reset) --- */
.pw-match-pop.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* Default: popup on RIGHT of input, arrow on LEFT pointing LEFT */
.pw-match-pop::before{
  content:"";
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  left:-16px;
  width:0;height:0;
  border-top:11px solid transparent;
  border-bottom:11px solid transparent;
  border-right:14px solid var(--glass-border-strong);
}
.pw-match-pop::after{
  content:"";
  position:absolute;
  top:calc(50% + 2px);
  transform:translateY(-50%);
  left:-13px;
  width:0;height:0;
  border-top:9px solid transparent;
  border-bottom:9px solid transparent;
  border-right:11px solid transparent;
}

/* When flipped to LEFT side of input, arrow on RIGHT pointing RIGHT */
.pw-match-pop.is-left::before{
  left:auto;
  right:-16px;
  border-right:0;
  border-left:14px solid var(--glass-border-strong);
}
.pw-match-pop.is-left::after{
  left:auto;
  right:-13px;
  border-right:0;
  border-left:11px solid transparent;
}

/* ---------------------------
   Theme variable hookups
   --------------------------- */
.auth-page{
  color: #fff;
}

.auth-page a{
  color: #fff;
}

.auth-page .muted,
.auth-page small{
  color: var(--site-text-muted);
}

button:hover{
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
}


.auth-page .inputbox input:focus{ border: none !important; outline: none !important; box-shadow: none !important; }
.auth-page .inputbox input:-webkit-autofill,
.auth-page .inputbox input:-webkit-autofill:hover,
.auth-page .inputbox input:-webkit-autofill:focus{ -webkit-text-fill-color:#fff; -webkit-box-shadow: 0 0 0px 1000px transparent inset; transition: background-color 9999s ease-in-out 0s; }
