@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root{
  --green-dark:#0f3d1c;
  --green-mid:#16a34a;
  --green-hover:#15803d;
  --green-light:#dcfce7;
  --red:#dc2626;
  --red-light:#fee2e2;
  --text-dark:#1a1a1a;
  --text-muted:#6b7280;
  --border:#e5e7eb;
}

*{
  box-sizing:border-box;
}

html, body{
  height:100%;
  margin:0;
}

body{
  font-family:'Poppins', Arial, sans-serif;
  background:linear-gradient(160deg, #0f3d1c 0%, #16a34a 100%);
  display:flex;
  justify-content:center;
  align-items:center;
  height:100vh;
  overflow:hidden;
  padding:20px;
}

.login-box{
  background:#ffffff;
  padding:40px 36px;
  width:380px;
  max-width:100%;
  border-radius:18px;
  box-shadow:0 20px 50px rgba(0,0,0,.25);
  text-align:center;
}

.brand-logo{
  width:92px;
  height:92px;
  object-fit:contain;
  display:block;
  margin:0 auto 12px;
}

h1{
  color:var(--green-dark);
  margin:0 0 2px;
  font-size:24px;
  font-weight:700;
  letter-spacing:.3px;
}

h3{
  margin:0 0 26px;
  color:var(--text-muted);
  font-size:14px;
  font-weight:500;
}

.step-sub{
  font-size:13px;
  color:var(--text-muted);
  margin-top:-18px;
  margin-bottom:22px;
}

input{
  width:100%;
  padding:13px 14px;
  margin-bottom:14px;
  font-size:14px;
  font-family:inherit;
  border:1.5px solid var(--border);
  border-radius:10px;
  background:#f9fafb;
  transition:border-color .15s, background .15s;
}

input:focus{
  outline:none;
  border-color:var(--green-mid);
  background:#ffffff;
}

.code-input{
  text-align:center;
  letter-spacing:10px;
  font-size:22px;
  font-weight:700;
}

button{
  width:100%;
  padding:13px;
  background:var(--green-mid);
  color:white;
  border:none;
  border-radius:10px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  margin-top:2px;
  transition:background .15s, transform .1s;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}

button:hover:not(:disabled){
  background:var(--green-hover);
}

button:active:not(:disabled){
  transform:scale(0.98);
}

button:disabled{
  opacity:.75;
  cursor:not-allowed;
}

/* Spinner */
.spinner{
  width:15px;
  height:15px;
  border:2px solid rgba(255,255,255,.4);
  border-top-color:#ffffff;
  border-radius:50%;
  animation:spin .7s linear infinite;
  display:inline-block;
  flex-shrink:0;
}
.spinner.dark{
  border:2px solid rgba(15,61,28,.15);
  border-top-color:var(--green-mid);
}
@keyframes spin{
  to{ transform:rotate(360deg); }
}

.forgot-link{
  display:block;
  text-align:right;
  font-size:12.5px;
  color:var(--green-mid);
  text-decoration:none;
  margin-bottom:8px;
  font-weight:500;
}
.forgot-link:hover{
  text-decoration:underline;
}

.error-text{
  display:none;
  background:var(--red-light);
  color:var(--red);
  font-size:12.5px;
  padding:10px 12px;
  border-radius:8px;
  margin-bottom:14px;
  text-align:left;
}

.step{
  display:none;
}
.step.active{
  display:block;
}

/* Modal overlay */
.modal-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(15,23,17,.55);
  align-items:center;
  justify-content:center;
  z-index:1000;
  padding:20px;
}
.modal-overlay.active{
  display:flex;
}
.modal-card{
  background:#ffffff;
  border-radius:16px;
  padding:32px 28px;
  width:320px;
  max-width:100%;
  text-align:center;
  box-shadow:0 20px 50px rgba(0,0,0,.3);
  font-family:'Poppins', Arial, sans-serif;
}
.modal-icon{
  width:56px;
  height:56px;
  border-radius:50%;
  background:var(--green-light);
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 auto 16px;
}
.modal-icon svg{
  width:26px;
  height:26px;
}
.modal-title{
  font-size:17px;
  font-weight:700;
  margin-bottom:6px;
  color:var(--text-dark);
}
.modal-msg{
  font-size:13.5px;
  color:var(--text-muted);
  margin-bottom:22px;
  line-height:1.5;
}
.modal-btn-row{
  display:flex;
  gap:10px;
}
.modal-btn{
  flex:1;
  padding:12px;
  border:none;
  border-radius:9px;
  font-size:13.5px;
  font-weight:600;
  cursor:pointer;
  transition:background .15s;
}
.modal-btn.cancel{
  background:#f3f4f6;
  color:#374151;
}
.modal-btn.cancel:hover{
  background:#e5e7eb;
}
.modal-btn.confirm{
  background:var(--green-mid);
  color:white;
}
.modal-btn.confirm:hover{
  background:var(--green-hover);
}

/* Transparent modal card — used for loading-only states.
   No white box, just the spinner + text floating over the dimmed
   background so you can still see what's behind it. */
.modal-card.transparent{
  background:transparent;
  box-shadow:none;
  padding:0;
  width:auto;
}
.modal-card.transparent .modal-loading-row{
  color:#ffffff;
  font-size:14px;
  font-weight:500;
}
.modal-card.transparent .spinner.dark{
  border:2px solid rgba(255,255,255,.3);
  border-top-color:#ffffff;
}

/* Loading-only row (no buttons) */
.modal-loading-row{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  color:var(--text-muted);
  font-size:13px;
}

.password-wrapper{
  position:relative;
  width:100%;
}

.password-wrapper input{
  width:100%;
  padding-right:48px;
  margin-bottom:14px;
}

.password-toggle{
  position:absolute;
  top:0;
  bottom:14px; /* offsets the input's own margin-bottom so it centers on the field, not the wrapper */
  right:6px;
  margin:auto 0;
  width:32px;
  height:32px;
  padding:0;
  border:none;
  background:transparent;
  color:#9ca3af;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  border-radius:50%;
  z-index:2;
  transition:background .18s ease, color .18s ease;
}

.password-toggle:hover{
  background:var(--green-light);
  color:var(--green-mid);
}

.password-toggle:focus-visible{
  outline:2px solid var(--green-mid);
  outline-offset:2px;
}

.password-toggle:active{
  transform:scale(0.9);
}

.password-toggle svg{
  width:19px;
  height:19px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
  transition:transform .18s ease, opacity .18s ease;
}

.password-toggle.is-visible{
  color:var(--green-mid);
}

.password-toggle.icon-swap svg{
  animation:eye-pop .28s ease;
}

@keyframes eye-pop{
  0%{ transform:scale(.7); opacity:.3; }
  60%{ transform:scale(1.15); opacity:1; }
  100%{ transform:scale(1); opacity:1; }
}