* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: #3c4958;
}

/* === Background === */
.background {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url(/static/img/bg.jpg);
  background-size: cover;
  z-index: -1;
}

/* === Wrapper === */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
  
}

/* === Card === */
.login-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 500px;
  padding: 50px 45px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo {
  height: 80px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: #3c4958;
}

/* === Inputs === */
label {
  display: block;
  font-size: 14px;
  margin-top: 14px;
  margin-bottom: 5px;
  color: #3c4958;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #d1d5db;
  border-radius: 5px;
  font-family: inherit;
  font-size: 14px;
  color: #3c4958;
  transition: border-color .15s;
  background: #fff;
}

input:focus {
  border-color: #635bff;
  outline: none;
}

input.btn-login {
  margin-bottom: 12px;
}

/* === Password wrapper (input + toggle) === */
.input-pwd-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-pwd-wrapper input {
  padding-right: 42px;
}

.toggle-pwd {
  position: absolute;
  right: 10px;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
}

.toggle-pwd:hover {
  color: #635bff !important;
  background: transparent !important;
}

/* === Password line (label + forgot) === */
.password-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  margin-bottom: 5px;
}

.forgot-line {
  text-align: right;
  margin-top: 6px;
}

.forgot-link {
  font-size: 13px;
  color: #635bff;
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* === Buttons === */
button,
.btn-primary {
  display: block;
  width: 100%;
  padding: 13px;
  background: #635bff;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  margin-top: 22px;
  cursor: pointer;
  transition: background-color .15s;
  text-align: center;
  text-decoration: none;
}

button:hover,
.btn-primary:hover {
  background: #5146ff;
}

button:disabled,
.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* === TOTP enrollment === */
.totp-qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 16px 0 12px;
}

.totp-qr-wrapper img {
  border-radius: 8px;
  border: 1px solid #e4e7ec;
}

.totp-secret-line {
  text-align: center;
  word-break: break-all;
}

.totp-secret-line code {
  font-family: monospace;
  font-size: .85rem;
  background: #f4f6fa;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .08em;
  user-select: all;
}

/* === OTP digit boxes === */
.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 40px;
}

.otp-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 22px !important;
  font-weight: 600;
  border: 1.5px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #3c4958;
  caret-color: transparent;
  transition: border-color .15s, box-shadow .15s;
  padding: 0;
}

.otp-digit:focus {
  outline: none;
  border-color: #6c5fff;
  box-shadow: 0 0 0 3px rgba(108, 95, 255, .15);
}

.otp-digit:not(:placeholder-shown) {
  border-color: #6c5fff;
}

/* === Button spinner === */
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* === Separator === */
.separator {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: #6b7280;
  font-size: 13px;
}

.separator::before,
.separator::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
}

.separator:not(:empty)::before { margin-right: .75em; }
.separator:not(:empty)::after  { margin-left: .75em; }

/* === Social / SSO button === */
.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff !important;
  color: #3c4958 !important;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  margin-top: 0;
  transition: background-color .15s, border-color .15s;
  cursor: pointer;
}

.social-btn:hover {
  background: #f9fafb !important;
  border-color: #cdd3da;
}

/* === Error / Success box === */
.reason-box {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  text-align: center;
}

.error-box {
  background: #fdecea;
  color: #b91c1c;
  border: 1px solid #f5c2c7;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  text-align: center;
}

.success-box {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 5px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 14px;
  text-align: center;
}

/* === Footer === */
.footer-text {
  text-align: center;
  margin-top: 25px;
  font-size: 13px;
  color: #6b7280;
}

.footer-text a {
  color: #635bff;
  text-decoration: none;
}

.footer-text a:hover {
  text-decoration: underline;
}

/* === 2FA — method tabs === */
.method-tabs {
  display: flex;
  gap: 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: #fff !important;
  color: #6b7280 !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.tab-btn.active {
  background: #635bff !important;
  color: #fff !important;
}

.tab-btn:hover:not(.active) {
  background: #f3f4f6 !important;
}

/* === 2FA — code input === */
.twofa-panel { }

.twofa-hint {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}

.code-input-wrapper input {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 12px;
  text-align: center;
  padding: 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
}

.code-input-wrapper input:focus {
  border-color: #635bff;
}

/* === link-btn === */
.link-btn {
  display: inline !important;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  color: #635bff !important;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  background: transparent !important;
  color: #5146ff !important;
}

/* === Password rules checklist === */
.pwd-rules {
  list-style: none;
  padding: 8px 0 4px;
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pwd-rules li::before {
  content: "✗ ";
  color: #ef4444;
}
.pwd-rules li.rule-ok::before {
  content: "✓ ";
  color: #22c55e;
}
.pwd-rules li.rule-ok {
  color: #22c55e;
}

/* === Password strength === */
.pwd-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwd-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  overflow: hidden;
  position: relative;
}

.pwd-strength-bar::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 2px;
  transition: width .3s, background .3s;
  width: var(--strength-width, 0%);
  background: var(--strength-color, #e5e7eb);
}

#pwdStrengthLabel {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

/* === Copyright footer === */
.login-copyright {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

/* === Responsive === */
@media(max-width:520px) {
  .login-card {
    padding: 40px 25px;
  }
  .code-input-wrapper input {
    font-size: 22px;
    letter-spacing: 8px;
  }
}
