/**
 * Стили для модальных окон авторизации
 */

/* Основные стили модального окна */

.auth-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-profile__left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-avatar__img {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  object-fit: cover;
  display: block;
}

.auth-avatar {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #ebebf5;
  background-color: #fff;
  align-items: center;
  justify-content: center;
}

.auth-avatar__svg {
  width: 20px;
  height: 20px;
  background: url('../images/white-user.svg') center center no-repeat;
  background-size: 20px 20px;
}

.auth-profile__info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.auth-profile__label {
  font-size: 12px;
  font-weight: 500;
  line-height: 120%;
  letter-spacing: 0.01em;
  color: #ed424a;
}

.auth-profile__name {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 180px;
  font-weight: 700;
  font-size: 14px;
  line-height: 120%;
  letter-spacing: 0.01em;
}

.auth-profile__admin-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #666;
  transition: color 0.3s;
  text-decoration: none;
  flex-shrink: 0;
}

.auth-profile__admin-link:hover {
  color: #ed424a;
}

.auth-profile__admin-link svg {
  width: 20px;
  height: 20px;
}

.auth-profile__admin-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background-color: #1e1e1e;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 1000;
}

.auth-profile__admin-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #1e1e1e;
}

.auth-profile__admin-link:hover .auth-profile__admin-tooltip {
  opacity: 1;
  visibility: visible;
}

.auth-profile__logout {
  width: 40px;
  height: 40px;
  background-color: #666;
  transition: background-color 0.3s;
  margin-left: auto;
  flex-shrink: 0;
}

.auth-profile__logout:hover {
  background-color: #ed424a;
}

.auth-profile__logout-icon {
  display: inline-block;
}

.auth-modal {
  max-width: 480px;
  margin: 0 auto;
  background: #f5f5f5;
  border-radius: 40px;
  box-shadow: 0 24px 64px 0 rgba(30, 30, 30, 0.14);
  overflow: hidden;
}

.auth-modal__content {
  padding: 32px 40px 40px 36px;
  background-color: #fff;
  border-radius: 40px;
}

.auth-modal__header {
  margin-bottom: 20px;
}

.auth-modal__header h3 {
  font-size: 24px;
  margin: 0;
  padding: 0;
  color: var(--, #1e1e1e);
  font-family: 'Proxima NovaBold';
  font-size: 42px;
  font-style: normal;
  line-height: 100%;
}

.auth-modal__close {
  position: absolute;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  top: 43px;
  right: 37px;
}

/* Стили форм */

.auth-form__section {
  margin-bottom: 32px;
}

.auth-form__section:last-of-type {
  margin-bottom: 24px;
}

.auth-form__section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e1e1e;
  margin-bottom: 20px;
  margin-top: 0;
  padding: 0;
}

.auth-form__group {
  margin-bottom: 20px;
}

