:root {
  --primary: #064f28;
  --primary-dark: #022c15;
  --deep: #011c0d;
  --accent: #86efac;
  --accent-soft: rgba(134, 239, 172, 0.18);
  --text: #e0e7ff;
  --text-muted: rgba(224, 231, 255, 0.65);
  --glass: rgba(6, 79, 40, 0.45);
  --glass-border: rgba(134, 239, 172, 0.25);
  --radius: 14px;
  --danger: #f87171;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(145deg, var(--deep), var(--primary-dark));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 20px;
}

/* Full-screen background video */
.bg-wrap {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.bg-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dark readability overlay (darker on the right where the card sits) */
.bg-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(1, 28, 13, 0.30) 0%, rgba(1, 28, 13, 0.25) 55%, rgba(1, 28, 13, 0.82) 100%);
  pointer-events: none;
}

/* Side image, left side, vertically centered */
.side-img {
  position: fixed;
  left: calc(clamp(16px, 5vw, 90px) * 4);
  top: 50%;
  transform: translateY(-50%);
  max-height: 100vh;
  max-width: 45vw;
  height: auto;
  width: auto;
  object-fit: contain;
  z-index: 0;
  pointer-events: none;
}

/* Top-left logo */
.top-logo {
  position: fixed;
  top: clamp(16px, 2.5vw, 32px);
  left: clamp(16px, 5vw, 90px);
  max-height: 64px;
  max-width: 220px;
  height: auto;
  width: auto;
  object-fit: contain;
  z-index: 1;
  pointer-events: none;
}

.login-container {
  width: 100%;
  max-width: 360px;
  position: relative;
  z-index: 1;
  margin-right: clamp(16px, 5vw, 90px);
}

/* Card */
.login-card {
  background: rgba(1, 28, 13, 0.35);
  border: 1px solid rgba(134, 239, 172, 0.25);
  border-radius: var(--radius);
  padding: 1.8rem 1.5rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* Logo */
.logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: #ffffff;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--deep);
  margin-bottom: 0.7rem;
}

.logo-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.logo-text span {
  color: var(--accent);
}

.logo-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 4px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* Form */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.input-wrapper {
  position: relative;
}

.input-wrapper i.left-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 2.5rem;
  background: rgba(1, 28, 13, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: all 0.25s ease;
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  border-color: var(--accent);
  background: rgba(1, 28, 13, 0.78);
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.15);
}

/* Password toggle */
.toggle-password {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  z-index: 2;
}

.toggle-password:hover {
  color: var(--accent);
}

/* Two-step login: locked phone row + Change button */
.input-wrapper.locked-row input[readonly] {
  background: rgba(1, 28, 13, 0.45);
  border-color: var(--glass-border);
  padding-right: 5.2rem; /* room for the Change button */
  color: var(--text);
  cursor: default;
}

.input-wrapper.locked-row input[readonly]:focus {
  border-color: var(--glass-border);
  box-shadow: none;
  background: rgba(1, 28, 13, 0.45);
}

.change-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  z-index: 2;
}

.change-btn:hover {
  text-decoration: underline;
}

/* Options */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.4rem;
  font-size: 0.8rem;
}

.forgot {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

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

/* Button */
.login-btn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--primary), #0a7a3c);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  background: linear-gradient(135deg, #0a7a3c, var(--accent));
  color: var(--deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(134, 239, 172, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Error alert */
.error-msg {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1.2rem;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.4;
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 1.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ========== First-Time Password Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.8rem 1.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(14px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 1.4rem;
}

.modal-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1.2rem;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.4;
}

.password-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -0.3rem 0 1.2rem;
  line-height: 1.45;
}

/* ========== Forgot Password Modal ========== */
.forgot-modal,
.twofa-modal {
  position: relative;
  max-width: 400px;
  padding-top: 2.4rem;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: rgba(1, 28, 13, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.modal-close:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}

/* Step progress */
.fp-progress {
  margin-bottom: 1.5rem;
}

.fp-progress-track {
  height: 6px;
  background: rgba(134, 239, 172, 0.15);
  border-radius: 9999px;
  overflow: hidden;
}

.fp-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.fp-progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.fp-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  transition: color 0.25s ease;
}

.fp-label.active {
  color: var(--accent);
  font-weight: 600;
}

.fp-label.done {
  color: var(--accent);
}

/* OTP digit inputs */
.otp-inputs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 1.2rem;
}

.otp-digit {
  width: 46px;
  height: 52px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  background: rgba(1, 28, 13, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  outline: none;
  transition: all 0.2s ease;
}

.otp-digit:focus {
  border-color: var(--accent);
  background: rgba(1, 28, 13, 0.78);
  box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.18);
}

.otp-digit:disabled {
  opacity: 0.5;
}

/* Resend row */
.resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 1.2rem;
  min-height: 22px;
}

.resend-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease;
}

.resend-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.resend-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.countdown {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  border: 1px solid var(--glass-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    justify-content: center;
  }

  .login-container {
    margin-right: 0;
    max-width: 380px;
  }

  .side-img {
    display: none;
  }

  .top-logo {
    display: none;
  }
}

@media (max-width: 400px) {
  .login-card {
    padding: 1.6rem 1.3rem;
  }

  .otp-digit {
    width: 40px;
    height: 46px;
  }

  .otp-inputs {
    gap: 7px;
  }
}
