.mkp-bg,
.mkp-bg * {
    box-sizing: border-box;
}

.mkp-bg {
    --mkp-bg-red: #ef3340;
    --mkp-bg-red-dark: #d92532;
    --mkp-bg-ink: #111827;
    --mkp-bg-muted: #687384;
    --mkp-bg-line: #e2e6eb;
    display: grid;
    grid-template-columns: minmax(320px, 39%) minmax(0, 61%);
    width: min(1320px, calc(100% - 32px));
    min-height: 430px;
    margin: 40px auto;
    overflow: hidden;
    direction: rtl;
    border: 1px solid #121476;
    border-radius: 24px;
    color: var(--mkp-bg-ink);
    background: #fff9f9;
    box-shadow: 0 18px 55px rgba(36, 43, 54, .08);
    font-family: inherit;
}

.mkp-bg button,
.mkp-bg input {
    font: inherit;
}

.mkp-bg__intro {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(32px, 4.3vw, 68px);
    color: #fff;
    background: radial-gradient(circle at 12% 14%, rgba(255, 255, 255, .13), transparent 27%), linear-gradient(145deg, #15178f 0%, #101164 100%);
}

.mkp-bg__intro-eyebrow,
.mkp-bg__wizard-eyebrow,
.mkp-bg__dialog-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -.1px;
}

.mkp-bg__intro-eyebrow {
    margin-bottom: 15px;
    color: rgba(255,255,255,.8);
}

.mkp-bg__intro-title {
    max-width: 420px;
    margin: 0 !important;
    color: #fff !important;
    font-size: clamp(26px, 2.6vw, 39px) !important;
    font-weight: 900 !important;
    line-height: 1.55 !important;
    letter-spacing: -1.2px;
}

.mkp-bg__intro-description {
    max-width: 410px;
    margin: 20px 0 0 !important;
    color: rgba(255,255,255,.88) !important;
    font-size: 14px;
    line-height: 2;
}

.mkp-bg__intro-list {
    display: grid;
    gap: 11px;
    margin: 26px 0 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.mkp-bg__intro-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 !important;
    color: #fff;
    font-size: 13px;
}

.mkp-bg__intro-list li::before {
    content: none !important;
}

.mkp-bg__intro-list li span {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    color: #101166;
    background: #fff;
    font-size: 11px;
    font-weight: 900;
}

.mkp-bg__wizard {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    flex-direction: column;
    padding: clamp(28px, 4vw, 54px);
    background: #fff;
}

.mkp-bg__progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.mkp-bg__wizard-eyebrow {
    color: #788291;
}

.mkp-bg__step-count {
    color: var(--mkp-bg-red);
    font-size: 12px;
}

.mkp-bg__progress {
    height: 5px;
    margin-top: 13px;
    overflow: hidden;
    border-radius: 99px;
    background: #e9ecf0;
}

.mkp-bg__progress span {
    display: block;
    width: 33.333%;
    height: 100%;
    margin-right: 0;
    border-radius: inherit;
    background: var(--mkp-bg-red);
    transition: width .36s cubic-bezier(.2,.75,.25,1);
}

.mkp-bg__stage {
    flex: 1;
    padding-top: 27px;
    animation: mkpBgStageIn .3s ease both;
}

.mkp-bg__question {
    margin: 0 0 20px !important;
    color: var(--mkp-bg-ink) !important;
    font-size: clamp(21px, 2.1vw, 29px) !important;
    font-weight: 900 !important;
    line-height: 1.55 !important;
    letter-spacing: -.6px;
}

.mkp-bg__choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mkp-bg .mkp-bg__choice {
    position: relative;
    display: flex !important;
    min-width: 0;
    min-height: 74px;
    align-items: center;
    gap: 12px;
    margin: 0 !important;
    padding: 12px !important;
    overflow: hidden;
    border: 1px solid var(--mkp-bg-line) !important;
    border-radius: 14px !important;
    color: var(--mkp-bg-ink) !important;
    background: #fff !important;
    box-shadow: 0 4px 14px rgba(17, 24, 39, .025) !important;
    text-align: right;
    line-height: 1.5 !important;
    cursor: pointer;
    appearance: none;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}

.mkp-bg .mkp-bg__choice:hover {
    z-index: 1;
    border-color: #f3a5aa !important;
    background: #fffdfd !important;
    box-shadow: 0 10px 25px rgba(99, 34, 39, .08) !important;
    transform: translateY(-2px);
}

