/*
 * KDWEB B2B — style motywu potomnego (ładowane przez functions.php jako "kdweb-child-b2b").
 * Kolor wiodący sklepu: #474E2B.
 */

/* ==========================================================================
   Ekran logowania: zdjęcie + logo IBP po lewej, formularz po prawej
   ======================================================================= */
.kdweb-login {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    max-width: 980px;
    margin: 0 auto 2.5rem;
    border: 1px solid #e2e2dc;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .07);
}

.kdweb-login__visual {
    position: relative;
    min-height: 430px;
    overflow: hidden;
    background: #474E2B;
}

/* !important: WooCommerce ustawia "height:auto" dla wszystkich obrazów w .woocommerce. */
.kdweb-login .kdweb-login__photo {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
    /* Zdjęcia z biblioteki mają wtopioną ramkę — lekkie powiększenie ją ucina. */
    transform: scale(1.07);
}

.kdweb-login__visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(30, 34, 16, 0) 35%, rgba(30, 34, 16, .82) 100%);
}

.kdweb-login__visual--plain::after {
    display: none;
}

.kdweb-login__brand {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 24px;
    z-index: 1;
    color: #fff;
}

.kdweb-login__logo {
    display: inline-block;
    margin-bottom: 14px;
    padding: 8px 14px;
    border-radius: 6px;
    background: #fff;
    line-height: 0;
}

.kdweb-login .kdweb-login__logo-img {
    display: block;
    width: auto !important;
    height: 58px !important;
    max-width: 100%;
}

.kdweb-login__title {
    margin: 0 0 4px;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.kdweb-login__text {
    margin: 0;
    font-size: .95rem;
    line-height: 1.4;
    color: #fff;
    opacity: .92;
}

.kdweb-login__panel {
    align-self: center;
    min-width: 0;
    padding: 30px 32px;
}

.kdweb-login__panel > h2 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
}

.woocommerce .kdweb-login form.login,
.woocommerce .kdweb-login form.woocommerce-form-login {
    margin: 0;
    padding: 0;
    border: 0;
}

.kdweb-login__panel .form-row {
    margin-bottom: .6rem;
}

.kdweb-login__panel .kdweb-b2b-register-link {
    margin-top: 16px !important;
    padding-top: 14px;
    border-top: 1px solid #ececec;
}

/* Tytuł strony („Mon compte B2B”) nad oknem logowania — wyśrodkowany, tylko na ekranie logowania. */
body.woocommerce-account:not(.logged-in):has(.kdweb-login) .page-header .entry-title {
    text-align: center;
}

@media (max-width: 800px) {
    body.woocommerce-account:not(.logged-in):has(.kdweb-login) .page-header .entry-title {
        font-size: 30px;
    }

    .kdweb-login {
        grid-template-columns: minmax(0, 1fr);
    }

    .kdweb-login__visual {
        min-height: 200px;
    }

    .kdweb-login__panel {
        padding: 22px 18px;
    }
}

/* ==========================================================================
   Strona produktu (szablon Elementor „product”): bardziej zwarty układ
   - mniejszy tytuł i zdjęcie, dane techniczne obok zdjęcia w niższych wierszach,
   - zdjęcie „przykleja się” podczas przewijania, więc pod nim nie zostaje pusta strefa.
   Selektory nie zależą od ID elementów szablonu, więc działają także po jego przebudowie.
   ======================================================================= */
.single-product [data-elementor-type="product"] .elementor-widget-woocommerce-product-title .product_title {
    font-size: clamp(20px, 2.1vw, 27px);
    font-weight: 700;
    line-height: 1.25;
}

@media (min-width: 1025px) {
    .single-product [data-elementor-type="product"] .elementor-column:has(> .elementor-widget-wrap > .elementor-widget-woocommerce-product-images) {
        width: 40%;
    }

    .single-product [data-elementor-type="product"] .elementor-column:has(> .elementor-widget-wrap > .elementor-widget-woocommerce-product-additional-information) {
        width: 60%;
    }

    .single-product [data-elementor-type="product"] .elementor-widget-woocommerce-product-images {
        position: sticky;
        top: calc(var(--wp-admin--admin-bar--height, 0px) + 20px);
        align-self: flex-start;
    }
}

.single-product [data-elementor-type="product"] table.shop_attributes {
    margin: 0;
    font-size: 13.5px;
}

/* !important: szablon Elementora ustawia własny, większy padding komórek. */
.single-product [data-elementor-type="product"] table.shop_attributes th,
.single-product [data-elementor-type="product"] table.shop_attributes td {
    padding: 6px 12px !important;
    line-height: 1.35;
    vertical-align: middle;
}

.single-product [data-elementor-type="product"] table.shop_attributes th {
    width: 46%;
    font-weight: 600;
}

.single-product [data-elementor-type="product"] table.shop_attributes td {
    font-style: normal;
}

