/* ----------------------
/ File: assets/css/checkout-steps.css
/ Theme: Artender
/ Section: Cart + Checkout Steps
/ -------------------- */

/*
 * این فایل فقط ظاهر نوار مراحل سبد خرید و Checkout را کنترل می‌کند.
 * برای ثابت ماندن اندازه و فونت چهار مرحله، باید بعد از تمام CSSهای
 * cart / customer / shipping / payment لود شود.
 */

.artender-commerce-top-steps {
    width: min(calc(100% - 20px), 720px) !important;
    margin: 10px auto 14px !important;
    padding: 12px 14px 10px !important;
    box-sizing: border-box !important;
    border: 1px solid #e4e8ee !important;
    border-radius: 18px !important;
    background: #ffffff !important;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.055) !important;
    direction: rtl !important;
    overflow: hidden !important;
}

.artender-commerce-top-steps .artender-commerce-steps {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: start !important;
    direction: ltr !important;
    isolation: isolate !important;
}

.artender-commerce-top-steps .artender-commerce-steps::before {
    content: "" !important;
    position: absolute !important;
    top: 22px !important;
    right: 12.5% !important;
    left: 12.5% !important;
    width: auto !important;
    height: 2px !important;
    min-height: 2px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #e7ebf0 !important;
    transform: none !important;
    z-index: 0 !important;
}

.artender-commerce-top-steps .artender-commerce-step-line {
    display: none !important;
}

.artender-commerce-top-steps .artender-commerce-step {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    color: #667085 !important;
    direction: rtl !important;
    text-decoration: none !important;
    transform: none !important;
}

.artender-commerce-top-steps .artender-commerce-step-number {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 44px !important;
    box-sizing: border-box !important;
    border: 1.5px solid #dfe4ea !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    color: #596273 !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center !important;
    box-shadow: none !important;
    transform: none !important;
}

.artender-commerce-top-steps .artender-commerce-step-label {
    width: 100% !important;
    max-width: 110px !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: inherit !important;
    font-size: 11.5px !important;
    font-weight: 750 !important;
    line-height: 1.45 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: visible !important;
    transform: none !important;
}

