// Metoda 1: Nadpisanie nazw zakładek bezpośrednio w nawigacji konta WooCommerce
add_filter( 'woocommerce_account_menu_items', 'tadmet_reczne_menu_konta', 999 );
function tadmet_reczne_menu_konta( $items ) {
    if ( isset( $items['dashboard'] ) ) $items['dashboard'] = 'Pulpit';
    if ( isset( $items['orders'] ) )    $items['orders']    = 'Zamówienia';
    if ( isset( $items['downloads'] ) ) $items['downloads'] = 'Pliki do pobrania';
    if ( isset( $items['edit-address'] ) ) $items['edit-address'] = 'Adresy';
    if ( isset( $items['edit-account'] ) ) $items['edit-account'] = 'Dane konta';
    if ( isset( $items['customer-logout'] ) ) $items['customer-logout'] = 'Wyloguj się';
    
    return $items;
}

// Metoda 2: Globalny filtr tłumaczeń dla pozostałych tekstów (małe i duże litery)
add_filter( 'gettext', 'tadmet_globalne_tlumaczenie', 20, 3 );
function tadmet_globalne_tlumaczenie( $translated_text, $text, $domain ) {
    if ( $domain == 'woocommerce' || $domain == 'xstore' ) {
        $text_lower = strtolower( $text );
        switch ( $text_lower ) {
            // Nagłówek panelu bocznego
            case 'my account':
                $translated_text = 'Moje konto';
                break;
            // Zabezpieczenie na wypadek zwykłych tekstów
            case 'dashboard':
                $translated_text = 'Pulpit';
                break;
            case 'orders':
                $translated_text = 'Zamówienia';
                break;
            case 'downloads':
                $translated_text = 'Pliki do pobrania';
                break;
            case 'addresses':
                $translated_text = 'Adresy';
                break;
            case 'account details':
                $translated_text = 'Dane konta';
                break;
            case 'log out':
                $translated_text = 'Wyloguj się';
                break;
        }
    }
    return $translated_text;
}
/* BRUTALNE WYMUSZENIE JEDNEJ CZCIONKI NA CAŁEJ STRONIE KASY I SZEFÓW */
html, body, div, p, span, a, h1, h2, h3, h4, h5, h6, input, select, textarea, button, label, td, th {
    font-family: 'Montserrat', sans-serif !important;
}

/* FIX DLA MODUŁÓW KASY ELEMENTORA I XSTORE */
.elementor-widget-woocommerce-checkout-page,
.elementor-widget-woocommerce-checkout-page *,
.woocommerce-checkout,
.woocommerce-checkout * {
    font-family: 'Montserrat', sans-serif !important;
}

/* Poprawa czytelności wpisywanego tekstu w formularzach */
input[type="text"], input[type="email"], input[type="tel"], select, textarea, .select2-selection {
    font-family: 'Montserrat', sans-serif !important;
    font-weight: 500 !important;
    color: #222222 !important;
}
/* ABSOLUTNE WYMUSZENIE CZCIONKI DLA WSZYSTKICH PRZYCISKÓW I KARUZELI */
.btn, 
.button, 
button, 
.add_to_cart_button, 
.ajax_add_to_cart,
.product_type_simple,
.et_element,
.woocommerce-loop-product__title,
.price {
    font-family: 'Montserrat', sans-serif !important;
}

/* Poprawa wyglądu tekstu w przyciskach pod produktami */
.add_to_cart_button, .ajax_add_to_cart {
    text-transform: uppercase !important; /* Wielkie litery */
    font-weight: 700 !important;          /* Mocne pogrubienie */
    letter-spacing: 0.5px !important;     /* Czytelny odstęp */
}
/* Wymuszenie czarnego koloru - wersja ostateczna */
.widget_price_filter .ui-widget-content a, 
.widget_layered_nav ul li a, 
.widget_product_categories ul li a,
.widget_price_filter ul li a,
.widget_price_filter span,
.widget_price_filter label,
.widget_price_filter .price_slider_amount .price_label,
.widget_price_filter .price_slider_amount .price_label span,
.widget_price_filter .price_slider_amount,
.widget_layered_nav_filters ul li a {
    color: #000000 !important;
    font-weight: 800 !important;
}

/* Dodatkowo dla zakresów cenowych, jeśli mają inne klasy */
.widget_price_filter .price_slider_amount .price_label {
    color: #000000 !important;
}
/* Ostateczne, bezlitosne wymuszenie czarnego koloru w filtrach */
.widget_price_filter .price_slider_amount .price_label,
.widget_price_filter .price_slider_amount .price_label span,
.widget_price_filter .price_slider_amount,
.widget_layered_nav ul li a, 
.widget_product_categories ul li a {
    color: #000000 !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

/* Jeśli to są pola typu 'input' lub 'span' w suwaku */
.ui-slider-horizontal .ui-slider-range {
    background-color: #000000 !important;
}

/* Wymuszenie koloru dla etykiet cenowych */
.price_label span {
    color: #000000 !important;
}