/* ==========================================================================
   TOMAWER – CSS sklepu (zapytanie ofertowe)
   --------------------------------------------------------------------------
   Spis sekcji:
    0. Zmienne globalne (:root)
    1. Globalne & nagłówek sklepu
    2. Layout sidebaru (+ media)
    3. Wyszukiwarka
    4. Akordeony filtrów (master + atrybuty)
    5. Checkboxy atrybutów
    6. Widget kategorii
    7. Siatka produktów (+ media)
    8. Ukrycie cen i podsumowań (zapytanie ofertowe)
    9. Jednostka „m²" + etykieta „Zapotrzebowanie"
   10. Strona podziękowania (Thank You)
   11. Pole „Razem" w Order Overview (ukrycie)
   12. Ceny katalogowe + tekst B2B

   Konwencja: media queries trzymamy przy bloku, którego dotyczą (sidebar
   w sekcji 2, siatka produktów w sekcji 7). !important używany tylko tam,
   gdzie trzeba nadpisać core WooCommerce albo style Astra.
   ========================================================================== */


/* ==========================================================================
   0. Zmienne globalne
   ========================================================================== */
:root {
    /* Kolory marki */
    --tm-color-primary:        #306EB5;
    --tm-color-dark:           #1e293b;

    /* Tekst */
    --tm-color-text:           #475569;
    --tm-color-text-muted:     #64748b;

    /* Powierzchnie i tła */
    --tm-color-surface:        #ffffff;
    --tm-color-bg:             #f8fafc;
    --tm-color-track:          #f1f5f9;
    --tm-color-surface-hover:  #fcfcfc;

    /* Obramowania */
    --tm-color-border:         #e2e8f0;
    --tm-color-border-light:   #cbd5e1;
    --tm-color-border-strong:  #94a3b8;

    /* Typografia */
    --tm-font-heading:         'Montserrat', sans-serif;
}


/* ==========================================================================
   1. Globalne & nagłówek sklepu
   ========================================================================== */
body.woocommerce-page                                { background-color: var(--tm-color-bg); }
body.woocommerce-page .site-content > .ast-container { max-width: 1400px; }

body.woocommerce-page .ast-woo-shop-archive-header {
    background-color: var(--tm-color-surface);
    border-bottom: 1px solid var(--tm-color-border);
    padding: 40px 0 30px;
    margin-bottom: 40px;
}

body.woocommerce-page .woocommerce-products-header__title.page-title {
    font-family: var(--tm-font-heading);
    font-size: 36px;
    font-weight: 800;
    color: var(--tm-color-dark);
}


/* ==========================================================================
   2. Layout sidebaru
   ========================================================================== */
@media (min-width: 993px) {
    body.woocommerce-page .site-content > .ast-container {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    body.woocommerce-page #secondary.widget-area {
        width: 22%;
        padding-right: 40px;
        position: sticky;
        top: 120px;
        flex-shrink: 0;
        box-sizing: content-box;
    }
    body.woocommerce-page #primary.site-main {
        width: 78%;
        margin: 0;
    }
}

/* Likwidacja separatora sidebar/treść z motywu Astra. */
@media (min-width: 922px) {
    body.ast-left-sidebar #primary {
        border-left: none !important;
    }
}


/* ==========================================================================
   3. Wyszukiwarka
   ========================================================================== */
#secondary .widget_product_search form          { position: relative; margin-bottom: 1px; }
#secondary .widget_product_search .widget-title,
#secondary .widget_product_search button        { display: none; }

#secondary .widget_product_search input[type="search"] {
    width: 100%;
    padding: 24px 16px 24px 46px;
    border: 1px solid var(--tm-color-border);
    border-radius: 12px;
    background-color: var(--tm-color-surface);
    font-size: 18px;
    color: var(--tm-color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23306EB5' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 16px center;
    background-size: 20px;
}


/* ==========================================================================
   4. Akordeony filtrów (master + atrybuty)
   ========================================================================== */