/* مراحل انجام‌شده همان اندازه ثابت را حفظ می‌کنند. */
.artender-commerce-top-steps .artender-commerce-step.is-done {
    color: var(--artender-primary-color, #f50000) !important;
}

.artender-commerce-top-steps .artender-commerce-step.is-done .artender-commerce-step-number {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    border-color: rgba(var(--artender-primary-rgb, 245, 0, 0), 0.25) !important;
    background: #ffffff !important;
    color: var(--artender-primary-color, #f50000) !important;
    box-shadow: none !important;
}

/* فقط رنگ مرحله فعال تغییر می‌کند؛ ابعاد و فونت ثابت می‌مانند. */
.artender-commerce-top-steps .artender-commerce-step.is-active {
    color: var(--artender-primary-color, #f50000) !important;
}

.artender-commerce-top-steps .artender-commerce-step.is-active .artender-commerce-step-number {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    border-color: var(--artender-primary-color, #f50000) !important;
    background: var(--artender-primary-color, #f50000) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 16px rgba(var(--artender-primary-rgb, 245, 0, 0), 0.16) !important;
    transform: none !important;
}

.artender-commerce-top-steps .artender-commerce-step[aria-current="step"] .artender-commerce-step-label,
.artender-commerce-top-steps .artender-commerce-step.is-active .artender-commerce-step-label,
.artender-commerce-top-steps .artender-commerce-step.is-done .artender-commerce-step-label {
    font-size: 11.5px !important;
    font-weight: 750 !important;
}

/* هیچ CSS مرحله‌ای اجازه تغییر اندازه Stepper را ندارد. */
body.artender-checkout-customer-stage .artender-commerce-top-steps,
body.artender-checkout-step-shipping .artender-commerce-top-steps,
body.artender-checkout-step-payment .artender-commerce-top-steps {
    width: min(calc(100% - 20px), 720px) !important;
    margin: 10px auto 14px !important;
    padding: 12px 14px 10px !important;
}

body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-steps,
body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-steps,
body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-steps {
    margin: 0 !important;
    padding: 0 !important;
}

body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-steps::before,
body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-steps::before,
body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-steps::before {
    top: 22px !important;
}

body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step,
body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step,
body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step {
    gap: 7px !important;
}

body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step-number,
body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step-number,
body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step-number {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
    flex-basis: 44px !important;
    font-size: 13px !important;
}

body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step-label,
body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step-label,
body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step-label {
    max-width: 110px !important;
    min-height: 18px !important;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
}

/* Mobile: چهار مرحله همچنان دقیقاً هم‌اندازه هستند. */
@media (max-width: 767px) {
    .artender-commerce-top-steps,
    body.artender-checkout-customer-stage .artender-commerce-top-steps,
    body.artender-checkout-step-shipping .artender-commerce-top-steps,
    body.artender-checkout-step-payment .artender-commerce-top-steps {
        width: calc(100% - 16px) !important;
        margin: 8px auto 10px !important;
        padding: 9px 7px 8px !important;
        border-radius: 14px !important;
    }

    .artender-commerce-top-steps .artender-commerce-steps::before,
    body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-steps::before,
    body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-steps::before,
    body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-steps::before {
        top: 19px !important;
        right: 12.5% !important;
        left: 12.5% !important;
        height: 1.5px !important;
    }

    .artender-commerce-top-steps .artender-commerce-step,
    body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step,
    body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step,
    body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step {
        gap: 5px !important;
    }

    .artender-commerce-top-steps .artender-commerce-step-number,
    .artender-commerce-top-steps .artender-commerce-step.is-active .artender-commerce-step-number,
    .artender-commerce-top-steps .artender-commerce-step.is-done .artender-commerce-step-number,
    body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step-number,
    body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step-number,
    body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step-number {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        max-width: 38px !important;
        max-height: 38px !important;
        flex: 0 0 38px !important;
        font-size: 11.5px !important;
    }

    .artender-commerce-top-steps .artender-commerce-step-label,
    .artender-commerce-top-steps .artender-commerce-step[aria-current="step"] .artender-commerce-step-label,
    .artender-commerce-top-steps .artender-commerce-step.is-active .artender-commerce-step-label,
    .artender-commerce-top-steps .artender-commerce-step.is-done .artender-commerce-step-label,
    body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step-label,
    body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step-label,
    body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step-label {
        width: 100% !important;
        max-width: 78px !important;
        min-height: 16px !important;
        font-size: 9.4px !important;
        font-weight: 750 !important;
        line-height: 1.25 !important;
        white-space: nowrap !important;
    }
}

@media (max-width: 360px) {
    .artender-commerce-top-steps,
    body.artender-checkout-customer-stage .artender-commerce-top-steps,
    body.artender-checkout-step-shipping .artender-commerce-top-steps,
    body.artender-checkout-step-payment .artender-commerce-top-steps {
        width: calc(100% - 12px) !important;
        padding-right: 4px !important;
        padding-left: 4px !important;
    }

    .artender-commerce-top-steps .artender-commerce-step-label,
    body.artender-checkout-customer-stage .artender-commerce-top-steps .artender-commerce-step-label,
    body.artender-checkout-step-shipping .artender-commerce-top-steps .artender-commerce-step-label,
    body.artender-checkout-step-payment .artender-commerce-top-steps .artender-commerce-step-label {
        max-width: 72px !important;
        font-size: 8.8px !important;
    }
}

/* ==========================================================
   Checkout Steps v2
   Remove mobile header search from Cart / Checkout flow only
   ========================================================== */

@media (max-width: 991px) {
    /* Hide the mobile search field throughout the complete purchase flow. */
    body.woocommerce-cart .artender-mobile-search-box,
    body.woocommerce-checkout .artender-mobile-search-box,
    body.artender-commerce-page .artender-mobile-search-box,
    body.artender-checkout-customer-stage .artender-mobile-search-box,
    body.artender-checkout-step-shipping .artender-mobile-search-box,
    body.artender-checkout-step-payment .artender-mobile-search-box {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /*
     * When the lower mobile-header card contains only search,
     * remove the whole row so it does not leave an empty gap.
     */
    body.woocommerce-cart
    .artender-mobile-bottom-card.has-search:not(.has-buy-button),
    body.woocommerce-checkout
    .artender-mobile-bottom-card.has-search:not(.has-buy-button),
    body.artender-commerce-page
    .artender-mobile-bottom-card.has-search:not(.has-buy-button),
    body.artender-checkout-customer-stage
    .artender-mobile-bottom-card.has-search:not(.has-buy-button),
    body.artender-checkout-step-shipping
    .artender-mobile-bottom-card.has-search:not(.has-buy-button),
    body.artender-checkout-step-payment
    .artender-mobile-bottom-card.has-search:not(.has-buy-button) {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    /*
     * If a buy/sell CTA is enabled in the same header card,
     * keep that CTA and collapse the grid to one visible row.
     */
    body.woocommerce-cart
    .artender-mobile-bottom-card.has-search.has-buy-button,
    body.woocommerce-checkout
    .artender-mobile-bottom-card.has-search.has-buy-button,
    body.artender-commerce-page
    .artender-mobile-bottom-card.has-search.has-buy-button,
    body.artender-checkout-customer-stage
    .artender-mobile-bottom-card.has-search.has-buy-button,
    body.artender-checkout-step-shipping
    .artender-mobile-bottom-card.has-search.has-buy-button,
    body.artender-checkout-step-payment
    .artender-mobile-bottom-card.has-search.has-buy-button {
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: auto !important;
        gap: 0 !important;
    }

    body.woocommerce-cart
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button,
    body.woocommerce-checkout
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button,
    body.artender-commerce-page
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button,
    body.artender-checkout-customer-stage
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button,
    body.artender-checkout-step-shipping
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button,
    body.artender-checkout-step-payment
    .artender-mobile-bottom-card.has-search.has-buy-button .artender-mobile-buy-button {
        grid-column: 1 / -1 !important;
        grid-row: 1 !important;
    }

    /* Prevent FiboSearch results/overlay from appearing on checkout stages. */
    body.woocommerce-cart .dgwt-wcas-suggestions-wrapp,
    body.woocommerce-checkout .dgwt-wcas-suggestions-wrapp,
    body.artender-commerce-page .dgwt-wcas-suggestions-wrapp,
    body.artender-checkout-customer-stage .dgwt-wcas-suggestions-wrapp,
    body.artender-checkout-step-shipping .dgwt-wcas-suggestions-wrapp,
    body.artender-checkout-step-payment .dgwt-wcas-suggestions-wrapp {
        display: none !important;
    }
}

/* ==========================================================
   Classic Checkout v2
   Absolute single-stepper guard
   ========================================================== */

body.artender-classic-checkout
[data-artender-commerce-top-steps] ~ [data-artender-commerce-top-steps] {
    display: none !important;
}

/* ==========================================================
   Classic Checkout v3
   Single stepper only
   ========================================================== */

body.artender-classic-checkout
[data-artender-commerce-top-steps]:not(:first-of-type) {
    display: none !important;
}
