
$('#btn_black_theme').on('click', function(){
    let black_theme = localStorage.getItem('black_theme');
    if (black_theme == 'false') {
        localStorage.setItem('black_theme', 'true');
        black_style();
    } else {
        localStorage.setItem('black_theme', 'false');
        location.reload();
    }
});

black_style();
function black_style(){
    let black_theme = localStorage.getItem('black_theme');
    if(black_theme == null){
        localStorage.setItem('black_theme', 'false');
        black_style();
    }
    if(black_theme == 'true'){
        $('.bg-navbar').css('background', 'linear-gradient(180deg, #191c22, #2d3138)');

        $('#btn_black_theme').removeClass('fa-moon');
        $('#btn_black_theme').addClass('fa-lightbulb');
        $('#btn_black_theme').css('background-color', '#3a3a3a');
        $('#btn_black_theme').css('opacity', '.8'); 

        $('.btn-outline-light').removeClass('btn_white'); 
        // $('.nav-link').css('opacity', '.7'); 

        $('.dropdown-item').css('color', '#838383');

        $('.language').css('opacity', '.8');  

        $('.heading_text').css('opacity', '.5'); 
        $('.navbar').css('background-color', '#252526');
        $('.text_header').css('color', '#838383');
        $('.btn_white').css('color', '#838383');
        $('.btn_white').css('border', '2px solid #838383');
        $('.card').css('background-color', '#252526');
        $('.card-header').css('background-color', '#252526');
        $('.card-footer').css('background-color', '#252526');
        $('#content-wrapper').css('background-color', '#1E1E1E');
        $('.thead-light th').css('background-color', '#1E1E1E');
        $('.sticky-footer').css('background-color', '#232323');
        $('.btn').css('opacity', '.6');
        $('.form-control').css('background-color', '#1E1E1E');
        $('textarea').css('background-color', '#1E1E1E');
        $('#list tr .bg_selected').css('background-color', '#333333');
        $('.input-group-text').css('opacity', '.7');
        $('.form-control').css('border', '1px solid #1d2984');
        $('.alert').css('opacity', '.6'); 
        $('#myimage').css('opacity', '.8'); 
        $('.modal-content').css('background-color', '#1E1E1E');
        $('#slideout').css('opacity', '.6'); 
        $('.badge').css('opacity', '.7');  
        $('.badge').css('color', '#000000');  
        $('#write_developers').css('opacity', '.5'); 
        $('.text-primary').css('opacity', '.8');
        // $('.border-bottom').css('border-bottom', '1px solid red;');
        $('.dropdown-menu').css('background-color', '#1E1E1E');
        $('#slideout_inner').css('background', '#1E1E1E');
        $('#coordinat_list').css('background', '#1E1E1E');
        $('#coordinat_list').css('border', '1px solid rgb(29, 41, 132)');
        $('#map').css('opacity', '.7');

        $('body').append('<style> .fa-mars { opacity: .9; } .fa-venus { opacity: .9; } </style>');
        // $('.custom-select').css('opacity', '.2');
        // coordinat_list
        //прелоадер стили
        $('body').append('<style> #hellopreloader_preload { background: #1a1a1a url(img/oval.svg) center center no-repeat; } </style>');
        //свит алерт стили
        $('body').append('<style> .badge { opacity: .7; color: #000000 } .swal2-popup.swal2-toast { opacity: .5; box-shadow: none; } .swal2-popup { opacity: .5; } </style>');

        $('body').append('<style> #answer_sms_text { background-color: #1E1E1E; border: 1px solid #1d2984; } .bg_selected { background-color: #3c3c3c; }  ::-webkit-scrollbar { background-color: #2b2a2a; } ::-webkit-scrollbar-thumb { background-color: #3b3b3b; } #log_div::-webkit-scrollbar { background-color: #252526; } .custom-control-label::before { opacity: .8; } .border-bottom { border-bottom: 1px solid #1d2984!important; } </style>');
        // $('textarea::-webkit-scrollbar').css('background-color', '#1E1E1E');
        // $('#table_users').append('<style>.bg_selected { background-color: #414141; } .badge { opacity: .68; color: #1E1E1E } </style>');
        $('#table_users').append('<style> #photo > img { opacity: .8; } .badge { opacity: .7; color: #000000 } .table-hover tbody tr:hover td { background: #3c3c3c; } </style>');
        $('#table_proxy').append('<style> #photo > img { opacity: .8; } .badge { opacity: .7; color: #000000 } .table-hover tbody tr:hover td { background: #3c3c3c; } </style>');
        $('footer').removeClass('bg-white')
    }
}