/* =========================================================================
   STYL DLA SKLEPU — przycisk "Porównaj" + tabela na stronie /compare/
   Ładowane warunkowo tylko na: sklep, kategorie, tagi produktów,
   pojedynczy produkt, strona /compare/.
   ========================================================================= */

/* Z-INDEX bloków compare (tylko gdy są obecne — czyli na /compare/) */
.br_new_compare_block { position: relative; z-index: 10 !important; }
.br_new_compare_block .br_main_top, .br_new_compare_block .br_top_table { z-index: 10 !important; }


/* =========================================================================
   PRZYCISK "PORÓWNAJ" — DESKTOP I TABLET
   ========================================================================= */
@media (min-width: 768px) {
    body.woocommerce ul.products li.product .br_compare_button, 
    body.woocommerce-page ul.products li.product .br_compare_button,
    body.woocommerce div.product .br_compare_button,
    body.woocommerce-page div.product .br_compare_button { background: transparent !important; color: #333333 !important; width: auto !important; display: inline-flex !important; align-items: center; justify-content: flex-start; padding: 10px 15px; border: none !important; box-shadow: none !important; font-weight: normal; margin: 0; }
    
    body.woocommerce ul.products li.product .br_compare_button:hover, 
    body.woocommerce-page ul.products li.product .br_compare_button:hover,
    body.woocommerce div.product .br_compare_button:hover,
    body.woocommerce-page div.product .br_compare_button:hover { background: transparent !important; color: #005bc9 !important; }
    
    body.woocommerce ul.products li.product .br_compare_button .br_compare_button_text, 
    body.woocommerce-page ul.products li.product .br_compare_button .br_compare_button_text,
    body.woocommerce div.product .br_compare_button .br_compare_button_text,
    body.woocommerce-page div.product .br_compare_button .br_compare_button_text { display: inline-block; font-size: 14px; margin-left: 8px; line-height: 1; }
    
    body.woocommerce ul.products li.product .br_compare_button::before, 
    body.woocommerce-page ul.products li.product .br_compare_button::before,
    body.woocommerce div.product .br_compare_button::before,
    body.woocommerce-page div.product .br_compare_button::before { content: "\f24e"; font-family: "Font Awesome 5 Free", "FontAwesome", sans-serif; font-weight: 900; font-size: 1.2em; display: inline-block; line-height: 1; }
    
    body.woocommerce ul.products li.product .br_compare_button > i.fa,
    body.woocommerce div.product .br_compare_button > i.fa { display: none !important; }
}


/* =========================================================================
   PRZYCISK "PORÓWNAJ" — URZĄDZENIA MOBILNE
   ========================================================================= */
@media (max-width: 767px) {
    /* 1. Strona pojedynczego produktu - zachowujemy duży, czytelny przycisk */
    body.woocommerce div.product .br_compare_button,
    body.woocommerce-page div.product .br_compare_button {
        background: transparent !important; color: #333333 !important; width: auto !important; display: inline-flex !important; align-items: center; justify-content: flex-start; padding: 10px 15px; border: none !important; box-shadow: none !important; font-weight: normal; margin: 0;
    }
    body.woocommerce div.product .br_compare_button::before,
    body.woocommerce-page div.product .br_compare_button::before { content: "\f24e"; font-family: "Font Awesome 5 Free", "FontAwesome", sans-serif; font-weight: 900; font-size: 1.2em; display: inline-block; line-height: 1; }
    body.woocommerce div.product .br_compare_button > i.fa { display: none !important; }
    body.woocommerce div.product .br_compare_button .br_compare_button_text { display: inline-block; font-size: 14px; margin-left: 8px; line-height: 1; }

    /* 2. Kategorie (Kafelki) - Kompaktowy przycisk, który nie rozsadza kafelka */
    body.woocommerce ul.products li.product .br_compare_button,
    body.woocommerce-page ul.products li.product .br_compare_button {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        padding: 5px 0 !important;
        margin: 5px 0 10px 0 !important;
        font-size: 13px !important;
        background: transparent !important;
        color: #005bc9 !important;
        border: none !important;
        box-shadow: none !important;
        font-weight: 600 !important;
    }
    
    body.woocommerce ul.products li.product .br_compare_button i.fa,
    body.woocommerce-page ul.products li.product .br_compare_button i.fa {
        display: none !important;
    }
    
    body.woocommerce ul.products li.product .br_compare_button::before,
    body.woocommerce-page ul.products li.product .br_compare_button::before {
        content: "\f24e";
        font-family: "Font Awesome 5 Free", "FontAwesome", sans-serif;
        font-weight: 900;
        margin-right: 6px;
    }
    
    /* 3. Wymuszenie ukrycia krótkiego opisu na mobile na listach (chroni siatkę) */
    body.woocommerce ul.products li.product .woocommerce-product-details__short-description,
    body.woocommerce ul.products li.product .br_compare_short_description {
        display: none !important;
    }

    /* Bezwzględne zmniejszenie tytułu produktu w pętli */
    body.woocommerce ul.products li.product .woocommerce-loop-product__title,
    body.woocommerce ul.products li.product h2.woocommerce-loop-product__title,
    body.woocommerce ul.products li.product .woo-loop-product__title {
        font-size: 10px !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        margin-bottom: 10px !important;
    }

    /* Bezwzględne ukrycie krótkiego opisu (każdej możliwej klasy) */
    body.woocommerce ul.products li.product .woo-desc,
    body.woocommerce ul.products li.product .description,
    body.woocommerce ul.products li.product .short-description,
    body.woocommerce ul.products li.product .woocommerce-product-details__short-description,
    body.woocommerce ul.products li.product .br_compare_short_description {
        display: none !important;
        height: 0 !important;
        visibility: hidden !important;
    }
}


/* =========================================================================
   TABELA PORÓWNYWARKI — strona /compare/ (przebudowana na flex)
   ========================================================================= */
body.cz_compare_js_active .br_top_table, 
body.cz_compare_js_active .br_main_top, 
body.cz_compare_js_active .br_opacity_top, 
body.cz_compare_js_active .br_new_compare { 
    display: none !important; 
}

.cz_rebuilt_compare { width: 100%; font-family: inherit; color: #333; font-size: 14px; margin: 20px 0; }
.cz_rebuilt_compare.cz_hide_sames .cz_same_attr { display: none !important; }

.cz_rebuilt_compare.cz_show_highlights .cz_attr_row:not(.cz_same_attr) .cz_attr_name { background-color: #dcedff; }
.cz_rebuilt_compare.cz_show_highlights .cz_attr_row:not(.cz_same_attr) .cz_attr_val { background-color: #e6f2ff; }

.cz_rebuilt_compare .br_show_compare_dif, 
.cz_rebuilt_compare .br_remove_all_compare,
.cz_rebuilt_compare .cz_highlight_diff { display: inline-block; font-size: 13px; font-weight: 600; color: #005bc9; text-decoration: none; padding: 8px 12px; background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 4px; cursor: pointer; text-align: center; transition: 0.2s; margin: 5px; }
.cz_rebuilt_compare .br_show_compare_dif:hover, 
.cz_rebuilt_compare .br_remove_all_compare:hover,
.cz_rebuilt_compare .cz_highlight_diff:hover { background: #005bc9; color: #fff; }

@media (min-width: 768px) {
    .cz_top_section { display: flex; border-top: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0; }
    .cz_top_left { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; background: #fff; padding: 15px;}
    .cz_top_left .br_remove_all_compare, .cz_top_left .br_show_compare_dif, .cz_top_left .cz_highlight_diff { margin-bottom: 10px; width: 100%; }
    .cz_top_products { display: flex; flex-grow: 1; }
    .cz_col { flex: 1; display: flex; flex-direction: column; padding: 25px 15px; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; background: #fff;}
    .cz_img { display: flex; justify-content: center; height: 160px; margin-bottom: 20px; }
    .cz_img img { max-height: 100%; object-fit: contain; }
    .cz_title h3, .cz_title a { font-size: 15px; font-weight: 600; color: #005bc9; text-align: center; line-height: 1.4; display: block; margin-bottom: 15px; text-decoration: none;}
    .cz_action { margin-top: auto; text-align: center; }
    .cz_action .price { font-size: 19px; font-weight: 700; color: #005bc9; margin-bottom: 15px; display: block;}
    .cz_action .button, .cz_action .add_to_cart_button { background: #005bc9; color: #fff; padding: 10px 20px; border-radius: 4px; font-weight: 700; text-transform: uppercase; font-size: 13px; border: none !important; width: auto !important;}
    .cz_action .button:hover { background: #333;}
    .cz_attr_row { display: flex; border-left: 1px solid #e0e0e0; transition: background 0.3s; }
    .cz_attr_row:nth-child(even) { background: #fcfcfc; }
    .cz_attr_name { width: 220px; flex-shrink: 0; font-size: 14px; font-weight: 700; color: #444; padding: 15px; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; background: #f9f9f9; transition: background 0.3s; }
    .cz_attr_vals { display: flex; flex-grow: 1; }
    .cz_attr_val { flex: 1; font-size: 14px; padding: 15px; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: center; align-items: center; text-align: center; transition: background 0.3s; }
    .cz_sep { background: #f0f0f0; color: #333; font-size: 14px; font-weight: 700; padding: 15px; border: 1px solid #e0e0e0; border-top: none; text-transform: uppercase;}
}

@media (max-width: 767px) {
    .cz_top_section { display: flex; flex-direction: column; border: 1px solid #e0e0e0; border-bottom: none; }
    .cz_top_left { display: flex; justify-content: space-around; flex-wrap: wrap; padding: 10px; background: #f8f9fa; border-bottom: 1px solid #e0e0e0; }
    .cz_top_products { display: flex; }
    .cz_col { flex: 1; display: flex; flex-direction: column; padding: 15px 5px; border-right: 1px solid #e0e0e0; background: #fff;}
    .cz_col:last-child { border-right: none; }
    .cz_img { display: flex; justify-content: center; height: 120px; margin-bottom: 10px; }
    .cz_img img { max-height: 100%; object-fit: contain; max-width: 90%;}
    .cz_title h3, .cz_title a { font-size: 14px; font-weight: 600; color: #005bc9; text-align: center; line-height: 1.3; display: block; margin-bottom: 10px; text-decoration: none;}
    .cz_action { margin-top: auto; text-align: center; }
    .cz_action .price { font-size: 15px; font-weight: 700; margin-bottom: 8px; display: block;}
    .cz_action .button, .cz_action .add_to_cart_button { width: 100%; max-width: 120px; margin: 0 auto; display: block; background: #005bc9; color: #fff; padding: 8px 4px; font-size: 12px; font-weight: 700; border: none !important;}
    .cz_attr_section { border-top: 2px solid #005bc9; }
    .cz_attr_row { border-bottom: 1px solid #e0e0e0; display: block;}
    .cz_attr_name { background: #f2f2f2; color: #444; text-align: center; font-size: 12px; font-weight: 700; padding: 6px 8px; border-bottom: 1px solid #ddd; transition: background 0.3s; }
    .cz_attr_vals { display: flex; background: #fff; }
    .cz_attr_val { flex: 1; padding: 10px 5px; text-align: center; font-size: 13px; border-right: 1px solid #e5e5e5; display: flex; align-items: center; justify-content: center; word-break: break-word; transition: background 0.3s; }
    .cz_attr_val:last-child { border-right: none; }
    .cz_sep { background: #f5f5f5; color: #333; text-align: center; font-size: 14px; font-weight: 700; padding: 10px; border-bottom: 1px solid #ddd; text-transform: uppercase;}
}