.mkp-bg .mkp-bg__choice:focus-visible {
    outline: 3px solid rgba(239, 51, 64, .22) !important;
    outline-offset: 2px;
}

.mkp-bg .mkp-bg__choice.is-selected {
    border-color: var(--mkp-bg-red) !important;
    background: #fff5f6 !important;
    box-shadow: 0 0 0 2px rgba(239, 51, 64, .1) !important;
}

.mkp-bg__choice-icon {
    display: inline-grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    border-radius: 13px;
    background: #f3f6f9;
    font-size: 23px;
    transition: transform .2s ease, background .2s ease;
}

.mkp-bg__choice:hover .mkp-bg__choice-icon,
.mkp-bg__choice.is-selected .mkp-bg__choice-icon {
    background: #ffe8ea;
    transform: scale(1.04);
}

.mkp-bg__choice-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 4px;
}

.mkp-bg__choice-copy strong {
    overflow: hidden;
    color: #171b23;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mkp-bg__choice-copy small {
    overflow: hidden;
    color: #7a8492;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mkp-bg__choice-check {
    display: inline-grid;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    place-items: center;
    border: 1px solid #d5dbe2;
    border-radius: 50%;
    color: transparent;
    background: #fff;
    font-size: 11px;
    font-weight: 900;
}

.mkp-bg__choice.is-selected .mkp-bg__choice-check {
    border-color: var(--mkp-bg-red);
    color: #fff;
    background: var(--mkp-bg-red);
}

.mkp-bg__route-error {
    margin: 8px 0 0 !important;
    padding: 10px 12px;
    border-radius: 9px;
    color: #a52630;
    background: #fff0f1;
    font-size: 12px;
}

.mkp-bg__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin-top: 21px;
}

.mkp-bg .mkp-bg__button {
    display: inline-flex !important;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 0 !important;
    padding: 9px 19px !important;
    border: 0 !important;
    border-radius: 11px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.4 !important;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, opacity .2s ease, box-shadow .2s ease;
}

.mkp-bg .mkp-bg__button--next {
    margin-inline-start: auto !important;
    color: #fff !important;
    background: var(--mkp-bg-red) !important;
    box-shadow: 0 8px 20px rgba(239, 51, 64, .2) !important;
}

.mkp-bg .mkp-bg__button--next:hover:not(:disabled) {
    background: var(--mkp-bg-red-dark) !important;
    transform: translateY(-1px);
}

.mkp-bg .mkp-bg__button--results {
    min-width: 150px;
}

.mkp-bg .mkp-bg__button--back {
    border: 1px solid #dfe4e9 !important;
    color: #46505e !important;
    background: #fff !important;
}

.mkp-bg .mkp-bg__button:disabled {
    color: #a1a7af !important;
    background: #e8ebef !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: .9;
}

.mkp-bg .mkp-bg__button[hidden],
.mkp-bg [hidden] {
    display: none !important;
}

.mkp-bg__modal {
    position: fixed;
    z-index: 1000000;
    inset: 0;
    display: grid;
    padding: 24px;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}

.mkp-bg__modal.is-open {
    opacity: 1;
    visibility: visible;
}

.mkp-bg__modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .62);
    backdrop-filter: blur(5px);
}

.mkp-bg__dialog {
    position: relative;
    display: flex;
    width: min(1280px, 100%);
    max-height: min(88vh, 900px);
    min-height: 320px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(0,0,0,.26);
    transform: translateY(16px) scale(.985);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
}

.mkp-bg__modal.is-open .mkp-bg__dialog {
    transform: none;
}

.mkp-bg__dialog-head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    border-bottom: 1px solid #e8ebef;
    background: #fff;
}

.mkp-bg__dialog-head h3 {
    margin: 3px 0 0 !important;
    color: #151a22 !important;
    font-size: 21px !important;
    font-weight: 900 !important;
    line-height: 1.5 !important;
}

.mkp-bg__dialog-eyebrow {
    color: var(--mkp-bg-red);
}

.mkp-bg .mkp-bg__close {
    display: inline-grid !important;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    margin: 0 !important;
    padding: 0 !important;
    place-items: center;
    border: 1px solid #e2e6eb !important;
    border-radius: 50% !important;
    color: #303846 !important;
    background: #f7f8fa !important;
    font-size: 27px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    cursor: pointer;
}

