/* Frontend styles for Pre-Orders for WooCommerce. */

/*
 * Product page pre-order panel.
 *
 * The panel is printed inside the add-to-cart form. Themes such as XStore lay
 * that form out as one flex row, which squeezed the panel next to the
 * quantity field; it now always takes its own full-width row above them.
 * Override --hwp-preorder-accent in the theme to change the colour.
 */
form.cart:has(> .hwp-preorder-native-extension),
.woocommerce-variation-add-to-cart:has(> .hwp-preorder-native-extension) {
    flex-wrap: wrap;
}

.hwp-preorder-native-extension {
    flex: 0 0 100%;
    order: -1;
    width: 100%;
    max-width: 100%;
}

.hwp-preorder-info {
    --hwp-preorder-accent: var(--et_active-color, #d32f2f);
    --hwp-preorder-surface: #f8f8f8;
    --hwp-preorder-border: #e4e4e4;
    --hwp-preorder-muted: #555;
    clear: both;
    margin: 0 0 20px;
    padding: 16px 18px;
    border: 1px solid var(--hwp-preorder-border);
    border-left: 4px solid var(--hwp-preorder-accent);
    border-radius: 6px;
    background: var(--hwp-preorder-surface);
    line-height: 1.5;
    text-align: start;
}

.hwp-preorder-info__badge,
.hwp-preorder-badge--loop {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--hwp-preorder-accent, var(--et_active-color, #d32f2f));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.4;
    text-transform: uppercase;
}

.hwp-preorder-info__badge {
    margin: 0 0 12px;
}

/* Delivery and quantity rows, each with a small icon tinted in the accent colour. */
.hwp-preorder-info__delivery,
.hwp-preorder-info__remaining,
.hwp-preorder-info__closes,
.hwp-preorder-info__unavailable {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 6px;
}

.hwp-preorder-info__delivery {
    font-weight: 600;
}

.hwp-preorder-info__remaining,
.hwp-preorder-info__closes {
    color: var(--hwp-preorder-muted);
}

.hwp-preorder-info__delivery::before,
.hwp-preorder-info__remaining::before,
.hwp-preorder-info__closes::before {
    content: "";
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: .15em;
    background-color: var(--hwp-preorder-accent);
    -webkit-mask: var(--hwp-preorder-icon) center / contain no-repeat;
    mask: var(--hwp-preorder-icon) center / contain no-repeat;
}

.hwp-preorder-info__delivery::before {
    --hwp-preorder-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

.hwp-preorder-info__remaining::before {
    --hwp-preorder-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 8 12 3 3 8v8l9 5 9-5z'/%3E%3Cpath d='m3 8 9 5 9-5M12 13v8'/%3E%3C/svg%3E");
}

.hwp-preorder-info__closes::before {
    --hwp-preorder-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.hwp-preorder-info__warning,
.hwp-preorder-info__soldout {
    font-weight: 700;
    color: var(--hwp-preorder-accent);
}

.hwp-preorder-button-active {
    cursor: pointer;
}

.hwp-preorder-cart-notice,
.hwp-preorder-checkout-notice,
.hwp-order-notice {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #dcdcde;
    border-left: 3px solid #2271b1;
    background: #f6f7f7;
}

.hwp-preorder-cart-notice p,
.hwp-preorder-checkout-notice p,
.hwp-order-notice p {
    margin: 6px 0 0;
}

.hwp-order-item-delivery {
    margin-top: 5px;
    font-size: .95em;
}

.hwp-account-preorder {
    white-space: nowrap;
}

.hwp-loop-preorder-button--soldout {
    cursor: not-allowed !important;
    opacity: .65;
}

/* Hide normal WooCommerce/theme stock while Pre-Order mode is active. */
body.hwp-preorder-active.single-product .stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-preorder-active.single-product .product-stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-preorder-active.single-product .stock-status:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-preorder-active.single-product .etheme-stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-preorder-active.single-product .et_stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-has-preorder-selection.single-product .stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-has-preorder-selection.single-product .product-stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-has-preorder-selection.single-product .stock-status:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-has-preorder-selection.single-product .etheme-stock:not(.hwp-preorder-stock):not([class*="preorder"]),
body.hwp-has-preorder-selection.single-product .et_stock:not(.hwp-preorder-stock):not([class*="preorder"]) {
    display: none !important;
}

.hwp-preorder-native-extension {
    clear: both;
}

.hwp-block-preorder-item {
    position: relative;
}

@media screen and (max-width: 767px) {
    .hwp-preorder-info {
        margin: 0 0 16px;
        padding: 14px;
    }
}

.hwp-loop-preorder-button--unavailable {
    cursor: not-allowed !important;
    opacity: .65;
}

.hwp-preorder-checkout-items{margin:.75em 0 0 1.25em;padding:0}.hwp-preorder-checkout-items li{margin:.4em 0}.hwp-preorder-checkout-delivery{display:inline-block;margin-top:.15em}

/* 1.7.0 customer experience */

.hwp-preorder-info [hidden],
.hwp-preorder-info[hidden] {
    display: none !important;
}

/* Low quantity: conveyed by the "Only N remaining" text, emphasised visually. */
.hwp-preorder-info__remaining--low,
.hwp-preorder-loop-meta__low {
    font-weight: 700;
    color: #b32d2e;
}

.hwp-preorder-info .hwp-preorder-info__remaining--low {
    color: var(--hwp-preorder-accent);
}

.hwp-preorder-info__unavailable {
    font-weight: 600;
}

/* Visible to store staff only (rendered only for users who can edit the product). */
.hwp-preorder-admin-hint {
    margin: 8px 0;
    padding: 8px 10px;
    border: 1px dashed #b32d2e;
    font-size: .9em;
}

.hwp-preorder-loop-meta {
    margin: 4px 0 8px;
    font-size: .9em;
    line-height: 1.4;
}

.hwp-preorder-loop-meta span {
    display: block;
}

button.hwp-loop-preorder-button[disabled] {
    cursor: not-allowed;
    opacity: .65;
}

.hwp-order-item-badge {
    display: inline-block;
    margin-right: 4px;
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 3px;
    font-size: .85em;
    font-weight: 700;
    line-height: 1.4;
}

.hwp-added-to-cart-preorder {
    display: block;
    margin-top: 4px;
}

/* "How pre-orders work" (native details/summary, keyboard accessible). */
.hwp-preorder-policy {
    margin: 10px 0 0;
}

.hwp-preorder-policy summary {
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
}

/* Inside the product panel: a quiet divider and a chevron instead of the default marker. */
.hwp-preorder-info .hwp-preorder-policy {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--hwp-preorder-border);
    font-size: .92em;
}

.hwp-preorder-info .hwp-preorder-policy summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    color: var(--hwp-preorder-accent);
    text-decoration: none;
}

.hwp-preorder-info .hwp-preorder-policy summary::-webkit-details-marker {
    display: none;
}

.hwp-preorder-info .hwp-preorder-policy summary::after {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .15s ease;
}

.hwp-preorder-info .hwp-preorder-policy[open] summary::after {
    transform: translateY(2px) rotate(-135deg);
}

.hwp-preorder-info .hwp-preorder-policy summary:hover {
    text-decoration: underline;
}

.hwp-preorder-info .hwp-preorder-policy__text {
    color: var(--hwp-preorder-muted);
}

@media (prefers-reduced-motion: reduce) {
    .hwp-preorder-info .hwp-preorder-policy summary::after {
        transition: none;
    }
}

.hwp-preorder-policy__text {
    margin-top: 6px;
}

.hwp-preorder-policy__text p {
    margin: 0 0 6px;
}

.hwp-preorder-acknowledgement {
    margin: 12px 0;
}

/* Visible keyboard focus on plugin controls, whatever the theme does. */
.hwp-preorder-policy summary:focus-visible,
.hwp-loop-preorder-button:focus-visible,
#hwp_preorder_acknowledge:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* "Notify me" form for sold-out pre-orders. */
.hwp-waitlist {
    clear: both;
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #dcdcde;
}

.hwp-waitlist[hidden],
.hwp-waitlist [hidden] {
    display: none !important;
}

.hwp-waitlist p {
    margin: 0 0 8px;
}

.hwp-waitlist__field label {
    display: block;
    font-weight: 600;
}

.hwp-waitlist__field input[type="email"] {
    width: 100%;
    max-width: 360px;
}

/* Honeypot: hidden from people and assistive technology, visible to bots. */
.hwp-waitlist__hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.hwp-waitlist__message:empty {
    display: none;
}

.hwp-waitlist.is-done .hwp-waitlist__message {
    font-weight: 600;
}

.hwp-waitlist__submit:focus-visible,
.hwp-waitlist input:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}
