/* Afaq checkout skeleton loaders */

@keyframes afaq-skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.afaq-skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 50%, #eef1f4 75%);
    background-size: 200% 100%;
    animation: afaq-skeleton-shimmer 1.4s ease-in-out infinite;
}

.afaq-skeleton__line {
    height: 14px;
    margin-bottom: 12px;
}

.afaq-skeleton__line--lg {
    height: 18px;
    width: 72%;
}

.afaq-skeleton__line--title {
    height: 22px;
    width: 45%;
    margin-bottom: 20px;
}

.afaq-skeleton__line--sm {
    width: 55%;
}

.afaq-skeleton__box {
    height: 48px;
    margin-bottom: 12px;
    border-radius: 10px;
}

/* Initial checkout page loader */
.afaq-checkout-skeleton {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding: 8px 0 24px;
}

.afaq-checkout-skeleton__main {
    flex: 1 1 62%;
    min-width: 0;
    background: #fff;
    border: 1px solid #eef1f4;
    border-radius: 14px;
    padding: 24px;
}

.afaq-checkout-skeleton__side {
    flex: 0 0 32%;
    max-width: 32%;
    background: #fff;
    border: 1px solid #eef1f4;
    border-radius: 14px;
    padding: 24px;
}

/* Block overlay loader (summary, shipping, cart totals) */
.afaq-skeleton-mask {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(1px);
    z-index: 5;
}

.afaq-skeleton-mask--block {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    min-height: 80px;
}

.afaq-skeleton-mask--block::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border-radius: 12px;
    background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 50%, #eef1f4 75%);
    background-size: 200% 100%;
    animation: afaq-skeleton-shimmer 1.4s ease-in-out infinite;
}

.afaq-skeleton-mask--block::after {
    content: '';
    position: absolute;
    top: calc(50% + 36px);
    left: 50%;
    width: 120px;
    height: 10px;
    margin-left: -60px;
    border-radius: 999px;
    background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 50%, #eef1f4 75%);
    background-size: 200% 100%;
    animation: afaq-skeleton-shimmer 1.4s ease-in-out infinite;
}

.afaq-skeleton-mask .loader img {
    display: none !important;
}

.afaq-skeleton-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    padding: 20px;
    box-sizing: border-box;
}

.afaq-skeleton--overlay {
    width: 100%;
    max-width: 280px;
}

/* Cart page: no full-page white flash during qty updates */
.checkout-cart-index .loading-mask {
    display: none !important;
}

/* processStart overlay on checkout (place order, etc.) */
.checkout-index-index .afaq-checkout-body.checkout-container > .loading-mask,
.checkout-index-index .checkout-container > .loading-mask {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(2px);
}

/* Shipping / summary block loaders when country or rates change */
.checkout-index-index .afaq-checkout-step,
.checkout-index-index #opc-shipping_method,
.checkout-index-index #shipping {
    position: relative;
}

.checkout-index-index .afaq-checkout-step > .afaq-skeleton-mask,
.checkout-index-index #opc-shipping_method > .afaq-skeleton-mask,
.checkout-index-index .afaq-shipping-methods-wrap > .afaq-skeleton-mask {
    z-index: 5;
    border-radius: 14px;
}

.checkout-index-index .afaq-cart-summary-card {
    position: relative;
    overflow: hidden;
}

.checkout-index-index .afaq-shipping-methods-wrap {
    overflow: hidden;
}

.checkout-index-index .afaq-cart-summary-card > .afaq-skeleton-mask {
    z-index: 5;
    border-radius: 14px;
}

.checkout-index-index .afaq-checkout-body.checkout-container > .loading-mask .loader img,
.checkout-index-index .checkout-container > .loading-mask .loader img {
    display: none !important;
}

.checkout-index-index .afaq-checkout-body.checkout-container > .loading-mask .loader::before,
.checkout-index-index .checkout-container > .loading-mask .loader::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 50%, #eef1f4 75%);
    background-size: 200% 100%;
    animation: afaq-skeleton-shimmer 1.4s ease-in-out infinite;
}

.checkout-index-index .afaq-checkout-body.checkout-container > .loading-mask .loader::after,
.checkout-index-index .checkout-container > .loading-mask .loader::after {
    content: '';
    display: block;
    width: 120px;
    height: 10px;
    margin: 0 auto;
    border-radius: 999px;
    background: linear-gradient(90deg, #eef1f4 25%, #f8f9fa 50%, #eef1f4 75%);
    background-size: 200% 100%;
    animation: afaq-skeleton-shimmer 1.4s ease-in-out infinite;
}

.checkout-index-index ._block-content-loading {
    opacity: 1;
}

@media (max-width: 767px) {
    .afaq-checkout-skeleton__main,
    .afaq-checkout-skeleton__side {
        flex: 1 1 100%;
        max-width: 100%;
    }
}
