/* =========================
   Auth layout
   ========================= */

.ds-auth-wrap{
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 0 36px 0;
}

/* Не даём flex-элементам схлопываться по содержимому */
.ds-auth-wrap > *{
  min-width: 0;
}

.ds-auth-card{
  width: 100%;
  max-width: 520px;
  min-width: 0;
  flex: 0 1 520px;
  box-sizing: border-box;
  padding: 20px;
}

.ds-auth-side{
  width: 100%;
  max-width: 340px;
}

.ds-auth-head{
  margin-bottom: 14px;
}

.ds-auth-title{
  margin: 0 0 6px 0;
  font-weight: 900;
  letter-spacing: .2px;
  font-size: 26px;
}

.ds-auth-sub{
  margin: 0;
}

.ds-auth-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin: 10px 0 14px 0;
}

.ds-auth-link{
  color: var(--brand-primary);
  font-weight: 700;
}
.ds-auth-link:hover{
  color: var(--brand-accent);
  text-decoration: none;
}

.ds-auth-foot{
  margin-top: 12px;
  text-align: center;
}

/* mobile */
@media (max-width: 991px){
  .ds-auth-wrap{
    flex-direction: column;
    align-items: center;
  }
  .ds-auth-side{
    max-width: 520px;
  }
}

/* subtle helper */
.ds-hint{
  font-size: 13px;
  opacity: .8;
  margin-top: 6px;
}

/* field error */
.field-error{ margin-left:8px; font-weight:700; }
.has-error .form-control{ border-color:#a94442; }
.has-success .form-control{ border-color:#3c763d; }

#regMsgBody .alert{ margin:0; }
#regMsgBody{ line-height:1.35; }

/* Убрать рамку/скругление у сообщений внутри модалки регистрации/авторизации */
#modalRegMsg #regMsgBody .alert,
#modalAuthMsg #regMsgBody .alert{
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
}


/* =========================
   Mobile input zoom fix
   iOS Safari zooms page on focus when input font-size < 16px.
   Держим 16px на полях авторизации/регистрации, чтобы страница не "приближалась".
   ========================= */

.ds-auth-card .form-control,
.ds-auth-card select.form-control,
.ds-auth-card textarea.form-control{
  font-size: 16px;
}

/* =========================
   Password input-group fix
   ========================= */

/* растягиваем input-group по высоте и убираем "разрыв" */
.ds-auth-card .input-group{
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

/* все основные обёртки формы всегда во всю ширину */
#authForm,
#termsForm,
#recoverWrap,
#recoverForm,
.ds-auth-card .form-group,
.ds-auth-card .field-error,
.ds-auth-card .ds-hint{
  width: 100%;
  min-width: 0;
}

/* поле пароля в flex-контейнере ДОЛЖНО занимать остаток ширины */
.ds-auth-card .input-group > .form-control{
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  height: 42px;
  border-radius: 12px 0 0 12px;
  border-right: 0;
}

/* контейнер кнопки — фиксированной ширины, без влияния на расчёт всего блока */
.ds-auth-card .input-group-btn{
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  width: auto;
}

/* сама кнопка глаза — на всю высоту инпута */
.ds-auth-card .input-group-btn > .btn.toggle-pass{
  height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 0 12px 12px 0;
  margin: 0;
}

/* убираем "подпрыгивание" и анимации именно у кнопки глаза */
.ds-auth-card .btn.toggle-pass:hover,
.ds-auth-card .btn.toggle-pass:focus{
  transform: none !important;
  animation: none !important;
  box-shadow: none !important;
}

/* чтобы иконка ровно стояла */
.ds-auth-card .btn.toggle-pass i{
  line-height: 1;
}

/* Визуально “пароль”, но input остаётся type="text" */
.pass-field{
  -webkit-text-security: disc; /* Chrome/Edge/Safari */
  letter-spacing: .06em;
}

/* Когда показ пароля включён */
.pass-field.pass-show{
  -webkit-text-security: none;
  letter-spacing: 0;
}

/* =========================
   Terms form (moved inline styles here)
   ========================= */

/* из style="display:none" перенесено сюда */
#termsForm{
  display: none;
}

/* вместо style="margin-top:20px" */
.ds-terms-head{
  margin-top: 20px;
  margin-bottom: 12px;
}

/* вместо style="font-size:22px" */
.ds-terms-title{
  font-size: 22px;
}

/* вместо inline у .ds-terms-box */
.ds-terms-box{
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(255,255,255,.55); /* слегка, чтобы рамка читалась */
}

/* чтобы на тёмной теме рамка была видна */
html.theme-dark .ds-terms-box{
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.04);
}