.mkp-bg .mkp-bg__close:hover {
    border-color: #f2b4b8 !important;
    color: var(--mkp-bg-red) !important;
    background: #fff4f5 !important;
}

.mkp-bg__dialog-body {
    flex: 1;
    min-height: 0;
    padding: clamp(16px, 3vw, 32px);
    overflow: auto;
    overscroll-behavior: contain;
    background: #f7f8fa;
}

.mkp-bg__loading,
.mkp-bg__empty {
    display: flex;
    min-height: 250px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 9px;
    padding: 30px;
    color: #354050;
    text-align: center;
}

.mkp-bg__loading small,
.mkp-bg__empty p {
    margin: 0 !important;
    color: #7a8492;
}

.mkp-bg__shortcode-debug {
    margin-top: 18px;
    padding: 10px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
}

.mkp-bg__shortcode-debug summary {
    cursor: pointer;
    font-weight: 700;
}

.mkp-bg__shortcode-debug code {
    display: block;
    margin-top: 10px;
    padding: 10px;
    direction: ltr;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
}

.mkp-bg__spinner {
    width: 42px;
    height: 42px;
    margin-bottom: 5px;
    border: 4px solid #f5c8cb;
    border-top-color: var(--mkp-bg-red);
    border-radius: 50%;
    animation: mkpBgSpin .8s linear infinite;
}

.mkp-bg__empty--error strong {
    color: #b4232d;
}

.mkp-bg-modal-open {
    overflow: hidden !important;
}

.mkp-bg-notice {
    width: min(1100px, calc(100% - 32px));
    margin: 24px auto;
    padding: 12px 14px;
    border-right: 4px solid var(--mkp-bg-red, #ef3340);
    border-radius: 8px;
    background: #fff1f2;
}

/* سازگاری خروجی‌های مختلف Procode داخل پاپ‌آپ */
.mkp-bg__dialog-body .procode-card-wrap,
.mkp-bg__dialog-body .procode-full-wrap,
.mkp-bg__dialog-body .procode-table-wrap {
    max-width: 100%;
    margin: 0 auto;
}

.mkp-bg__dialog-body .procode-table-wrap {
    background: #fff;
}

@keyframes mkpBgStageIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: none; }
}

@keyframes mkpBgSpin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    .mkp-bg {
        grid-template-columns: 1fr;
        width: min(720px, calc(100% - 24px));
        border-radius: 20px;
    }

    .mkp-bg__intro,
    .mkp-bg__wizard {
        grid-column: 1;
    }

    .mkp-bg__intro {
        grid-row: 1;
        padding: 32px;
    }

    .mkp-bg__wizard {
        grid-row: 2;
        min-height: 430px;
        padding: 30px;
    }

    .mkp-bg__intro-title {
        max-width: 600px;
        font-size: 28px !important;
    }

    .mkp-bg__intro-description {
        max-width: 620px;
        display:none;
    }

    .mkp-bg__intro-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        display:none;
    }
}

@media (max-width: 580px) {
    .mkp-bg {
        width: calc(100% - 18px);
        margin: 24px auto;
        border-radius: 17px;
        margin-block:0 20px !important;
    }

    .mkp-bg__intro,
    .mkp-bg__wizard {
        padding: 24px 18px;
    }

    .mkp-bg__intro-title {
        font-size: 24px !important;
        line-height: 1.65 !important;
    }

    .mkp-bg__intro-list {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 20px !important;
    }

    .mkp-bg__wizard {
        min-height: 470px;
    }

    .mkp-bg__question {
        font-size: 21px !important;
    }

    .mkp-bg__choices {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .mkp-bg .mkp-bg__choice {
        min-height: 68px;
        border-radius: 12px !important;
    }

    .mkp-bg__choice-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .mkp-bg__actions {
        align-items: stretch;
    }

    .mkp-bg .mkp-bg__button {
        flex: 1;
        padding-inline: 12px !important;
    }

    .mkp-bg__modal {
        padding: 0;
        place-items: stretch;
    }

    .mkp-bg__dialog {
        width: 100%;
        max-height: none;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .mkp-bg__dialog-head {
        padding: 14px 15px;
    }

    .mkp-bg__dialog-head h3 {
        font-size: 17px !important;
    }

    .mkp-bg__dialog-body {
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mkp-bg *,
    .mkp-bg *::before,
    .mkp-bg *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