.single-product [data-elementor-type="product"] table.shop_attributes td p {
    margin: 0;
    padding: 0;
}

/* Karty techniczne wstawione shortcodem w szablonie produktu. */
.single-product [data-elementor-type="product"] .kdweb-datasheets--shortcode {
    margin: 8px 0 4px;
    padding-top: 18px;
    border-top: 1px solid #e2e2dc;
}

/* ==========================================================================
   Archiwum produktów (BOUTIQUE) na laptopach 1025–1439 px
   Sekcja z filtrami i listingiem ma w szablonie 100 px odstępu z każdej strony. Na węższych
   ekranach komputerów zabiera to miejsce tabeli, więc odstęp jest tu mniejszy.
   (Tablet i telefon mają własne odstępy ustawione w szablonie Elementora.)
   ======================================================================= */
@media (min-width: 1025px) and (max-width: 1439px) {
    [data-elementor-type="product-archive"] > .elementor-section:has(.elementor-widget-wc-archive-products) {
        padding-left: 40px !important;
        padding-right: 40px !important;
    }
}

/* ==========================================================================
   Nagłówek: koszyk ukryty dla niezalogowanych (wszystkie szerokości).
   5f79a3a = kolumna z widżetem koszyka w szablonie nagłówka (#6620).
   ======================================================================= */
body:not(.logged-in) .elementor-location-header .elementor-element-5f79a3a {
    display: none;
}

/* ==========================================================================
   Nagłówek na tablecie i telefonie (≤ 1024 px) — komputer bez zmian
   Kolejność: telefony obok siebie + e-mail → logo → zielona belka z koszykiem (po lewej)
   i menu (po prawej).
   Sekcja górna nagłówka jest „rozpuszczana” (display: contents), a jej kolumny układane
   siatką razem z belką menu. Dzięki temu koszyk leży na belce bez przenoszenia widżetu
   w Elementorze. Selektory używają ID elementów szablonu nagłówka (#6620):
   c69d0a5 = sekcja górna, 4f4542f = belka menu, c5ef4c6 = logo, bee44cb = e-mail,
   fcd8c5e / 937bc82 = telefony, 889cdc9 = ikony social (ukryte na tablecie/telefonie),
   5f79a3a = koszyk, a080b11 = kolumna menu.
   ======================================================================= */
