/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --auth-green:        #3a6644;
  --auth-green-hover:  #2f5237;
  --auth-red:          #c0392b;
  --auth-red-light:    #fdf0ef;
  --auth-green-light:  #edf5f0;
  --auth-border:       #d9d9d9;
  --auth-border-focus: #3a6644;
  --auth-border-error: #c0392b;
  --auth-text:         #1a1a1a;
  --auth-text-muted:   #666666;
  --auth-link:         #3a6644;
  --auth-bg:           #ffffff;
  --auth-radius:       8px;
  --auth-radius-input: 6px;
  --auth-shadow:       0 8px 40px rgba(0,0,0,.18);
  --auth-transition:   .2s ease;
}

/* ─── Magnific Popup base ───────────────────────────────────────────────── */
.mfp-bg {
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 9998;
  overflow: hidden;
  position: fixed;
}
.mfp-wrap {
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 9999;
  position: fixed;
  outline: none !important;
}
.mfp-container {
  text-align: center;
  position: absolute;
  width: 100%; height: 100%;
  left: 0; top: 0;
  padding: 0 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mfp-content {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin: 0 auto;
  text-align: left;
  z-index: 9999;
  width: 100%;
}
.mfp-hide { display: none !important; }
.mfp-preloader { display: none !important; }

/* ─── Magnific overlay ──────────────────────────────────────────────────── */
.mfp-bg.auth-mfp {
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity var(--auth-transition);
}
.mfp-bg.auth-mfp.mfp-ready    { opacity: 1; }
.mfp-bg.auth-mfp.mfp-removing { opacity: 0; }

/* ─── Modal entry / exit animation ─────────────────────────────────────── */
.mfp-wrap.auth-mfp .auth-modal {
  opacity: 0;
  transform: translateY(-10px) scale(.98);
  transition: opacity var(--auth-transition), transform var(--auth-transition);
}
.mfp-wrap.auth-mfp.mfp-ready .auth-modal {
  opacity: 1;
  transform: none;
}
.mfp-wrap.auth-mfp.mfp-removing .auth-modal {
  opacity: 0;
  transform: translateY(-10px) scale(.98);
}

/* ─── Modal box ─────────────────────────────────────────────────────────── */
.auth-modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--auth-bg);
  border-radius: var(--auth-radius);
  box-shadow: var(--auth-shadow);
  padding: 36px 32px 28px;
  box-sizing: border-box;
}

/* ─── Close button ──────────────────────────────────────────────────────── */
.auth-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--auth-text-muted);
  border-radius: 4px;
  transition: color var(--auth-transition), background var(--auth-transition);
  padding: 0;
}
.auth-modal__close:hover {
  color: var(--auth-text);
  background: #f0f0f0;
}

/* ─── Steps ─────────────────────────────────────────────────────────────── */
.auth-step[hidden] { display: none !important; }
.auth-step { display: none; }
.auth-step.is-active { display: block; }
#stepPhone { display: block; }

/* ─── Back link ─────────────────────────────────────────────────────────── */
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--auth-text-muted);
  padding: 0;
  margin-bottom: 14px;
  transition: color var(--auth-transition);
}
.auth-back:hover { color: var(--auth-green); }

/* ─── Typography ────────────────────────────────────────────────────────── */
.auth-modal__title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--auth-text);
  margin: 0 0 10px;
}
.auth-modal__subtitle {
  font-size: 13px;
  color: var(--auth-text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ─── Form ──────────────────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.auth-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-form__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-form__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--auth-text-muted);
}
.auth-form__input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--auth-text);
  background: #fff;
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius-input);
  outline: none;
  transition: border-color var(--auth-transition);
  box-sizing: border-box;
  -webkit-appearance: none;
}
.auth-form__input::placeholder { color: #bdbdbd; }
.auth-form__input:focus         { border-color: var(--auth-border-focus); }
.auth-form__input.is-error      { border-color: var(--auth-border-error); background: var(--auth-red-light); }

.auth-form__error {
  font-size: 12px;
  color: var(--auth-red);
  font-weight: 500;
  line-height: 1.4;
}
.auth-form__error[hidden] { display: none; }

.auth-form__success {
  font-size: 12px;
  color: var(--auth-green);
  font-weight: 500;
  line-height: 1.4;
  background: var(--auth-green-light);
  padding: 8px 12px;
  border-radius: var(--auth-radius-input);
}
.auth-form__success[hidden] { display: none; }

/* ─── Button ────────────────────────────────────────────────────────────── */
.auth-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--auth-radius-input);
  cursor: pointer;
  transition: background var(--auth-transition), opacity var(--auth-transition);
  letter-spacing: .01em;
}
.auth-btn--primary           { background: var(--auth-green); color: #fff; margin-top: 6px; }
.auth-btn--primary:hover     { background: var(--auth-green-hover); }
.auth-btn--primary:active    { opacity: .85; }
.auth-btn--primary:disabled  { opacity: .6; cursor: not-allowed; }

/* ─── Footer / links ────────────────────────────────────────────────────── */
.auth-modal__footer {
  text-align: center;
  margin-top: 14px;
}
.auth-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--auth-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  transition: opacity var(--auth-transition);
}
.auth-link:hover           { opacity: .75; }
.auth-link--small          { font-size: 12px; }
.auth-link--muted          { color: var(--auth-text-muted); text-decoration: none; cursor: default; }
.auth-link--muted:not([disabled]) {
  color: var(--auth-link);
  text-decoration: underline;
  cursor: pointer;
}

/* ─── SMS code inputs ───────────────────────────────────────────────────── */
.auth-sms-code {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 4px 0 8px;
}
.auth-sms-code__digit {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--auth-text);
  background: #fff;
  border: 1.5px solid var(--auth-border);
  border-radius: var(--auth-radius-input);
  outline: none;
  transition: border-color var(--auth-transition), background var(--auth-transition);
  -webkit-appearance: none;
  caret-color: transparent;
}
.auth-sms-code__digit:focus     { border-color: var(--auth-border-focus); }
.auth-sms-code__digit.is-filled { border-color: var(--auth-border-focus); }
.auth-sms-code__digit.is-error  {
  border-color: var(--auth-border-error);
  background: var(--auth-red-light);
  color: var(--auth-red);
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 479px) {
  .auth-modal {
    max-width: 100%;
    width: calc(100% - 24px);
    padding: 28px 20px 24px;
  }
  .auth-sms-code__digit {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}
