// import $ from "jquery";

$(document).ready(function () {
    // LOGIN/SIGNUP ======================================
    let loginBtn = document.querySelector('.logged-false');
    let loginFormSection = document.querySelector('.sign-up');
    let loginForm = document.querySelector('.login-form');
    let regBtn = document.querySelector('.sign-up-btn');
    let regForm = document.querySelector('.registration-form');
    let loginCloseBtn = document.querySelectorAll('.sign-up-exit-img');
    let loginBtnReturnLink = document.querySelector('.sign-up-btn-return');
    let forgottenPass = document.querySelector('.forgot-pass');
    let passRecNr = document.querySelector('.password-recovery-nr');
    let passRecSMS = document.querySelector('.password-recovery-sms');
    let smsTrig = document.querySelector('.sms-trigger');
    let signUpWrapper = document.querySelector('.sign-up-wrapper');
    let signUpContainer = document.querySelector('.sign-up-container');
    // let burgerSignIn = document.querySelector('.burger-sign-in');
    // let burgerSignUp = document.querySelector('.burger-sign-up');
    let body = document.querySelector('body');
    // let burgerElement = document.querySelector('.nav-inner-burger-container');
    // burgerSignIn.addEventListener('click', () => {
    //     burgerElement.classList.add('hidden-burger');
    //     regForm.style.display = 'none';
    //     passRecNr.style.display = 'none';
    //     passRecSMS.style.display = 'none';
    //     loginFormSection.style.display = 'block';
    //     body.style.overflowY = 'hidden';
    // });
    //
    // burgerSignUp.addEventListener('click', () => {
    //     burgerElement.classList.add('hidden-burger');
    //     regForm.style.display = 'block';
    //     passRecNr.style.display = 'none';
    //     passRecSMS.style.display = 'none';
    //     loginFormSection.style.display = 'block';
    //     loginForm.style.display = 'none';
    //     body.style.overflowY = 'hidden';
    // });

    signUpContainer.addEventListener('click', (event) => {
        let isClickInsideElement = signUpWrapper.contains(event.target);
        if (!isClickInsideElement) {
            loginFormSection.style.display = 'none';
            regForm.style.display = 'none';
            passRecNr.style.display = 'none';
            // passRecSMS.style.display = 'none';
            loginForm.style.display = 'block';
            body.style.overflowY = 'auto';
        }
    });

    loginBtn.addEventListener('click', () => {
        regForm.style.display = 'none';
        passRecNr.style.display = 'none';
        // passRecSMS.style.display = 'none';
        loginFormSection.style.display = 'block';
        body.style.overflowY = 'hidden';
    });

    loginCloseBtn.forEach((el) => {
        el.addEventListener('click', () => {
            loginFormSection.style.display = 'none';
            regForm.style.display = 'none';
            passRecNr.style.display = 'none';
            // passRecSMS.style.display = 'none';
            loginForm.style.display = 'block';
            body.style.overflowY = 'auto';
            console.log(body.style.overflowY);
        });
    });

    regBtn.addEventListener('click', (event) => {
        regForm.style.display = 'block';
        loginForm.style.display = 'none';
    });
    loginBtnReturnLink.addEventListener('click', () => {
        regForm.style.display = 'none';
        loginForm.style.display = 'block';
    });

    forgottenPass.addEventListener('click', () => {
        passRecNr.style.display = 'block';
        loginForm.style.display = 'none';
    });
    // smsTrig.addEventListener('click', () => {
    //     passRecNr.style.display = 'none';
    //     passRecSMS.style.display = 'block';
    // });
});
