/* Predobjednávka na detaile produktu. Samotný text "Predobjednávka – dodanie: ..."
 * používa štandardný WooCommerce availability riadok, preto ho tu neopakujeme. */
.wcsp-preorder-info {
    margin: .35em 0 1.2em;
    line-height: 1.45;
    font-size: .95em;
}

.wcsp-preorder-info .wcsp-preorder-row {
    display: block;
}

.stock.wcsp-preorder-stock {
    font-weight: 600;
}

/* Hláška pri pokuse zmiešať predobjednávku a bežnú objednávku.
 * Shoptimizer zobrazuje WooCommerce chyby ako toast vpravo dole.
 * Iba našu konkrétnu hlášku presunieme hore do stredu obrazovky. */
body .wcsp-mixed-cart-notice {
    position: fixed !important;
    top: 95px !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999999 !important;
    width: min(680px, calc(100vw - 30px)) !important;
    max-width: 680px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    background: #fff !important;
    color: #222 !important;
    border: 1px solid rgba(0, 0, 0, .16) !important;
    border-left: 5px solid #c00 !important;
    border-radius: 4px !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .22) !important;
}

body .wcsp-mixed-cart-notice li {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: inherit !important;
    list-style: none !important;
}

body .wcsp-mixed-cart-message {
    position: relative;
    display: block;
    padding: 16px 48px 16px 18px;
    color: #222 !important;
    font-size: 15px;
    line-height: 1.45;
}

body .wcsp-mixed-cart-message strong {
    display: block;
    margin: 0 0 4px;
    color: #111 !important;
    font-size: 16px;
}

body .wcsp-mixed-cart-text {
    display: block;
}

body .wcsp-notice-cart-link {
    display: inline-block !important;
    margin-top: 12px !important;
    padding: 7px 11px !important;
    background: #f3f3f3 !important;
    color: #111 !important;
    border: 1px solid rgba(0, 0, 0, .18) !important;
    border-radius: 3px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body .wcsp-notice-cart-link:hover {
    background: #e8e8e8 !important;
    color: #000 !important;
}

body .wcsp-notice-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 26px;
    line-height: 30px;
    cursor: pointer;
}

@media (max-width: 600px) {
    body .wcsp-mixed-cart-notice {
        top: 20px !important;
        width: calc(100vw - 20px) !important;
    }

    body .wcsp-mixed-cart-message {
        padding: 14px 42px 14px 14px;
        font-size: 14px;
    }
}


/* CommerceKit Order Bump has no place in a preorder cart. CommerceKit's documented
 * wrapper is .commercekit-order-bump-wrap; the additional selector covers its
 * related Order Bump elements/variants without touching other CommerceKit modules. */
body.wcsp-preorder-cart .commercekit-order-bump-wrap,
body.wcsp-preorder-cart [class*="commercekit-order-bump"] {
    display: none !important;
}

/* Pri limitovanej predobjednávke používa WooCommerce natívny stav out-of-stock.
 * Zachováme jeho vizuálny význam a iba ponecháme náš identifikátor pre prípadné
 * budúce theme-specific úpravy. */
.stock.wcsp-preorder-soldout {
    font-weight: 600;
}


/* Product-card preorder controls – Shoptimizer-compatible positioning.
 *
 * Shoptimizer anchors the standard catalogue Add to cart button absolutely to
 * the bottom of the whole <li.product> card. WCSP does the same only with the
 * two-button action stack. The stock row itself stays in normal document flow,
 * matching WooCommerce's native <p class="stock in-stock"> placement. */
ul.products li.product.wcsp-preorder-product,
.wc-block-grid__product.wcsp-preorder-product {
    position: relative !important;
}

/* Reserve only the space occupied by the two bottom CTAs. The stock status is
 * deliberately NOT inside this reserved/absolute area. */
ul.products li.product.wcsp-preorder-product .woocommerce-card__header,
.wc-block-grid__product.wcsp-preorder-product .woocommerce-card__header {
    padding-bottom: 94px !important;
    box-sizing: border-box;
}

ul.products li.product.wcsp-preorder-product .wcsp-loop-footer,
.wc-block-grid__product.wcsp-preorder-product .wcsp-loop-footer,
.wcsp-loop-footer {
    display: block !important;
    position: absolute !important;
    left: 15px !important;
    right: auto !important;
    bottom: 0 !important;
    top: auto !important;
    width: calc(100% - 30px) !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    float: none !important;
    clear: none !important;
    box-sizing: border-box;
    z-index: 2;
}

/* This is intentionally a normal-flow WooCommerce stock element. Do not set
 * position, margins, typography or colour here: Shoptimizer/WooCommerce should
 * style it exactly like their other .stock status rows. */
ul.products li.product p.stock.wcsp-loop-stock-status,
.wc-block-grid__product p.stock.wcsp-loop-stock-status,
p.stock.wcsp-loop-stock-status {
    float: none !important;
    width: auto !important;
    box-sizing: border-box;
}

/* Waitlist and Preorder form one two-button stack. The whole footer is anchored
 * to the card bottom; each actual link gets its own hit layer so Shoptimizer's
 * absolute-button rules can never make the preorder button cover the waitlist. */
ul.products li.product .wcsp-loop-actions,
.wcsp-loop-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
    inset: auto !important;
    float: none !important;
    transform: none !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 !important;
    isolation: isolate;
    z-index: 5;
}

ul.products li.product .wcsp-loop-actions > .button,
ul.products li.product .wcsp-loop-actions > a.button,
.wcsp-loop-actions > .button,
.wcsp-loop-actions > a.button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    float: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 40px !important;
    min-height: 40px !important;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 8px !important;
    white-space: normal;
    font-size: clamp(0.75rem,0.623rem + 0.4065vw,0.875rem);
    font-weight: 600;
    line-height: 1.15 !important;
    text-align: center;
    overflow: hidden;
}

/* Explicit stacking order: the waitlist link always owns its visible rectangle. */
ul.products li.product .wcsp-loop-actions > .wcsp-real-stock-cta,
.wcsp-loop-actions > .wcsp-real-stock-cta {
    z-index: 3 !important;
}

ul.products li.product .wcsp-loop-actions > .wcsp-preorder-loop-button,
.wcsp-loop-actions > .wcsp-preorder-loop-button {
    z-index: 2 !important;
}

/* Clear hover feedback makes it obvious which of the two actions will fire. */
ul.products li.product .wcsp-loop-actions > .button:hover,
ul.products li.product .wcsp-loop-actions > .button:focus-visible,
.wcsp-loop-actions > .button:hover,
.wcsp-loop-actions > .button:focus-visible {
    filter: brightness(.92);
    outline: 2px solid rgba(0, 0, 0, .14);
    outline-offset: 1px;
}

/* WCSP's standard availability filter is still useful on the single-product
 * detail. In product loops hide that generated "Predobjednávka" line, because
 * the footer above deliberately renders the real "Nie je na sklade" state. */
ul.products li.product .stock.wcsp-preorder-stock,
.wc-block-grid__product .stock.wcsp-preorder-stock {
    display: none !important;
}

/* WooCommerce's classic AJAX add-to-cart appends a "View cart" link after a
 * successful click. In the two-action preorder card it becomes a third CTA and
 * breaks the layout. The normal cart/header remains available, so suppress this
 * link only inside WCSP preorder product-card actions. */
ul.products li.product .wcsp-loop-actions .added_to_cart.wc-forward,
.wc-block-grid__product .wcsp-loop-actions .added_to_cart.wc-forward,
.wcsp-loop-actions .added_to_cart.wc-forward {
    display: none !important;
}
