/* PROATHS – Product Sales Control v1.1.1
 * Unified sales summary for Normal / Preorder / Promotion.
 * Pricing calculations remain native WooCommerce except the existing preorder window.
 */

/* =========================================================
   UNIFIED SINGLE PRODUCT SALES SUMMARY
   ========================================================= */
.single-product .proaths-psc-price-wrap {
    box-sizing: border-box;
    width: 100%;
    margin: 8px 0 16px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(205px, .88fr) minmax(320px, 1.12fr);
    grid-template-areas:
        "status extra"
        "price extra"
        "label extra";
    column-gap: 20px;
    row-gap: 6px;
    align-items: center;
    background: #f7f8fb;
    border: 1px solid #e7eaf0;
}

.single-product .proaths-psc-price-wrap.proaths-psc-mode-normal,
.single-product .proaths-psc-price-wrap.proaths-psc-mode-promotion {
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "status discount"
        "price discount"
        "label discount";
}

/* Sunic keeps its native stock function; the same status is rendered once in
 * the unified sales block, so only the duplicate visual line is suppressed. */
body.single-product.proaths-psc-summary-managed .summary .inventory_status,
body.single-product.proaths-psc-summary-managed .entry-summary .inventory_status,
body.single-product.proaths-psc-summary-managed .rating_brands .inventory_status,
body.single-product.proaths-psc-summary-managed .summary .attr_prod_label.inventory_status,
body.single-product.proaths-psc-summary-managed .rating_brands > .attr_prod_label {
    display: none !important;
}

/* Existing preorder safety: source PHP also omits Buy Now. */
body.single-product.proaths-psc-preorder-active .summary .single_buy_now_button {
    display: none !important;
}

.single-product .proaths-psc-price-wrap > .price {
    grid-area: price;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    color: #0D2968;
    font-size: 30px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
}

.single-product .proaths-psc-price-wrap > .price ins {
    order: 1;
    color: #0D2968 !important;
    font-size: 30px !important;
    font-weight: 700 !important;
    line-height: 1.1 !important;
    text-decoration: none !important;
}

.single-product .proaths-psc-price-wrap > .price del {
    order: 2;
    color: #8b93a4 !important;
    font-size: 18px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    opacity: 1 !important;
}

.single-product .proaths-psc-price-wrap > .price del .amount { color: inherit !important; }
.proaths-psc-sales-info { display: contents; }

.proaths-psc-sales-status {
    grid-area: status;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 10px;
    background: #e9f8ee;
    color: #169c49;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.proaths-psc-status-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #20ad58;
    color: #fff;
    font-size: 12px;
    line-height: 1;
}

.proaths-psc-price-label {
    grid-area: label;
    align-self: start;
    margin: 0;
    color: #5d6678;
    font-size: 12px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.proaths-psc-countdown-panel {
    grid-area: extra;
    box-sizing: border-box;
    min-width: 0;
    padding-left: 20px;
    border-left: 1px solid #d9dde6;
}

.proaths-psc-countdown-title {
    margin: 0 0 9px;
    color: #111827;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: .02em;
}

.proaths-psc-countdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(54px, 1fr));
    gap: 7px;
    width: 100%;
}

.proaths-psc-countdown > div {
    box-sizing: border-box;
    min-width: 0;
    padding: 9px 6px 8px;
    text-align: center;
    background: #fff;
    border: 1px solid #dfe3eb;
}

.proaths-psc-countdown strong {
    display: block;
    color: #0D2968;
    font-size: 21px;
    line-height: 1.05;
    font-weight: 700;
}

.proaths-psc-countdown span {
    display: block;
    margin-top: 4px;
    color: #111827;
    font-size: 10px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: .03em;
}

