html.ap-preorder-open { overflow: hidden; }

#ap-preorder-dialog {
    position: fixed;
    inset: 0;
    box-sizing: border-box;
    width: min(560px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: 32px;
    overflow: auto;
    border: 0;
    border-top: 4px solid var(--wd-primary-color, #fac05e);
    border-radius: var(--wd-brd-radius, 0);
    background: var(--wd-main-bgcolor, #fff);
    color: var(--wd-text-color, #444);
    font-family: var(--wd-text-font, Rubik, Arial, sans-serif);
    box-shadow: 0 20px 60px rgb(0 0 0 / 22%);
}

#ap-preorder-dialog::backdrop { background: rgb(0 0 0 / 58%); }

#ap-preorder-dialog h2 {
    margin: 0 0 16px;
    color: var(--wd-title-color, #242424);
    font-family: inherit;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: none;
}

#ap-preorder-dialog p { margin: 0 0 24px; font-size: 16px; line-height: 1.65; }
#ap-preorder-dialog .ap-preorder-actions { display: flex; gap: 12px; }
#ap-preorder-dialog .button {
    flex: 1;
    min-height: 46px;
    margin: 0;
    padding: 12px 20px;
    border: 1px solid var(--btn-accented-bgcolor, #000);
    border-radius: var(--wd-brd-radius, 0);
    font: inherit;
    font-weight: 500;
    text-transform: none;
    cursor: pointer;
}
#ap-preorder-dialog [data-ap-preorder-confirm] { background: var(--btn-accented-bgcolor, #000); color: var(--btn-accented-color, #fff); }
#ap-preorder-dialog [data-ap-preorder-confirm]:hover { background: var(--btn-accented-bgcolor-hover, #333); }
#ap-preorder-dialog [data-ap-preorder-cancel] { background: transparent; color: var(--wd-title-color, #242424); }
#ap-preorder-dialog [data-ap-preorder-cancel]:hover { background: #f4f4f4; }
#ap-preorder-dialog .button:focus-visible { outline: 3px solid var(--wd-primary-color, #fac05e); outline-offset: 3px; }

@media (max-width: 480px) {
    #ap-preorder-dialog { padding: 24px 20px; }
    #ap-preorder-dialog h2 { font-size: 21px; }
    #ap-preorder-dialog p { font-size: 15px; line-height: 1.6; margin-bottom: 20px; }
    #ap-preorder-dialog .button { padding: 12px 10px; }
}

/* Keep the preorder attribute badge on one line, aligned with the other labels. */
.single-product-page .woocommerce-product-gallery .product-labels .label-attribute-pa_bezkoshtovna-dostavka {
    width: max-content;
    white-space: nowrap;
}