/* вместо style="margin-bottom:10px" и style="margin:0" */
.ds-terms-p{
  margin-bottom: 10px;
}
.ds-terms-p-last{
  margin: 0;
}

/* вместо style="margin-bottom:14px" */
.ds-terms-agree-group{
  margin-bottom: 14px;
}

/* вместо style="margin-top:6px; display:none" */
#termsErr{
  margin-top: 6px;
  display: none;
}

/* вместо style="margin-top:8px" */
#btnBackToLogin{
  margin-top: 8px;
}

/* =========================
   Checkbox: horizontal alignment
   ========================= */

.ds-auth-check{
  display:flex;
  align-items:center;  /* ВАЖНО: горизонтально по центру строки */
  gap: 10px;
  font-weight: 600;
  user-select:none;
  margin: 0;
  cursor: pointer;
}

/* крупный чекбокс */
.ds-auth-check.ds-check-lg input[type="checkbox"]{
  width: 20px;
  height: 20px;
  margin: 0;          /* убираем вертикальные смещения */
  flex: 0 0 auto;
  box-shadow: none !important;
  outline: none !important;
}

/* текст рядом с чекбоксом */
.ds-auth-check .ds-check-text{
  line-height: 1.35;
  min-width: 0;
}

/* =========================
   Checkboxes (light / dark)
   ========================= */

/* БАЗА */
.ds-auth-check.ds-check-lg input[type="checkbox"]{
  accent-color: rgba(0,0,0,.38);
}

/* Светлая тема: лёгкая рамка и белый фон (если браузер поддерживает appearance) */
@supports (-webkit-appearance: none) or (appearance: none){
  .ds-auth-check.ds-check-lg input[type="checkbox"]{
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid rgba(0,0,0,.22);
    background: rgba(255,255,255,.95);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
  }

  .ds-auth-check.ds-check-lg input[type="checkbox"]:hover{
    border-color: rgba(0,0,0,.30);
    background: #fff;
  }

  .ds-auth-check.ds-check-lg input[type="checkbox"]:focus{
    border-color: rgba(0,0,0,.34);
  }

  /* Отмечен: аккуратная галка и фирменный цвет */
  .ds-auth-check.ds-check-lg input[type="checkbox"]:checked{
    border-color: transparent;
    background: var(--brand-primary);
  }

  .ds-auth-check.ds-check-lg input[type="checkbox"]:checked::after{
    content: "";
    position: relative;
    display: block;
    width: 6px;
    height: 12px;
    left: 6px;
    top: 1px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }

  /* Disabled */
  .ds-auth-check.ds-check-lg input[type="checkbox"]:disabled{
    opacity: .55;
    cursor: not-allowed;
  }
}

/* ТЁМНАЯ ТЕМА — когда включён html.theme-dark */
html.theme-dark .ds-auth-check.ds-check-lg input[type="checkbox"]{
  accent-color: rgba(255,255,255,.70);
}

@supports (-webkit-appearance: none) or (appearance: none){
  html.theme-dark .ds-auth-check.ds-check-lg input[type="checkbox"]{
    border-color: rgba(255,255,255,.28);
    background: rgba(255,255,255,.06);
  }

  html.theme-dark .ds-auth-check.ds-check-lg input[type="checkbox"]:hover{
    border-color: rgba(255,255,255,.38);
    background: rgba(255,255,255,.08);
  }

  html.theme-dark .ds-auth-check.ds-check-lg input[type="checkbox"]:checked{
    background: var(--brand-primary);
  }
}

