/* Общий попап сайта (вариант «Чистая карточка» из mockups/popups-design.html).
   Открытие — .css('display', 'flex').hide().fadeIn(), закрытие по фону, кнопкам .modal__close / .modal__cancel и Esc — в main.js */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    display: none;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 16px;
    background-color: rgba(20, 20, 20, 0.6);
}

.modal__card {
    position: relative;
    width: 440px;
    max-width: 100%;
    max-height: 100%;
    padding: 32px;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow-y: auto;
}

.modal--small .modal__card {
    width: 400px;
}

/* Сообщение (showNotice в main.js) открывается поверх другого окна */
.modal--notice {
    z-index: 21;
}

/* Окна с таблицей или сеткой (горячие клавиши) */
.modal--wide .modal__card {
    width: 720px;
}

/* Круглая кнопка закрытия вместо крестика-картинки */
.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: #F8F8F8;
    color: #5f5f5f;
    cursor: pointer;
    transition: 0.3s;
}

.modal__close:hover {
    background-color: #ececec;
    color: #141414;
}

.modal__close svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Иконка над заголовком в окнах подтверждения */
.modal__icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 18px;
    border-radius: 50%;
    background-color: #f4f3f9;
    color: #7b78a8;
}

.modal__icon--danger {
    background-color: #fbecef;
    color: #b5475b;
}

.modal__icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modal__title {
    margin-bottom: 8px;
    padding-right: 44px;
    font-size: 24px;
    font-weight: 700;
    line-height: 125%;
}

.modal__icon + .modal__title {
    padding-right: 0;
}

.modal__text {
    margin-bottom: 22px;
    font-size: 15px;
    line-height: 150%;
    color: #5f5f5f;
}

.modal__error {
    margin-bottom: 16px;
    font-size: 14px;
    color: #b5475b;
}

.modal__error:empty {
    display: none;
}

.modal__btns {
    display: flex;
    gap: 10px;
}

.modal__btns .btn {
    flex: 1;
}

/* Вкладки «Вход / Регистрация» */
.modal__tabs {
    display: flex;
    margin-right: 44px;
    margin-bottom: 24px;
    padding: 4px;
    border-radius: 6px;
    background-color: #ececec;
}

.modal__tab {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    font-family: "Raleway";
    font-size: 15px;
    color: #141414;
    cursor: pointer;
    transition: 0.3s;
}

.modal__tab--active {
    background-color: #fff;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Поля форм в попапах */
.modal__field {
    display: flex;
    flex-direction: column;
    row-gap: 6px;
    margin-bottom: 14px;
    font-size: 14px;
}

.modal__input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background-color: #fff;
    outline: none;
    font-family: "Raleway";
    font-size: 15px;
    color: #141414;
    transition: 0.3s;
}

.modal__input:focus {
    border-color: #7b78a8;
}

.modal__input--error,
.modal__input--error:focus {
    border-color: #b5475b;
}

/* Поле пароля с кнопкой-глазиком */
.modal__password {
    position: relative;
    display: block;
}

.modal__password .modal__input {
    padding-right: 46px;
}

.modal__eye {
    position: absolute;
    top: 50%;
    right: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    padding: 0;
    border: none;
    background-color: transparent;
    color: #838383;
    cursor: pointer;
}

.modal__eye svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

/* Пароль виден — глаз перечеркнут и подсвечен */
.modal__eye--open {
    color: #7b78a8;
}

.modal__eye--open::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    margin-top: -1px;
    margin-left: -12px;
    border-radius: 1px;
    background-color: currentColor;
    transform: rotate(-45deg);
}

.modal__field-error {
    font-size: 13px;
    color: #b5475b;
}

.modal__field-error:empty {
    display: none;
}

.modal__hint {
    font-size: 13px;
    color: #838383;
}

.modal__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 14px;
}

.modal__check {
    position: relative;
    display: flex;
    align-items: flex-start;
    column-gap: 10px;
    font-size: 14px;
    line-height: 140%;
    cursor: pointer;
}

/* Свой чекбокс вместо браузерного: настоящий input скрыт, но остается в фокусе с клавиатуры */
.modal__check-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.modal__check-box {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid #e2e2e2;
    border-radius: 6px;
    background-color: #F8F8F8;
    color: #fff;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.modal__check-box svg {
    width: 12px;
    height: 10px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal__check:hover .modal__check-box {
    border-color: #D18ABD;
}

.modal__check-input:checked + .modal__check-box {
    border-color: #D18ABD;
    background-color: #D18ABD;
}

.modal__check-input:checked + .modal__check-box svg {
    opacity: 1;
    transform: scale(1);
}

.modal__check-input:focus-visible + .modal__check-box {
    box-shadow: 0 0 0 3px rgba(209, 138, 189, 0.35);
}

.modal__link {
    color: #7b78a8;
    text-decoration: underline;
}

.modal__link:hover {
    color: #141414;
}

.modal__captcha {
    margin: 16px 0;
}

/* .modal — чтобы перебить display у .btn из main.css (он подключается позже) */
.modal .modal__submit {
    display: flex;
    width: 100%;
}

/* Вход через соцсети: черта «или» и кнопки провайдеров */
.modal__divider {
    display: flex;
    align-items: center;
    column-gap: 12px;
    margin: 20px 0;
    font-size: 13px;
    color: #838383;
}

.modal__divider::before,
.modal__divider::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background-color: #e2e2e2;
}