.proaths-psc-delivery-date {
    margin-top: 10px;
    color: #4f5869;
    font-size: 13px;
    line-height: 1.4;
}
.proaths-psc-delivery-date strong { color: #111827; }

.proaths-psc-discount-pill {
    grid-area: discount;
    align-self: center;
    justify-self: end;
    padding: 8px 12px;
    background: #0D2968;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

/* Archive labels. */
ul.products li.product,
.woocommerce ul.products li.product,
.product-block { position: relative; }

.proaths-preorder-badge,
.proaths-promotion-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 9;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: .2px;
}
.proaths-preorder-badge { background: #1D2F6F; color: #fff; }
.proaths-promotion-badge { background: #FFD54F; color: #111; }

body.proaths-psc-status-preorder .inventory_status { color: #169c49; }
body.proaths-psc-status-low-stock .inventory_status { color: #9a6400; }
body.proaths-psc-status-hidden .inventory_status { display: none !important; }

/* =========================================================
   PREORDER CONFIRM MODAL
   ========================================================= */

#proaths-preorder-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;

    background: rgba(0,0,0,.55);

    align-items: center;
    justify-content: center;

    padding: 20px;
}

.proaths-preorder-modal-box {
    width: 100%;
    max-width: 560px;

    padding: 34px 38px 32px;

    background: #fff;

    font-size: 14px;
    text-align: center;

    box-shadow: 0 12px 40px rgba(0,0,0,.25);
}

.proaths-preorder-modal-box .title {
    margin: 0 0 18px;

    color: #1D2F6F;

    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
}

.proaths-preorder-modal-box p {
    margin: 0 0 18px;

    color: #333;

    font-size: 15px;
    line-height: 1.6;
    text-align: left;
}

.proaths-preorder-confirm-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;

    margin: 10px 0 24px;

    color: #555;

    font-size: 16px;
    line-height: 1.5;
    text-align: left;
}

.proaths-preorder-confirm-row input {
    width: 18px;
    height: 18px;

    margin-top: 2px;

    accent-color: #1D2F6F;

    flex: 0 0 auto;
}

.proaths-preorder-confirm-row a {
    color: #1D2F6F;
    font-weight: 700;
    text-decoration: underline;
}

.proaths-preorder-actions {
    display: flex;
    justify-content: center;
    gap: 18px;
}

.proaths-preorder-actions button {
    min-width: 150px;
    height: 52px;

    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;

    cursor: pointer;
}

#proaths-preorder-confirm {
    background: #1D2F6F;
    color: #fff;
    border: 2px solid #1D2F6F;
}

#proaths-preorder-cancel {
    background: #fff;
    color: #1D2F6F;
    border: 2px solid #1D2F6F;
}

#proaths-preorder-confirm:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1050px) {
    .single-product .proaths-psc-price-wrap,
    .single-product .proaths-psc-price-wrap.proaths-psc-mode-normal,
    .single-product .proaths-psc-price-wrap.proaths-psc-mode-promotion {
        grid-template-columns: 1fr;
        grid-template-areas:
            "status"
            "price"
            "label"
            "discount"
            "extra";
        row-gap: 8px;
    }

    .proaths-psc-countdown-panel {
        margin-top: 6px;
        padding: 14px 0 0;
        border-left: 0;
        border-top: 1px solid #d9dde6;
    }

    .proaths-psc-discount-pill { justify-self: start; }
}

@media (max-width: 575px) {
    .single-product .proaths-psc-price-wrap {
        padding: 14px;
    }

    .single-product .proaths-psc-price-wrap > .price,
    .single-product .proaths-psc-price-wrap > .price ins {
        font-size: 26px !important;
    }

    .proaths-psc-countdown {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }

    .proaths-psc-countdown strong {
        font-size: 18px;
    }

    .proaths-preorder-modal-box {
        padding: 28px 22px;
    }

    .proaths-preorder-actions {
        gap: 10px;
    }

    .proaths-preorder-actions button {
        min-width: 120px;
    }
}


/* v1.1.1 — keep the managed summary anchored consistently across sale modes.
 * The legacy Sunic SAVE badge is intentionally not hidden here; it must be removed at its source. */
body.single-product.proaths-psc-summary-managed .summary .proaths-psc-price-wrap,
body.single-product.proaths-psc-summary-managed .entry-summary .proaths-psc-price-wrap {
    clear: both;
}