/* Widget master „FILTRY" – belka nagłówka. */
.tomawer-filter-header-container {
    transition: background-color 0.2s ease;
    margin-bottom: 20px !important; /* nadpisuje marginesy widgetów Astra */
    cursor: pointer;
}
.tomawer-filter-header-container:hover { background-color: var(--tm-color-surface-hover); }

/* Strzałka w belce master – obraca się gdy sidebar jest w trybie „otwarty". */
.tomawer-filter-header-container svg {
    transition: transform 0.3s ease;
}
#secondary.main-filters-open .tomawer-filter-header-container svg {
    transform: rotate(180deg);
}

/* Widgety atrybutów – domyślnie ukryte, odsłaniane po otwarciu master headera. */
#secondary .widget_layered_nav {
    display: none;
    margin-bottom: 10px !important; /* nadpisuje marginesy widgetów Astra */
}
#secondary.main-filters-open .widget_layered_nav { display: block; }

/* Tytuł pojedynczego akordeonu atrybutu. */
#secondary .widget_layered_nav .widget-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--tm-color-border-strong);
    padding: 14px 16px;
    margin-bottom: 0;
    font-family: var(--tm-font-heading);
    font-size: 14px;
    font-weight: 500;
    color: var(--tm-color-dark);
    text-transform: uppercase;
    cursor: pointer;
    background: var(--tm-color-surface);
    user-select: none;
    position: relative;
    z-index: 2;
}

#secondary .widget_layered_nav .widget-title::after {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.3s ease;
}
#secondary .widget_layered_nav.is-open .widget-title::after { transform: rotate(180deg); }

/* Lista opcji atrybutu – rozwijana. */
#secondary .widget_layered_nav ul {
    display: none;
    border: 1px solid var(--tm-color-border-strong);
    padding: 15px;
    margin: -1px 0 0 0;
    background: var(--tm-color-surface);
    max-height: 250px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
    list-style: none;
    box-shadow: none;
}
#secondary .widget_layered_nav.is-open ul { display: block; }

/* Scrollbar listy filtrów (WebKit). */
#secondary .widget_layered_nav ul::-webkit-scrollbar       { width: 4px; }
#secondary .widget_layered_nav ul::-webkit-scrollbar-track { background: var(--tm-color-track); }
#secondary .widget_layered_nav ul::-webkit-scrollbar-thumb {
    background: var(--tm-color-border-light);
    border-radius: 4px;
}


/* ==========================================================================
   5. Checkboxy atrybutów
   --------------------------------------------------------------------------
   !important na border/box-shadow nadpisuje ramki list widgetów w Astrze.
   ========================================================================== */
#secondary .widget_layered_nav ul li {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 0;
    border: none !important;
    box-shadow: none !important;
}

#secondary .widget_layered_nav ul li a {
    display: flex;
    align-items: center;
    font-size: 15px;
    color: var(--tm-color-text);
    text-decoration: none;
    transition: color 0.2s ease;
    border: none !important; /* Astra domyślnie dodaje border-bottom linkom widgetów */
}
#secondary .widget_layered_nav ul li a:hover { color: var(--tm-color-primary); }

#secondary .widget_layered_nav ul li a::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 1px solid var(--tm-color-border-light);
    border-radius: 4px;
    margin-right: 12px;
    background-color: var(--tm-color-surface);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

#secondary .widget_layered_nav ul li.chosen a::before {
    background-color: var(--tm-color-primary);
    border-color: var(--tm-color-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}
#secondary .widget_layered_nav ul li.chosen a {
    color: var(--tm-color-primary);
    font-weight: 700;
}

/* Ukrycie liczników „(12)" – WooCommerce dodaje je inline, stąd !important. */
#secondary .count { display: none !important; }


/* ==========================================================================
   6. Widget kategorii
   ========================================================================== */
#secondary .widget_product_categories {
    margin: 30px 0;
    border: none;
}