/* =========================
   Code input (оставил как было)
   ========================= */

.ds-code{
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
  font-weight: 900;
}

/* hide steps */
.ds-step-pane{ display:none; }
.ds-step-pane.is-active{ display:block; }

/* pass eye button align (fallback) */
.input-group .input-group-btn .btn{
  height: 34px; /* bootstrap 3 input height */
}

/* ===== Register steps ===== */

.ds-stepper{
  display:flex;
  gap:10px;
  margin: 0 0 18px 0;
}

#regStepper,
#recoverStepper{
  display:flex;
  gap:6px;
  margin: 0 0 18px 0;
}

/* СВЕТЛАЯ ТЕМА (по умолчанию) */
#regStepper .ds-step,
#recoverStepper .ds-step{
  flex: 1;
  padding: 6px 9px;
  border-radius: 999px;
  font-weight: 800;
  text-align: center;

  background: rgba(0,0,0,.08);
  border: 1px solid rgba(0,0,0,.14);
  color: rgba(0,0,0,.78) !important;

  opacity: .65;
  display: flex;
  align-items: center;
  justify-content: center;

  text-decoration: none !important;
}

/* hover только для неактивных */
#regStepper .ds-step:not(.is-active):hover,
#recoverStepper .ds-step:not(.is-active):hover{
  opacity: .9;
  background: rgba(0,0,0,.11);
  border-color: rgba(0,0,0,.18);
}

/* АКТИВНЫЙ */
#regStepper .ds-step.is-active,
#recoverStepper .ds-step.is-active{
  opacity: 1;
  background: var(--brand-primary);
  border-color: transparent;
  color: #fff !important;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

/* ТЁМНАЯ ТЕМА */
html.theme-dark #regStepper .ds-step,
html.theme-dark #recoverStepper .ds-step{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.16);
  color: rgba(255,255,255,.80) !important;
  opacity: .70;
}

html.theme-dark #regStepper .ds-step:not(.is-active):hover,
html.theme-dark #recoverStepper .ds-step:not(.is-active):hover {
  opacity: .92;
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.22);
}

html.theme-dark #regStepper .ds-step.is-active,
html.theme-dark #recoverStepper .ds-step.is-active {
  opacity: 1;
  background: var(--brand-primary);
  border-color: transparent;
  color: #fff !important;
}

@media (max-width: 767px){
  #regStepper .ds-step,
  #recoverStepper .ds-step
  {
    padding: 5px 3px;
  }
}

/* =========================
   Recover form (default hidden)
   ========================= */

/* по умолчанию скрыто, открывается только по клику/хэшу */
#recoverWrap{
  display: none;
}

/* переносим inline style="margin-top:10px" у кнопки "Забыли пароль?" */
.ds-auth-recover-link-wrap{
  margin-top: 10px;
}

/* переносим inline style="font-size:22px" у заголовка восстановления */
.ds-auth-recover-title{
  font-size: 22px;
}

/* =========================
   States: hide login header + forgot link
   ========================= */

.ds-auth-card.is-terms  .ds-auth-head--login,
.ds-auth-card.is-terms  .ds-auth-recover-link-wrap{
  display: none !important;
}

.ds-auth-card.is-recover .ds-auth-head--login,
.ds-auth-card.is-recover .ds-auth-recover-link-wrap{
  display: none !important;
}


/* identity hint не должен участвовать в схлопывании карточки */
#identityHint{
  display: block;
  width: 100%;
  min-width: 0;
}

/* mobile: на узких экранах карточка не фиксируется в пикселях */
@media (max-width: 767px){
  .ds-auth-card{
    flex-basis: auto;
    max-width: 100%;
  }
}