/* =========================================================
   AUTH (LOGIN) MODAL — additive styles, prefix auth-.
   Opened by any element with the data-auth-open attribute
   (see auth-modal.js). Uses --primary from styles.css.
   ========================================================= */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(26, 26, 26, .68);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.auth-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.auth-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 455px;
  margin: auto;
  background: #fff;
  border-radius: 16px;
  padding: 30px 28px 30px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  transform: translateY(14px);
  transition: transform .2s ease;
}
.auth-modal.is-open .auth-modal__dialog { transform: translateY(0); }

.auth-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  border-radius: 50%;
  color: #8fa3b4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.auth-modal__close:hover { background: #f0f4f7; color: #4a6073; }

.auth-modal__title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 8px 0 20px;
  padding-right: 36px;
}

/* ---------- Floating-label fields ---------- */
.auth-field { position: relative; margin-bottom: 14px; }

.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
  width: 100%;
  height: 52px;
  padding: 20px 14px 4px;
  border: 1px solid #d5dade;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  color: #1a1a1a;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.auth-field label {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: #8a9398;
  pointer-events: none;
  transition: top .15s ease, transform .15s ease, font-size .15s ease;
}
.auth-field label .auth-req { color: #e0522a; margin-left: 4px; }

.auth-field input:focus + label,
.auth-field input:not(:placeholder-shown) + label {
  top: 9px;
  transform: none;
  font-size: 11.5px;
}

.auth-field.has-error input {
  border-color: #d32f2f;
  box-shadow: 0 0 0 1px #d32f2f;
}
.auth-field__error {
  display: none;
  margin: 5px 2px 0;
  font-size: 12px;
  color: #d32f2f;
}
.auth-field.has-error .auth-field__error { display: block; }

/* ---------- Forgot link / buttons / remember ---------- */
.auth-forgot {
  display: inline-block;
  margin: 4px 0 20px;
  font-size: 15px;
  color: #1a1a1a;
  text-decoration: none;
}
.auth-forgot:hover { color: var(--primary); text-decoration: underline; }

.auth-btn {
  display: block;
  width: 100%;
  height: 44px;
  line-height: 40px;
  text-align: center;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.auth-btn--primary {
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
  margin-bottom: 10px;
}
.auth-btn--primary:hover { background: #0d3f4e; border-color: #0d3f4e; color: #fff; }
.auth-btn--outline {
  border: 2px solid var(--primary);
  background: #fff;
  color: var(--primary);
}
.auth-btn--outline:hover { background: #f0f8fa; color: var(--primary); }

.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  user-select: none;
}
.auth-remember input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .auth-modal { padding: 10px; align-items: flex-start; }
  .auth-modal__dialog { padding: 24px 18px 24px; border-radius: 14px; margin-top: 24px; }
  .auth-modal__title { font-size: 21px; margin-bottom: 16px; }
}

/* =========================================================
   REGISTRATION MODAL ("Регистрация") — prefix reg-
   ========================================================= */

.auth-modal__dialog--reg {
  max-width: 580px;
  padding: 0;
  overflow: hidden;
}

/* gray header bar with a square close button */
.reg-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 56px;
  background: #f5f5f5;
}
.reg-head__title {
  margin: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  font-size: 21px;
  font-weight: 600;
  color: #333;
}
.reg-head__close {
  width: 56px;
  flex-shrink: 0;
  border: none;
  background: #ececec;
  color: #444;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.reg-head__close:hover { background: #e0e0e0; }

.reg-body { padding: 24px 28px 28px; }

/* ---------- Plain text fields ---------- */
.reg-field { margin-bottom: 14px; }

.reg-field input[type="text"],
.reg-field input[type="tel"],
.reg-field input[type="email"],
.reg-field input[type="password"] {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid #d5dade;
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  color: #1a1a1a;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.reg-field input::placeholder { color: #8a9398; }
.reg-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.reg-field.has-error input:not([type="checkbox"]) {
  border-color: #d32f2f;
  box-shadow: 0 0 0 1px #d32f2f;
}
.reg-field__error {
  display: none;
  margin: 5px 2px 0;
  font-size: 12px;
  color: #d32f2f;
}
.reg-field.has-error .reg-field__error { display: block; }

/* ---------- Radio groups ---------- */
.reg-group { margin-top: 22px; }
.reg-group + .reg-group { margin-top: 18px; }
.reg-group__title {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}
.reg-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  user-select: none;
}
.reg-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Captcha ---------- */
.reg-field--captcha { margin-top: 22px; }
.reg-captcha-row { display: flex; align-items: center; gap: 18px; }
.reg-field .reg-captcha-row input[type="text"] { width: 120px; flex-shrink: 0; }
.reg-captcha-img {
  width: 150px;
  height: 46px;
  flex-shrink: 0;
  border: 1px solid #1a1a1a;
  background: #fff;
  line-height: 0;
  cursor: pointer;
}
.reg-captcha-img:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.reg-captcha-img svg { display: block; width: 100%; height: 100%; }

/* ---------- Consent / submit / footer ---------- */
.reg-consent {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
}
.reg-consent input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.reg-consent a { color: #1a1a1a; font-weight: 700; text-decoration: none; }
.reg-consent a:hover { color: var(--primary); text-decoration: underline; }

.auth-btn.reg-submit {
  display: inline-block;
  width: auto;
  height: 46px;
  line-height: 42px;
  margin: 6px 0 0;
  padding: 0 30px;
  font-size: 16px;
}

.reg-foot {
  margin-top: 22px;
  font-size: 15px;
  color: #1a1a1a;
}
.reg-foot a {
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px dotted #1a1a1a;
}
.reg-foot a:hover { color: var(--primary); border-bottom-color: var(--primary); }

@media (max-width: 480px) {
  .auth-modal__dialog--reg { margin-top: 24px; padding: 0; }
  .reg-head__title { padding: 0 16px; font-size: 18px; }
  .reg-head__close { width: 50px; }
  .reg-body { padding: 18px 16px 22px; }
  .reg-captcha-row { gap: 12px; }
  .reg-field .reg-captcha-row input[type="text"] { width: 100px; }
  .reg-captcha-img { width: 130px; }
}