#secondary .widget_product_categories .widget-title {
    font-family: var(--tm-font-heading);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--tm-color-dark);
    border: none;
    padding: 0;
    margin-bottom: 15px;
    background: transparent;
}

#secondary .widget_product_categories ul {
    display: block;
    border: none;
    padding: 0;
    background: transparent;
    list-style: none;
}

#secondary .widget_product_categories ul li a {
    display: block;
    padding: 6px 0;
    font-size: 15px;
    color: var(--tm-color-text);
    text-decoration: none;
    transition: all 0.3s ease;
    border: none !important; /* nadpisuje border-bottom z Astry */
}
#secondary .widget_product_categories ul li a:hover {
    color: var(--tm-color-primary);
    padding-left: 6px;
}


/* ==========================================================================
   7. Siatka produktów
   --------------------------------------------------------------------------
   !important na display/grid-template/gap/margin/padding/list-style nadpisuje
   konkurencyjne reguły flex/float z WooCommerce i Astry o wyższej specyficzności.
   ========================================================================== */
body.woocommerce-page #primary ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

body.woocommerce-page #primary ul.products::before,
body.woocommerce-page #primary ul.products::after {
    display: none !important; /* usuwa clearfix WooCommerce */
}

body.woocommerce-page #primary ul.products li.product {
    background: var(--tm-color-surface);
    border: 1px solid var(--tm-color-border);
    border-radius: 12px;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    float: none;
}

body.woocommerce-page #primary ul.products li.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
}

body.woocommerce-page #primary ul.products li.product img {
    width: 100%;
    height: 225px;
    object-fit: cover;
    object-position: center;
    margin-bottom: 0;
    border-radius: 12px 12px 0 0;
    display: block;
}

body.woocommerce-page #primary ul.products li.product .astra-shop-summary-wrap {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

body.woocommerce-page #primary ul.products li.product .ast-woo-product-category {
    position: static;
    display: block;
    font-size: 11px;
    line-height: 1.2;
    color: var(--tm-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

body.woocommerce-page #primary ul.products li.product .woocommerce-loop-product__title {
    padding: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--tm-color-dark);
}

body.woocommerce-page #primary ul.products li.product .button {
    display: block;
    width: 100%;
    margin: auto 0 0;
    padding: 10px 14px;
    border: 1px solid var(--tm-color-primary);
    border-radius: 6px;
    background: transparent;
    color: var(--tm-color-primary);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-transform: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

body.woocommerce-page #primary ul.products li.product .button:hover {
    background: var(--tm-color-primary);
    color: var(--tm-color-surface);
}

/* Paginacja */
nav.woocommerce-pagination {
    margin-top: 25px;
    clear: both;
}
ul.page-numbers { margin-top: 20px; }

/* Responsywność siatki */
@media (max-width: 992px) {
    body.woocommerce-page #primary ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    body.woocommerce-page #primary ul.products li.product img { height: 220px; }
}

@media (max-width: 576px) {
    body.woocommerce-page #primary ul.products {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    body.woocommerce-page #primary ul.products li.product img { height: 250px; }
}


/* ==========================================================================
   8. Ukrycie cen i podsumowań (zapytanie ofertowe)
   --------------------------------------------------------------------------
   !important wymagane do nadpisania core'owych stylów WooCommerce.
   KOSZYK:   kolumny „Cena" i „Kwota" + tabela podliczeń
             (zostaje sam przycisk „Przejdź do podsumowania").
   CHECKOUT: kolumna z kwotą przy produktach + stopka tabeli
             (Podsuma, Wysyłka, Suma końcowa).
   ========================================================================== */
.woocommerce-cart .shop_table th.product-price,
.woocommerce-cart .shop_table td.product-price,
.woocommerce-cart .shop_table th.product-subtotal,
.woocommerce-cart .shop_table td.product-subtotal,
.woocommerce-cart .cart_totals > h2,
.woocommerce-cart .cart_totals table.shop_table,
.woocommerce-checkout .shop_table th.product-total,
.woocommerce-checkout .shop_table td.product-total,
.woocommerce-checkout .shop_table tfoot {
    display: none !important;
}


