/* --- GLOBAL HEADER Centering (Logo Left, Menu Center, Icons Right) --- */
/* Applies to standard theme headers site-wide */
header .wp-block-group.alignwide,
header .wp-block-group.alignfull {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 1216px !important; 
    margin: 0 auto !important;
    position: relative !important;
    gap: 20px !important;
    padding: 5px 32px !important; 
    box-sizing: border-box !important;
    min-height: 70px !important;
    position: relative !important;
    left: -25px !important; /* Safer shift than transform */
}

/* Flatten Gutenberg Wrappers */
header .alignwide > div,
header .alignfull > div {
    display: contents !important;
}

/* Col 1: Logo */
.custom-header-logo {
    grid-column: 1 !important;
    display: flex !important;
    justify-content: flex-start !important;
}

.wp-block-site-title, .wp-block-site-title a { display: block !important; }
.custom-header-logo {
    display: flex !important;
    flex-shrink: 0 !important;
}
.custom-header-logo img {
    display: block !important;
    max-height: 50px !important;
    height: 50px !important;
    width: auto !important;
    max-width: none !important;
    flex-shrink: 0 !important;
    object-fit: contain !important;
}

/* Col 2: Navigation */
.wp-block-navigation {
    grid-column: 2 !important;
    display: flex !important;
    justify-content: center !important;
    margin: 0 !important;
}
.wp-block-navigation__container {
    display: flex !important;
    gap: 1.5rem !important;
    justify-content: center !important;
}

/* Col 3: Cart/Account */
.wc-block-mini-cart {
    grid-column: 3 !important;
    display: flex !important;
    justify-content: flex-end !important;
}

/* Prevent horizontal overflow globally and implement sticky footer */
html {
    background-color: #4A5157 !important; /* Fallback for very short views */
    height: 100% !important;
}
body { 
    overflow-x: hidden !important; 
    width: 100% !important; 
    position: relative !important; 
    margin: 0 !important; 
    background-color: #ffffff !important; 
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
}
/* Main Wrapper for FSE/Block themes */
.wp-site-blocks {
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    min-height: 100vh !important;
}

/* FIX: Restore Checkout & Cart Layouts */
body.woocommerce-checkout,
body.woocommerce-checkout .wp-site-blocks,
body.woocommerce-cart,
body.woocommerce-cart .wp-site-blocks {
    display: block !important; /* Reverting flexbox which breaks two-column layouts */
    min-height: auto !important;
}
body.woocommerce-checkout footer,
body.woocommerce-cart footer {
    display: block !important;
    margin-top: 50px !important;
}

/* Gray Top Bar (Global) */
.pf-top-header-bar {
    width: 100%; height: 30px; background-color: #f5f5f5; display: block !important; position: relative !important; z-index: 9999 !important;
}

/* FORCE WHITE BACKGROUND & CONSISTENT THICK BORDERS */
.pf-input {
    background-color: #ffffff !important;
    border: 2px solid #e5e5e5 !important;
}

.pf-input.is-active,
.pf-input:focus {
    border: 2px solid #1a1a1a !important;
    box-shadow: none !important;
    background-color: #ffffff !important;
}

