/**
 * Shared auth styles for login and forgot-password (logihub_auth).
 * Use auth-* prefix for all classes.
 */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #1A56FF;
  --blue-dk: #1140CC;
  --blue-glow: rgba(26, 86, 255, .18);
  --g50: #F9FAFB;
  --g200: #E5E7EB;
  --g400: #9CA3AF;
  --g500: #6B7280;
  --g700: #374151;
  --g900: #111827;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Page loader ── */
#pageLoader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: opacity .5s ease, visibility .5s ease;
}

#pageLoader.hide {
  opacity: 0;
  visibility: hidden;
}

.auth-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(26, 86, 255, .18);
  border-top-color: var(--blue);
  border-right-color: rgba(96, 165, 250, .6);
  animation: auth-spin .9s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ── Background ── */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('../images/login_bg.gif') center/cover no-repeat;
}

.auth-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(4, 8, 22, .88) 0%, rgba(6, 14, 38, .70) 55%, rgba(4, 8, 22, .88) 100%);
}

/* ── Page ── */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ── Card ── */
.auth-card {
  background: #fff;
  width: 100%;
  max-width: 430px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04);
  animation: auth-cardIn .6s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: .1s;
  opacity: 0;
}

@keyframes auth-cardIn {
  from { opacity: 0; transform: translateY(26px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-stripe {
  height: 3px;
  background: var(--blue);
}

.auth-body {
  padding: 36px 40px 40px;
}

/* ── Back link ── */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--g500);
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 18px;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: color .15s;
}

.auth-back:hover {
  color: var(--blue);
}

.auth-back i {
  font-size: 11px;
}

/* ── Title ── */
.auth-ttl {
  margin-bottom: 26px;
}

.auth-ttl h1 {
  font-family: 'Syne', sans-serif;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--g900);
  line-height: 1.2;
}

.auth-ttl h1 .ac {
  color: var(--blue);
}

.auth-ttl p {
  margin-top: 7px;
  font-size: 13.5px;
  color: var(--g500);
  line-height: 1.5;
}

/* ── Messages (error / success) ── */
.auth-msg {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.45;
}

.auth-msg.success {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.auth-msg.error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
}

.auth-msg.error i {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 12px;
}

/* ── Field ── */
.auth-field {
  margin-bottom: 15px;
}

.auth-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--g700);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.auth-iw {
  position: relative;
}

.auth-iw input {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 13px;
  border: 1.5px solid var(--g200);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--g900);
  background: var(--g50);
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
  -webkit-appearance: none;
}

.auth-iw input:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.auth-iw input.bad {
  border-color: #EF4444;
  background: #FEF2F2;
}

.auth-iw input::placeholder {
  color: var(--g400);
}

.auth-iico {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--g400);
  font-size: 13px;
  pointer-events: none;
}

.auth-itog {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--g400);
  font-size: 13px;
  transition: color .15s;
}

.auth-itog:hover {
  color: var(--g700);
}

.auth-ferr {
  font-size: 12px;
  color: #DC2626;
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 4px;
}

.auth-ferr.show {
  display: flex;
}

/* ── Meta row (remember me, forgot link) ── */
.auth-mrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.auth-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--g500);
  cursor: pointer;
  user-select: none;
}

.auth-chk input {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  accent-color: var(--blue);
  cursor: pointer;
}

.auth-fgt {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

.auth-fgt:hover {
  text-decoration: underline;
}

/* ── Email/identifier preview (login step 2) ── */
.auth-eprev {
  background: var(--g50);
  border: 1px solid var(--g200);
  border-radius: 6px;
  padding: 9px 13px;
  margin-bottom: 18px;
  font-size: 13.5px;
  color: var(--g700);
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-eprev i {
  color: var(--g400);
  font-size: 12px;
}

/* ── Last used profile (login step 1) ── */
.auth-last-used {
  display: none;
  margin-bottom: 16px;
}

.auth-last-used.show {
  display: block;
}

.auth-last-used-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--g500);
  margin-bottom: 6px;
}

.auth-last-used-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--g200);
  border-radius: 10px;
  background: var(--g50);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  transition: background .2s, border-color .2s;
}

.auth-last-used-profile:hover {
  background: #EEF3FF;
  border-color: var(--blue);
}

.auth-last-used-profile:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-glow);
}

.auth-last-used-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.auth-last-used-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--g900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-sign-another {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--g500);
  cursor: pointer;
  transition: color .15s;
}

.auth-sign-another:hover {
  color: var(--blue);
  text-decoration: underline;
}

/* ── Step dots (login) ── */
.auth-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.auth-d {
  height: 4px;
  border-radius: 2px;
  background: var(--g200);
  transition: width .4s cubic-bezier(.22, 1, .36, 1), background .3s;
}

.auth-d.on {
  background: var(--blue);
  width: 28px !important;
}

.auth-d:not(.on) {
  width: 12px;
}

/* ── Top row (logo + role pill) ── */
.auth-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.auth-logo-wrap {
  height: 38px;
  display: flex;
  align-items: center;
}

.auth-logo-wrap img {
  height: 38px;
  width: auto;
  max-width: 170px;
  object-fit: contain;
  display: block;
}

.auth-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--g500);
  border: 1.5px solid var(--g200);
  padding: 6px 13px;
  border-radius: 100px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}

.auth-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #EEF3FF;
}

.auth-pill i {
  font-size: 10px;
}

/* ── Button ── */
.auth-btn {
  position: relative;
  width: 100%;
  height: 48px;
  background: var(--blue);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s, transform .1s, box-shadow .2s;
  box-shadow: 0 2px 10px rgba(26, 86, 255, .28);
  letter-spacing: .01em;
  overflow: hidden;
  margin-top: 0;
}

.auth-btn + .auth-btn {
  margin-top: 8px;
}

.auth-btn:hover:not(:disabled) {
  background: var(--blue-dk);
  box-shadow: 0 4px 18px rgba(26, 86, 255, .38);
}

.auth-btn:active:not(:disabled) {
  transform: scale(.985);
}

.auth-btn:disabled {
  opacity: .75;
  cursor: not-allowed;
}

.auth-btn i.arr {
  font-size: 13px;
}

.auth-btn-spin {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  animation: auth-bspin .7s linear infinite;
}

@keyframes auth-bspin {
  to { transform: rotate(360deg); }
}

.auth-btn.loading .auth-btn-label {
  display: none;
}

.auth-btn.loading .auth-btn-spin {
  display: block;
}

.auth-btn.loading .arr {
  display: none;
}

/* Forgot-password: button as link (Return to sign in) */
a.auth-btn {
  text-decoration: none;
  box-sizing: border-box;
  margin-top: 8px;
}

/* ── Section (login steps) ── */
.auth-sec.hidden {
  display: none;
}

.auth-sec.si {
  animation: auth-si .35s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes auth-si {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