/* ==========================================================================
   9. Jednostka „m²" + etykieta „Zapotrzebowanie" przy polu ilości
   --------------------------------------------------------------------------
   .unit-m2            – wstrzykiwana do <div class="quantity"> (koszyk)
                         oraz za natywnym inputem ilości (karta produktu).
   .tomawer-qty-label  – pojawia się PRZED inputem na karcie produktu
                         (hook woocommerce_before_quantity_input_field).
   Flex + gap gwarantują, że etykieta, input i jednostka siedzą w jednym rzędzie.
   ========================================================================== */
.woocommerce .quantity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.unit-m2 {
    display: inline-block;
    white-space: nowrap;
    line-height: 1;
}

.tomawer-qty-label {
    display: inline-block;
    margin-right: 4px;
    font-weight: 600;
    line-height: 1;
    color: var(--tm-color-dark);
    white-space: nowrap;
}

/* Na karcie produktu dajemy etykiecie nieco więcej oddechu do przycisku „−". */
body.single-product .woocommerce .quantity .tomawer-qty-label {
    margin-right: 8px;
}


/* ==========================================================================
  10. Strona podziękowania (Thank You / Order Received)
   ========================================================================== */
.tomawer-quote-success-msg {
    margin: 0 0 32px;
    padding: 20px 24px;
    background-color: #eaf2fb;                   /* delikatny odcień --tm-color-primary */
    border-left: 4px solid var(--tm-color-primary);
    border-radius: 8px;
    color: var(--tm-color-dark);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.6;
}

.woocommerce-order .woocommerce-order-details,
.woocommerce-order .woocommerce-customer-details {
    margin-top: 32px;
}

.woocommerce-order .woocommerce-order-details__title,
.woocommerce-order .woocommerce-column__title {
    margin-bottom: 16px;
    font-family: var(--tm-font-heading);
    font-weight: 700;
    color: var(--tm-color-dark);
}

.woocommerce-order table.woocommerce-table--order-details {
    border: 1px solid var(--tm-color-border);
    border-radius: 8px;
    overflow: hidden;
}


/* ==========================================================================
  11. Ukrycie pola „Razem" w Order Overview
  --------------------------------------------------------------------------
  !important wymagane do nadpisania stylów WooCommerce / Astry.
   ========================================================================== */
.woocommerce-order-overview__total {
    display: none !important;
}


/* ==========================================================================
  12. Ceny katalogowe + tekst B2B
   --------------------------------------------------------------------------
   HTML renderowany przez filtr woocommerce_get_price_html (quote-system.php):
     <span class="tomawer-catalog-label">Cena katalogowa: </span>
     <del class="tomawer-catalog-price">KWOTA</del>
     [tylko karta produktu] <div class="tomawer-b2b-promo-text">…</div>
   ========================================================================== */
.tomawer-catalog-label {
    font-size: 13px;
    color: var(--tm-color-text-muted);
    font-weight: 500;
}

.tomawer-catalog-price {
    color: var(--tm-color-text);
    text-decoration: line-through;
}

/* Gdy WooCommerce sam opakował fragment ceny w <ins>/<del> (produkt w promo),
   wymuszamy jednolity wygląd „ceny katalogowej" – całość przekreślona. */
.tomawer-catalog-price ins,
.tomawer-catalog-price .woocommerce-Price-amount {
    background: transparent;
    color: inherit;
    text-decoration: line-through;
}

.tomawer-b2b-promo-text {
    margin-top: 8px;
    color: var(--tm-color-primary);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
}

form #order_review:not(.elementor-widget-woocommerce-checkout-page #order_review) {
    border-color: #D1D5DB !important; 
}