/* Кнопки в одну строку поровну — сколько бы провайдеров ни было подключено */
.modal__social {
    display: grid;
    grid-auto-columns: 1fr;
    grid-auto-flow: column;
    gap: 8px;
}

.modal__social-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 8px;
    min-width: 0;
    padding: 10px 6px;
    white-space: nowrap;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    color: #141414;
    transition: 0.3s;
}

.modal__social-btn:hover {
    border-color: #7b78a8;
    color: #141414;
}

.modal__social-icon {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.modal__social-icon--yandex {
    border-radius: 50%;
    background-color: #FC3F1D;
}

.modal__social-icon--vk {
    border-radius: 6px;
    background-color: #0077FF;
    font-size: 9px;
}

/* «Завершите регистрацию»: отступ между согласием и кнопкой (в регистрации его дает капча) */
.modal--social .modal__check {
    margin-bottom: 18px;
}

/* Email от соцсети: показываем, но не даем менять */
.modal__readonly {
    padding: 12px 14px;
    border-radius: 6px;
    background-color: #F8F8F8;
    font-size: 15px;
    color: #5f5f5f;
    overflow-wrap: anywhere;
}

/* Ссылка под кнопкой: «← Вернуться ко входу» */
.modal__switch {
    margin-top: 18px;
    font-size: 14px;
    text-align: center;
}

.modal__form .modal__error {
    margin-top: -4px;
}

/* Красная кнопка для необратимых действий (удаление) */
.btn.btn-danger {
    border-color: #b5475b;
    background-color: #b5475b;
    color: #fff;
}

.btn.btn-danger:hover {
    border-color: #9a3a4c;
    background-color: #9a3a4c;
}

/* Новый пароль: для какого аккаунта меняем */
.modal__user {
    display: flex;
    align-items: center;
    column-gap: 12px;
    margin-top: 14px;
    margin-bottom: 22px;
    padding: 12px 14px;
    border-radius: 12px;
    background-color: #F8F8F8;
    font-size: 14px;
}

.modal__user-avatar {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #D18ABD;
    overflow: hidden;
    font-weight: 700;
    color: #fff;
}

.modal__user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal__user-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.modal__user-email {
    display: block;
    font-size: 13px;
    color: #838383;
}

/* Правила пароля: серые, зеленеют при выполнении, краснеют при ошибке */
.modal__rules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: -6px 0 20px;
    padding: 0;
    list-style: none;
    font-size: 12px;
}

.modal__rule {
    padding: 4px 10px;
    border-radius: 20px;
    background-color: #ececec;
    color: #5f5f5f;
    transition: 0.3s;
}

.modal__rule--ok {
    background-color: #e6f2e8;
    color: #3f8f4f;
}

.modal__rule--ok::before {
    content: "✓ ";
}

.modal__rule--bad {
    background-color: #fbecef;
    color: #b5475b;
}

.modal__rule--bad::before {
    content: "✕ ";
}

/* Уведомление внизу экрана (после смены пароля) */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 21;
    display: none;
    align-items: center;
    column-gap: 14px;
    width: max-content;
    max-width: calc(100% - 32px);
    padding: 16px 20px;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    font-size: 15px;
    transform: translateX(-50%);
}

.toast__icon {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e6f2e8;
    color: #3f8f4f;
}

.toast__icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Согласие на cookie (mockups/cookie-design.html, вариант 1). Ниже попапов по z-index */
.cookie {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 19;
    width: 400px;
    max-width: calc(100% - 32px);
    padding: 24px;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25);
}

.cookie__head {
    display: flex;
    align-items: center;
    column-gap: 12px;
    margin-bottom: 12px;
}

.cookie__icon {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f7e8f2;
    color: #D18ABD;
}

.cookie__icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cookie__icon circle {
    fill: currentColor;
    stroke: none;
}

.cookie__title {
    font-size: 18px;
    font-weight: 700;
    line-height: 120%;
}

.cookie__text {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 150%;
    color: #5f5f5f;
}

/* Как .modal__link */
.cookie__link {
    color: #7b78a8;
    text-decoration: underline;
    transition: 0.3s;
}

.cookie__link:hover {
    color: #141414;
}

/* Два класса — main.css с .btn подключается позже */
.cookie__btn.btn {
    width: 100%;
}

@media (max-width: 480px) {
    .modal__card {
        padding: 24px 20px;
    }

    .cookie {
        left: 16px;
        bottom: 16px;
        padding: 20px;
    }

    .modal__close {
        top: 12px;
        right: 12px;
    }

    .modal__title {
        font-size: 21px;
    }
}

@media (max-width: 360px) {
    .modal__btns {
        flex-direction: column-reverse;
    }
}