.pf-input:-webkit-autofill,
.pf-input:-webkit-autofill:hover, 
.pf-input:-webkit-autofill:focus, 
.pf-input:-webkit-autofill:active {
    border: 2px solid #1a1a1a !important;
    -webkit-box-shadow: 0 0 0 1000px white inset !important;
    box-shadow: 0 0 0 1000px white inset !important;
    -webkit-text-fill-color: #161615 !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* Hide pre-rendered titles globally during checkout flow */
body.woocommerce-checkout header:not(.pf-checkout-mimic-header),
body.woocommerce-order-received header:not(.pf-checkout-mimic-header) {
    display: none !important;
}
.pf-checkout-mimic-header {
    width: 100% !important; background-color: #ffffff; border-bottom: none !important; z-index: 9998; position: relative; display: block !important;
}

/* Hide Order Again button on Thank You page */
body.woocommerce-order-received .order-again {
    display: none !important;
}

/* Hide Sidebar and default titles ONLY on Step 1, Step 2, or Front Page */
body.pf-parking-flow #sidebar, 
body.pf-parking-flow .sidebar, 
body.pf-parking-flow #secondary, 
body.pf-parking-flow .widget-area { display: none !important; }

body.pf-parking-flow h1, 
body.pf-parking-flow h2, 
body.pf-parking-flow .wp-block-heading, 
body.pf-parking-flow .entry-title, 
body.pf-parking-flow .page-title { display: none !important; }

body.pf-parking-flow .pf-step h1, 
body.pf-parking-flow .pf-step h2, 
body.pf-parking-flow .pf-step h3, 
body.pf-parking-flow .pf-step .pf-section__title { display: block !important; }

body.pf-parking-flow #primary, 
body.pf-parking-flow .content-area, 
body.pf-parking-flow .site-content { width: 100% !important; max-width: 100% !important; float: none !important; margin: 0 auto; }

/* --- CHECKOUT SPECIFIC CENTERING (MIMIC HEADER ONLY) --- */
/* This corresponds to the GROUPED grouping requested for checkout */
body.pf-parking-flow .pf-checkout-mimic-header .pf-header-container {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 1216px !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    padding: 15px 32px !important;
}

/* The transposition anchor has been completely excised to allow native padding flow */
.pf-header-left { grid-column: 1 !important; display: flex !important; justify-content: flex-start !important; }
.pf-header-center { 
    grid-column: 2 !important; 
    display: flex !important; 
    align-items: center !important; 
    justify-content: center !important; 
    gap: 1.25rem !important; /* Balanced gap - Icons close to menu */
}
.pf-header-right-empty { grid-column: 3 !important; display: block !important; }
.pf-checkout-nav { display: flex !important; gap: 1.5rem !important; align-items: center !important; }
.pf-checkout-icons { display: flex !important; gap: 1.25rem !important; align-items: center !important; }

/* Global Polish */
.pf-checkout-logo-group img { height: 50px !important; width: auto !important; }
.pf-parking-flow header a:not(.wc-block-components-button):not(.wp-block-button__link),
.pf-checkout-mimic-header a:not(.wc-block-components-button):not(.wp-block-button__link) {
    color: #3B3B3B !important; font-family: "Roboto", sans-serif !important; font-size: 0.938rem !important; text-decoration: none !important; font-weight: 400 !important;
}

/* FORCE MINI CART VISIBILITY ON CART PAGE */
body.woocommerce-cart .wc-block-mini-cart {
    display: block !important;
    visibility: visible !important;
}

/* RENAME CART TITLE TO "KOSZYK" (CSS Replacement) */
body.woocommerce-cart h1.wp-block-post-title {
    visibility: hidden;
    position: relative;
}
body.woocommerce-cart h1.wp-block-post-title::before {
    content: "Koszyk";
    visibility: visible;
    position: absolute;
    top: 0;
    left: 0;
    /* Ensure it inherits font styles */
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    color: inherit;
    line-height: inherit;
}


/* Fix Mini-Cart Icon clipping and ghosting - ROBUST VERSION */
.wc-block-mini-cart__button,
.wc-block-mini-cart__button:hover,
.wc-block-mini-cart__button:focus,
.wc-block-mini-cart__button:active,
.wc-block-mini-cart__quantity-badge,
.wc-block-mini-cart__quantity-badge:hover {
    background: transparent !important;
    background-image: none !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
}

.wc-block-mini-cart__button::before,
.wc-block-mini-cart__button::after,
.wc-block-mini-cart__quantity-badge::before,
.wc-block-mini-cart__quantity-badge::after,
.wc-block-mini-cart__button:hover::before,
.wc-block-mini-cart__button:hover::after,
.wc-block-mini-cart__quantity-badge:hover::before,
.wc-block-mini-cart__quantity-badge:hover::after {
    content: none !important;
    display: none !important;
    background: none !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
}

.wc-block-mini-cart__button {
    width: auto !important;
    height: 44px !important;
    padding: 0 8px 0 0 !important; /* Padding only on right for badge, 0 on left for alignment */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

.wc-block-mini-cart__quantity-badge {
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* CUSTOM MINI CART ICON - DIRECT SVG OVERRIDE STRATEGY */
.wc-block-mini-cart__icon {
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6.66665 18.3333C7.12688 18.3333 7.49998 17.9602 7.49998 17.5C7.49998 17.0398 7.12688 16.6667 6.66665 16.6667C6.20641 16.6667 5.83331 17.0398 5.83331 17.5C5.83331 17.9602 6.20641 18.3333 6.66665 18.3333Z' stroke='%23666666' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M15.8333 18.3333C16.2936 18.3333 16.6667 17.9602 16.6667 17.5C16.6667 17.0398 16.2936 16.6667 15.8333 16.6667C15.3731 16.6667 15 17.0398 15 17.5C15 17.9602 15.3731 18.3333 15.8333 18.3333Z' stroke='%23666666' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M1.70831 1.70834H3.37498L5.59165 12.0583C5.67296 12.4374 5.88387 12.7762 6.18807 13.0166C6.49227 13.2569 6.87073 13.3836 7.25831 13.375H15.4083C15.7876 13.3744 16.1554 13.2444 16.4508 13.0065C16.7463 12.7687 16.9518 12.4371 17.0333 12.0667L18.4083 5.875H4.26665' stroke='%23666666' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    fill: none !important;
    stroke: none !important;
}



/* Hide internal SVG paths */
.wc-block-mini-cart__icon path,
.wc-block-mini-cart__icon g,
.wc-block-mini-cart__icon circle,
.wc-block-mini-cart__icon rect,
.wc-block-mini-cart__icon use {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.wc-block-mini-cart__button::before {
    display: none !important;
    content: none !important;
}

 .wc-block-mini-cart__button:hover {
    background-color: transparent !important;
}

.wc-block-components-product-price__regular,
.wc-block-components-product-sale-badge,
.wc-block-cart-item__price del,
.wc-block-mini-cart-item__price del,
.wc-block-components-product-price del,
.wc-block-components-sale-badge,
.wc-block-mini-cart-item__price-discount,
.wc-block-components-order-summary-item__quantity,
.wc-block-components-quantity-selector,
.wc-block-mini-cart__footer-subtotal .wc-block-components-totals-item__description,
[class*="product-sale-badge"],
[class*="sale-badge"],
[class*="price__regular"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.wc-block-mini-cart {
    margin-right: 15px !important;
}

/* Hide product thumbnails on Cart, Checkout & Mini-Cart */
body.woocommerce-cart .wc-block-cart-item__image,
body.woocommerce-checkout .wc-block-components-order-summary-item__image,
.wc-block-mini-cart-items .wc-block-cart-item__image,
.wp-block-woocommerce-filled-mini-cart-contents-block .wc-block-cart-item__image {
    display: none !important;
}

/* Force the product details column to expand and consume the space vacated by the deleted image thumbnail */
body.woocommerce-cart td.wc-block-cart-item__product,
body.woocommerce-checkout td.wc-block-components-order-summary-item__description {
    width: 100% !important;
}

.woocommerce-MyAccount-navigation-link--downloads {
    display: none;
}

/* Hide 'New in store' and products on empty cart page */
body.pf-cart-empty h2:not(.wc-block-cart__empty-cart__title),
body.pf-cart-empty hr,
body.pf-cart-empty .wc-block-product-newest,
body.pf-cart-empty .wp-block-woocommerce-product-newest,
body.pf-cart-empty .wp-block-product-new,
body.pf-cart-empty .wp-block-woocommerce-product-new,
body.pf-cart-empty .wc-block-grid,
body.pf-cart-empty .wc-block-cart__empty-cart__products,
body.pf-cart-empty .wc-block-cart--empty + h2,
body.pf-cart-empty .wc-block-cart--empty + .wc-block-product-newest,
body.pf-cart-empty .wc-block-cart--empty + .wp-block-group {
    display: none !important;
}

/* --- GLOBAL FOOTER STYLING --- */
/* Background color and cushion */
footer,
footer .wp-block-template-part,
footer .wp-site-blocks,
footer > .wp-block-group,
footer .wp-block-group.has-background,
footer .wp-block-group {
    background-color: #4A5157 !important;
    --wp--preset--color--primary: #4A5157 !important;
}

/* Ensure ALL children in footer inherit the background if they have background classes */
footer [class*="has-background"],
footer [class*="has-primary-background-color"] {
    background-color: #4A5157 !important;
}

/* Padding/Margin Reset and Cushion */
footer, 
footer .wp-block-group,
footer .wp-block-columns {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Main footer wrapper cushion - ensuring background color covers it */
footer {
    padding-top: 50px !important;
    padding-bottom: 20px !important;
    display: block !important;
    margin-top: auto !important; /* Push to bottom in flex container */
}

/* Force white color and normal weight for footer headings (e.g. "WSPARCIE") */
footer h1, footer h2, footer h3, footer h4, footer h5, footer h6,
footer .wp-block-heading,
footer .wp-block-heading.has-link-color {
    color: #FFFFFF !important;
    font-weight: 400 !important;
    margin-bottom: 28px !important;
    display: block !important;
}

/* --- FOOTER LOGO REPLACEMENT ("PARKING ZDiT") --- */
footer img {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
}

footer .wp-block-site-title *,
footer .custom-header-logo * {
    display: none !important;
}

footer .wp-block-site-title,
footer .custom-header-logo {
    display: inline-block !important;
    position: relative !important;
    width: auto !important;
    height: auto !important;
    font-size: 0 !important;
    line-height: 0 !important;
    margin-top: -10px !important;
}

footer .wp-block-site-title::before,
footer .custom-header-logo::before {
    content: "PARKING" !important;
    display: inline-block !important;
    font-family: "Roboto", sans-serif !important;
    font-size: var(--wp--preset--font-size--large, 2.25rem) !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: #ffffff !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
}

footer .wp-block-site-title::after,
footer .custom-header-logo::after {
    content: "\00a0ZDiT" !important;
    display: inline-block !important;
    font-family: "Roboto", sans-serif !important;
    font-size: var(--wp--preset--font-size--large, 2.25rem) !important;
    font-weight: 400 !important;
    text-transform: none !important;
    color: #ffffff !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* LOGO SIZING */
footer .wp-block-columns .wp-block-site-title::before,
footer .wp-block-columns .custom-header-logo::before,
footer .wp-block-columns .wp-block-site-title::after,
footer .wp-block-columns .custom-header-logo::after {
    font-size: var(--wp--preset--font-size--large, 2.25rem) !important;
}

footer > div > div:not(.wp-block-columns) .wp-block-site-title::before,
footer > div > div:not(.wp-block-columns) .custom-header-logo::before,
footer > div > div:not(.wp-block-columns) .wp-block-site-title::after,
footer > div > div:not(.wp-block-columns) .custom-header-logo::after {
    font-size: var(--wp--preset--font-size--small, 0.875rem) !important;
}
footer > div > div:not(.wp-block-columns) .wp-block-site-title,
footer > div > div:not(.wp-block-columns) .custom-header-logo {
    margin-top: 0 !important;
}

/* Hide Titles on Checkout */
body.woocommerce-checkout .entry-title,
body.woocommerce-checkout .page-title,
body.woocommerce-checkout h1.entry-title,
body.woocommerce-checkout h1,
body.woocommerce-checkout .page-header,
body.woocommerce-checkout .page-header h1,
body.woocommerce-checkout h1:first-of-type,
body.woocommerce-checkout header.entry-header {
    display: none !important;
}

/* Fix button wrapping inside My Account Orders table */
td.woocommerce-orders-table__cell-order-actions { white-space: nowrap !important; }
td.woocommerce-orders-table__cell-order-actions .button { white-space: nowrap !important; }

/* Unify My Account Layout Widths & Prevent Menu Jumping */
/* Force outer containers to full width so they don't shrink-wrap and jump */
body.woocommerce-account .entry-content,
body.woocommerce-account .wp-block-group.has-global-padding {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.woocommerce-account .woocommerce {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    gap: 40px !important;
}

body.woocommerce-account .woocommerce::after, 
body.woocommerce-account .woocommerce::before {
    display: none !important;
}

body.woocommerce-account .woocommerce-MyAccount-navigation {
    flex: 0 0 250px !important; /* Fixed pixel width prevents jumping! */
    max-width: 250px !important;
    width: 250px !important;
    float: none !important;
    margin: 0 !important;
}

body.woocommerce-account .woocommerce-MyAccount-content {
    flex: 1 1 0% !important; /* Flex basis 0 forces it to consume ALL remaining space immediately! */
    max-width: none !important;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
}

/* Mobile responsive collapse for My Account */
@media screen and (max-width: 768px) {
    body.woocommerce-account .woocommerce {
        flex-wrap: wrap !important;
        gap: 20px !important;
    }
    body.woocommerce-account .woocommerce-MyAccount-navigation,
    body.woocommerce-account .woocommerce-MyAccount-content {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Force inner content components to stretch entirely across the right column */
body.woocommerce-account .woocommerce-MyAccount-content table,
body.woocommerce-account .woocommerce-MyAccount-content .u-columns,
body.woocommerce-account .woocommerce-MyAccount-content form {
    width: 100% !important;
    max-width: 100% !important;
}


/* Absolute override for squished My Account content blocks */
body.woocommerce-account table.woocommerce-orders-table, 
body.woocommerce-account .woocommerce-address-fields, 
body.woocommerce-account form.woocommerce-EditAccountForm, 
body.woocommerce-account .u-columns { 
    width: 100% !important; 
    max-width: 100% !important; 
}

/* Fix mobile checkout summary button spacing */
.wc-block-checkout__actions .wp-block-woocommerce-checkout-order-summary-block {
    margin-bottom: 32px !important;
}

/* Replace user icon with text "Konto" ONLY inside the actively opened mobile navigation menu overlay */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog a[href*="/my-account/"] svg,
.has-modal-open .wp-block-navigation__responsive-dialog a[href*="/my-account/"] svg {
    display: none !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog a[href*="/my-account/"]::after,
.has-modal-open .wp-block-navigation__responsive-dialog a[href*="/my-account/"]::after {
    content: "Konto" !important;
    display: inline-block !important;
    font-size: 16px;
    font-weight: 400;
}


/* Checkout Header Hamburger Logic */
.pf-mobile-toggle-btn, .pf-mobile-close-btn, .pf-mobile-konto-link {
    display: none !important;
}

@media screen and (max-width: 768px) {
    .pf-mobile-toggle-btn {
        display: block !important;
        background: none !important;
        border: none !important;
        outline: none !important;
        padding: 5px !important;
        cursor: pointer !important;
        color: #3b3b3b !important;
        order: -1 !important;
    }
    
    .pf-checkout-nav-wrapper {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: #fff !important;
        z-index: 99999 !important;
        display: none !important; /* Hidden until toggled */
        flex-direction: column !important;
        padding: 40px !important;
        box-sizing: border-box !important;
        box-shadow: 0 0 50px rgba(0,0,0,0.5) !important;
    }
    .pf-checkout-nav-wrapper.is-menu-open {
        display: flex !important;
    }
    
    .pf-mobile-close-btn {
        display: block !important;
        background: none !important;
        border: none !important;
        color: #3b3b3b !important;
        cursor: pointer !important;
        position: absolute !important;
        top: 20px !important;
        right: 20px !important;
        padding: 10px !important;
    }
    
    .pf-checkout-nav {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 30px !important;
        margin-top: 50px !important;
    }
    
    nav.pf-checkout-nav a {
        font-size: 24px !important;
        font-weight: 700 !important;
    }
    
    .pf-mobile-konto-link {
        display: block !important;
    }
    
    .pf-desktop-account-icon {
        display: none !important;
    }
}