.auth-input-wrapper {
  position: relative;
  height: 60px;
  border: 1px solid #e4e4e4;
  border-radius: 15px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.auth-input-wrapper label {
  position: absolute;
  top: 9px;
  left: 19px;
  color: #1e1e1e;
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  line-height: 120%;
  pointer-events: none;
  z-index: 1;
}

.auth-input-wrapper input[type='text'],
.auth-input-wrapper input[type='email'],
.auth-input-wrapper input[type='password'],
.auth-input-wrapper input[type='tel'] {
  width: 100%;
  height: 100%;
  padding: 0;
  padding-top: 28px;
  padding-left: 19px;
  padding-right: 19px;
  padding-bottom: 10px;
  border: none !important;
  border-radius: 15px;
  background: transparent;
  color: #1e1e1e;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 140%;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  position: relative;
  top: 0;
  left: 0;
}

.password-wrap .auth-input-wrapper input[type='text'],
.password-wrap .auth-input-wrapper input[type='password'] {
  padding-right: 50px;
}

/* Стили для полей с inputmask */
.auth-input-wrapper input[type='tel'].inputmask,
.auth-input-wrapper input[type='tel'] {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Убираем стили, которые может добавлять inputmask */
.auth-input-wrapper .inputmask {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  background: transparent !important;
}

/* Стили для обертки inputmask, если она создается */
.auth-input-wrapper .inputmask-wrapper,
.auth-input-wrapper .inputmask-outer {
  border: none !important;
  background: transparent !important;
  position: static !important;
}

.auth-input-wrapper input[type='text']:focus,
.auth-input-wrapper input[type='email']:focus,
.auth-input-wrapper input[type='password']:focus,
.auth-input-wrapper input[type='tel']:focus {
  outline: none;
  border: none !important;
}

/* Фокус на обертке - убираем красную рамку */
.auth-input-wrapper:focus-within {
  border-color: #e4e4e4;
}

.auth-input-wrapper input[type='text']::placeholder,
.auth-input-wrapper input[type='email']::placeholder,
.auth-input-wrapper input[type='password']::placeholder,
.auth-input-wrapper input[type='tel']::placeholder {
  color: #bfbfbf;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 140%;
}

/* Стили для чекбокса */
.auth-form__group--checkbox {
  margin-bottom: 20px;
}

.auth-form__group--checkbox[style*='display: none'] {
  display: none !important;
}

.auth-form__group--checkbox:not([style*='display: none']) {
  display: block !important;
}

.auth-form__group--checkbox label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-bottom: 0;
  font-size: 14px;
  color: #1e1e1e;
}

.auth-form__group--checkbox input[type='checkbox'] {
  margin-right: 8px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Стили кнопок */
.auth-form__actions {
  margin-top: 24px;
}

.auth-form__submit {
  width: 100%;
  display: flex;
  height: 60px;
  padding: 12px 16px;
  justify-content: center;
  align-items: center;
  gap: 14px;
  border-radius: 15px;
  background: #ed424a;
  color: #fff;
  border: none;
  text-align: center;
  font-family: 'Proxima Nova', sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 800;
  line-height: 120%;
  letter-spacing: 0.18px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-bottom: 12px;
}

.auth-form__submit:hover {
  background: #d0303a;
}

.auth-form__submit:disabled {
  background: #999;
  cursor: not-allowed;
}

.auth-form__submit--secondary {
  background: #f5f5f5;
  color: #1e1e1e;
}

.auth-form__submit--secondary:hover {
  background: #e8e8e8;
}

.auth-form__submit--danger {
  background: #ed424a;
}

.auth-form__submit--danger:hover {
  background: #d0303a;
}

/* Стили ссылок */
.auth-form__link {
  font-weight: 500;
  font-size: 14px;
  line-height: 120%;
  letter-spacing: 0.01em;
  text-align: center;
  display: block;
  width: 100%;
  color: #666;
  margin-top: 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.auth-form__link:hover {
  color: #ed424a;
}

/* Стили футера формы */
.auth-form__footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #e4e4e4;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-form__footer span {
  color: #666;
  font-size: 14px;
  margin-right: 8px;
}

.auth-form__footer .auth-form__link {
  display: flex;
  width: 316px;
  height: 60px;
  padding: 12px 16px;
  justify-content: center;
  align-items: center;
  gap: 14px;
  border-radius: 15px;
  background: #f6f6f6;
  color: #1e1e1e;
  text-align: center;
  font-size: 18px;
  font-style: normal;
  font-weight: 800;
  line-height: 120%;
  letter-spacing: 0.18px;
  text-decoration: none;
  margin-top: 0;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.auth-form__footer .auth-form__link:hover {
  background: #ed424a;
  color: #fff;
}

/* Стили сообщений */
.auth-form__message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: none;
}

.auth-form__message--success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.auth-form__message--error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Стили профиля пользователя */

.auth-profile__avatar {
  width: 60px;
  height: 60px;
  background: #f5f5f5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 16px;
  color: #666;
}

.auth-profile__details h4 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e1e1e;
}

.auth-profile__details p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.auth-profile__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.auth-form p {
  font-weight: 500;
  font-size: 14px;
  line-height: 120%;
  letter-spacing: 0.01em;
  color: #666;
  margin-bottom: 30px;
}

.auth-form .email-input {
  position: relative;
}

.auth-form .email-input {
  position: relative;
}

.password-wrap .auth-input-wrapper {
  padding-right: 0;
}

.pwd-toggle {
  position: absolute;
  right: 19px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  cursor: pointer;
  background-color: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.pwd-toggle-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.pwd-toggle:hover {
  opacity: 0.8;
}

/* Стили для кнопок авторизации в шапке */
.header__auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-btn {
  background: none;
  border: none;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  line-height: 120%;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 12px 16px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.auth-btn--primary {
  color: #fff;
  border: 1px solid #ed424a;
  background: #ed424a;
}

.auth-btn--primary:hover {
  background: #d0303a;
  color: #fff;
}

/* Скрытие/показ кнопок в зависимости от статуса авторизации */
.auth-btn[data-action='profile'] {
  display: none;
}

/* Анимации для Fancybox */
.fancybox-slide--current .auth-modal {
  animation: modalSlideIn 0.3s ease-out;
}

/* Убеждаемся, что border-radius применяется в Fancybox */
.fancybox-content .auth-modal,
.fancybox-slide--current .auth-modal {
  border-radius: 40px !important;
  overflow: hidden;
}

.fancybox-content .auth-modal__content {
  border-radius: 40px !important;
}

/* Скругление для контейнера Fancybox */
.fancybox-wrap.fancybox-desktop,
.fancybox-skin {
  border-radius: 40px !important;
}

.fancybox-content {
  border-radius: 40px !important;
  overflow: hidden;
  padding: 0 !important;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Адаптивность */
@media (max-width: 480px) {
  .auth-modal {
    margin: 20px;
    width: calc(100% - 40px);
  }

  .auth-modal__content {
    padding: 30px 20px;
  }

  .auth-modal__header {
    margin-bottom: 20px;
    font-size: 24px;
  }

  .auth-modal__header h3 {
    font-size: 24px;
  }
}