@media (max-width: 1024px) {
    .elementor-location-header {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        background: #fff;
    }

    .elementor-location-header > .elementor-element-c69d0a5,
    .elementor-location-header > .elementor-element-c69d0a5 > .elementor-container {
        display: contents;
    }

    .elementor-location-header .elementor-element-c69d0a5 > .elementor-container > .elementor-column {
        width: auto;
        min-width: 0;
    }

    .elementor-location-header .elementor-element-c69d0a5 > .elementor-container > .elementor-column > .elementor-widget-wrap {
        padding: 0 8px;
        align-content: center;
    }

    .elementor-location-header .elementor-element-fcd8c5e,
    .elementor-location-header .elementor-element-937bc82,
    .elementor-location-header .elementor-element-bee44cb {
        height: 30px;
    }

    /* Wiersz 1: telefon | telefon | e-mail */
    .elementor-location-header .elementor-element-fcd8c5e {
        grid-column: 1;
        grid-row: 1;
    }

    .elementor-location-header .elementor-element-937bc82 {
        grid-column: 2;
        grid-row: 1;
    }

    .elementor-location-header .elementor-element-bee44cb {
        grid-column: 3;
        grid-row: 1;
    }

    .elementor-location-header .elementor-element-fcd8c5e,
    .elementor-location-header .elementor-element-937bc82,
    .elementor-location-header .elementor-element-bee44cb {
        background: #f4f5ef;
    }

    .elementor-location-header .elementor-element-c69d0a5 .elementor-widget-icon-list .elementor-icon-list-items,
    .elementor-location-header .elementor-element-c69d0a5 .elementor-widget-icon-list .elementor-icon-list-item {
        justify-content: center;
    }

    .elementor-location-header .elementor-element-c69d0a5 .elementor-widget-icon-list .elementor-icon-list-text {
        font-size: 13px;
        line-height: 1.3;
        white-space: nowrap;
    }

    /* Wiersz 2: logo */
    .elementor-location-header .elementor-element-c5ef4c6 {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .elementor-location-header .elementor-element-c5ef4c6 {
        height: 60px;
    }

    .elementor-location-header .elementor-element-c5ef4c6 .elementor-widget-image {
        text-align: center;
    }

    .elementor-location-header .elementor-element-c5ef4c6 .elementor-widget-image img {
        width: auto;
        max-width: min(230px, calc(100% - 250px));
        height: auto;
    }

    /* Przełącznik języka (Linguise) schodzi z wiersza kontaktów na wiersz logo, po prawej.
       Linguise wstawia przełącznik dwukrotnie (linguise_switcher_root i linguise_switcher_wrapper)
       i ustawia pozycję stylem inline (top: 10px), stąd wspólny selektor i !important.
       Zmienna --wp-admin--admin-bar--height dolicza pasek admina u zalogowanej obsługi. */
    .linguise_dropdown_mount nav.linguise_switcher {
        top: calc(36px + var(--wp-admin--admin-bar--height, 0px)) !important;
    }

    /* Ikony social są na tablecie/telefonie ukryte w szablonie — pusta kolumna nie zajmuje miejsca. */
    .elementor-location-header .elementor-element-889cdc9 {
        display: none;
    }

    /* Wiersz 3: belka menu; koszyk leży na jej lewej stronie. */
    .elementor-location-header > .elementor-element-4f4542f {
        grid-column: 1 / -1;
        grid-row: 3;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .elementor-location-header .elementor-element-4f4542f .elementor-element-a080b11 {
        width: 100%;
    }

    .elementor-location-header .elementor-element-4f4542f .uael-nav-menu__toggle {
        min-height: 34px;
        text-align: right !important;
    }

    .elementor-location-header .elementor-element-4f4542f .uael-nav-menu__toggle .uael-nav-menu-icon,
    .elementor-location-header .elementor-element-4f4542f .uael-nav-menu__toggle .uael-nav-menu-icon i {
        color: #fff;
    }

    .elementor-location-header .elementor-element-4f4542f .uael-nav-menu__toggle .uael-nav-menu-icon svg {
        fill: #fff;
    }

    /* Pozycje menu mają w tytułach <br> (układ dwuwierszowy na komputerze) — w rozwijanym
       menu na tablecie/telefonie każda pozycja ma być w jednej linii. */
    .elementor-location-header .elementor-element-4f4542f .uael-nav-menu a br {
        display: none;
    }

    .elementor-location-header .elementor-element-5f79a3a {
        display: flex;
        align-items: center;
        grid-column: 1 / -1;
        grid-row: 3;
        justify-self: start;
        align-self: start;
        z-index: 3;
        height: 54px;
    }

    .elementor-location-header .elementor-element-c69d0a5 > .elementor-container > .elementor-element-5f79a3a > .elementor-widget-wrap {
        padding: 0 0 0 22px;
    }

    .elementor-location-header .elementor-element-5f79a3a .uael-mc__btn {
        padding-left: 0 !important;
        background: transparent !important;
    }

    .elementor-location-header .elementor-element-5f79a3a .uael-mc__btn,
    .elementor-location-header .elementor-element-5f79a3a .uael-mc__btn .uael-mc__btn-text,
    .elementor-location-header .elementor-element-5f79a3a .uael-mc__btn .amount,
    .elementor-location-header .elementor-element-5f79a3a .uael-mc__btn .uael-mc__btn-icon i {
        color: #fff !important;
    }
}

@media (max-width: 767px) {
    .elementor-location-header {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Wiersz 1: telefony obok siebie, wiersz 2: e-mail */
    .elementor-location-header .elementor-element-bee44cb {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .elementor-location-header .elementor-element-fcd8c5e,
    .elementor-location-header .elementor-element-937bc82,
    .elementor-location-header .elementor-element-bee44cb {
        height: 26px;
    }

    .elementor-location-header .elementor-element-c5ef4c6 {
        grid-row: 3;
    }

    /* Logo po lewej, przełącznik języka po prawej w tym samym wierszu. */
    .elementor-location-header .elementor-element-c5ef4c6 .elementor-widget-image {
        padding-left: 6px;
        text-align: left;
    }

    .elementor-location-header .elementor-element-c5ef4c6 .elementor-widget-image img {
        max-width: min(190px, calc(100% - 130px));
    }

    .linguise_dropdown_mount nav.linguise_switcher {
        top: calc(58px + var(--wp-admin--admin-bar--height, 0px)) !important;
    }

    .elementor-location-header > .elementor-element-4f4542f,
    .elementor-location-header .elementor-element-5f79a3a {
        grid-row: 4;
    }

    /* Rozwijany podgląd koszyka (355 px) nie może wystawać poza wąski ekran. */
    .elementor-location-header .elementor-element-5f79a3a .uael-mc-dropdown {
        max-width: calc(100vw - 50px);
    }
}

/* ==========================================================================
   Logo w nagłówku (2026-10-15): logo IBP Group w naturalnych proporcjach,
   bez przycinania (functions.php → kdweb_child_header_logo).
   ======================================================================= */
.elementor-location-header .kdweb-header-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    line-height: 0;
}

.elementor-location-header .kdweb-header-logo img.kdweb-header-logo__img {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 64px;
    object-fit: contain;
}

@media (max-width: 1024px) {
    .elementor-location-header .kdweb-header-logo img.kdweb-header-logo__img {
        max-height: 56px;
    }
}
