/*
Theme Name: Tevily
Theme URI: https://gaviaspreview.com/wp/tevily/
Author URI: https://themeforest.net/user/gavias
Author: Gaviasthemes Team
Description: The 2021 theme for WordPress is a fully responsive theme that looks great on any device.
Version: 1.3.2
Tested up to: 5.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: one-column, two-columns, right-sidebar, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, sticky-post, theme-options, translation-ready
Text Domain: tevily

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
.wp-caption-text{
   font-weight: 400;
   font-size: 14px;
   font-style: italic;
   color: #3f3836;
}
.gallery-caption{
   font-weight: 500;
}
.bypostauthor{
   text-align: left;
}
// Traduzir formulário de registo YITH
add_filter('gettext', 'traduzir_yith_register', 20, 3);
function traduzir_yith_register($translated_text, $text, $domain) {
    
    if ($domain == 'yith-frontend-manager-for-woocommerce') {
        
        $translations = array(
            'Username' => 'Nome de utilizador',
            'First name' => 'Primeiro nome',
            'Last name' => 'Último nome',
            'Your email' => 'O seu email',
            'Confirm email' => 'Confirmar email',
            'A password will be emailed to you' => 'Uma palavra-passe será enviada por email',
            'SIGN UP' => 'REGISTAR',
            'Sign up' => 'Registar',
            'Already a member' => 'Já é membro?',
            'LOGIN' => 'ENTRAR',
            'Create a free account' => 'Criar uma conta gratuita',
            'A few clicks away from creating your account' => 'A poucos cliques de criar a sua conta'
        );
        
        if (isset($translations[$text])) {
            $translated_text = $translations[$text];
        }
    }
    
    return $translated_text;
}
// Trocar $ por € no checkout via JavaScript
add_action('wp_footer', function() {
    if (is_checkout()) {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function() {
        function trocarDolarPorEuro() {
            // Trocar todos os símbolos $ por €
            var simbolos = document.querySelectorAll('.currency_symbol');
            simbolos.forEach(function(simbolo) {
                if (simbolo.textContent === '$') {
                    simbolo.textContent = '€';
                    simbolo.style.color = '#258DD0';
                }
            });
            
            // Colocar valores em azul
            var valores = document.querySelectorAll('.currency_amount');
            valores.forEach(function(valor) {
                valor.style.color = '#258DD0';
                valor.style.fontWeight = 'bold';
            });
        }
        
        // Executar várias vezes para garantir
        trocarDolarPorEuro();
        setTimeout(trocarDolarPorEuro, 500);
        setTimeout(trocarDolarPorEuro, 1000);
        setTimeout(trocarDolarPorEuro, 2000);
    });
    </script>
    <?php
    }
});