.cem-wrapper {
    max-width: 1000px !important;
    margin: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.08);
    padding: 20px;
}

.cem-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content:center;
}

.cem-tab {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    background: #eee;
    cursor: pointer;
    color:#000;
}

.cem-tab.active {
    background: #033a88;
    color: #fff;
}

.cem-content {
    display: none;
    min-height:150px;

}

.cem-content.active {
    display: block;
}

.cem-content input {
    /*width: 100%;*/
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.cem-tree {
    list-style: none;
    padding-right: 20px;
    max-height: 1300px;
    flex-wrap: wrap;
    display: flex;
    flex-direction: column;
}

.cem-tree li {
    margin: 8px 0;
}

.cem-tree ul {
    margin-right: 20px;
    border-right: 2px dashed #ddd;
    padding-right: 15px;
}

.cem-footer {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cem-footer button {
    background: #033a88;
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
}

.cem-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.cem-checkbox input {
    margin: 0;
}

.cem-title {
    flex: 1;
}

.cem-price {
    color: #777;
    font-size: 13px;
}

.cem-level-1 { margin-right: 24px; }
.cem-level-2 { margin-right: 48px; }
.cem-level-3 { margin-right: 72px; }

.cem-next {
    margin-top: 20px;
    text-align: left;
}

.cem-go-final {
    background: #033a88;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
}

.cem-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #ddd;
}





.cem-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cem-level-1 { margin-right: 24px; }
.cem-level-2 { margin-right: 48px; }
.cem-level-3 { margin-right: 72px; }

.cem-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #ddd;
}

button[type="submit"]{
    padding: 7px 10px;
    font-size: 13px;
}


#profile input{
    width:100%;
    color:#000;
}

.cem-error {
    border-color: #e63946 !important;
    background: #fff5f5;
}



.cem-error-text {
    color: #e63946;
    font-size: 13px;
    margin-bottom: 10px;
}

#cem-fixed-total{
    position: absolute;
    width:180px;
    top: 100px;
    left: -10px;
    text-align:center;
    background: #033a88;
    color: #fff;
    padding: 15px 0px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    z-index: -1;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    font-weight: bold;
    rotate:-90deg;
}









#cem-form,
.cem-form {
    position: relative;
}

/* لودر فقط در محدوده فرم */
#cem-loader,
.cem-loader {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: all;
}

/* بک‌گراند فقط روی فرم */
.cem-loader-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    width:1000px;
    margin:auto;
}

/* مرکز فرم */
.cem-loader-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.cem-loader-spinner {
    width: 46px;
    height: 46px;
    border: 4px solid #ddd;
    border-top-color: #033a88;
    border-radius: 50%;
    animation: cem-spin .9s linear infinite;
    margin: 0 auto;
}

.cem-loader-text {
    margin-top: 10px;
    font-size: 14px;
    color: #333;
}

@keyframes cem-spin {
    to { transform: rotate(360deg); }
}


/* ===== Drag & Drop Upload ===== */
.cem-upload-wrapper {
    margin-bottom: 10px;
}

.cem-upload-wrapper input[type="file"] {
    display: none;
}

.cem-upload-box {
    border: 2px dashed #d6dbf5;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(180deg, #fafbff, #f3f6ff);
    transition: all .25s ease;
    display: block;
}

.cem-upload-box:hover {
    border-color: #033A88;
    background: #eef2ff;
}

.cem-upload-box.dragover {
    border-color: #033A88;
    background: #e7edff;
    box-shadow: 0 0 0 4px rgba(3,58,136,.08);
}

.cem-upload-icon {
    margin-bottom: 12px;
}

.cem-upload-text strong {
    display: block;
    font-size: 15px;
    color: #033A88;
}

.cem-upload-text span {
    font-size: 12px;
    color: #666;
}

.cem-upload-filename {
    margin-top: 12px;
    font-size: 12px;
    padding: 6px 14px;
    display: inline-block;
    border-radius: 20px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #e5e8ff;
    color: #333;
}














/* ===============================
   Responsive (Tablet & Mobile)
================================ */

@media (max-width: 992px) {

    .cem-wrapper {
        padding: 15px;
        border-radius: 10px;
    }

    /* Tabs */
    .cem-tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 8px;
        padding-bottom: 10px;
        padding-left: 2px;
    }

    .cem-tab {
        white-space: nowrap;
        font-size: 14px;
        padding: 8px 14px;
        flex-shrink: 0;
    }

    /* Inputs */
    .cem-content input,
    .cem-content textarea {
        /*width: 100%;*/
        font-size: 14px;
    }

    /* Tree */
    .cem-tree {
        padding-right: 10px;
        max-height: none;
    }

    .cem-tree ul {
        margin-right: 12px;
        padding-right: 10px;
    }

    /* Checkbox rows */
    .cem-checkbox {
        align-items: flex-start;
        gap: 8px;
        flex-wrap: wrap;
    }

    .cem-checkbox span {
        line-height: 1.6;
    }

    .cem-price {
        width: 100%;
        font-size: 12px;
        color: #555;
        margin-right: 26px;
    }

    /* Buttons */
    .cem-go-final,
    #final button {
        width: 100%;
        padding: 14px;
        font-size: 15px;
        border-radius: 10px;
    }
}

/* ===============================
   Mobile (Small devices)
================================ */

@media (max-width: 576px) {

    .cem-wrapper {
        box-shadow: none;
        border-radius: 0;
    }

    /* Fixed total */
    #cem-fixed-total {
        font-size: 10px;
        padding: 8px 10px;
        width: 150px;
        rotate: unset;
        top: -30px;
        left: 0px;
    }

    /* Tabs */
    .cem-tab {
        font-size: 13px;
        padding: 7px 12px;
    }

    /* Tree depth control */
    .cem-tree ul {
        border-right: 1px dashed #ccc;
    }

    /* Summary */
    #cem-summary,
.cem-summary {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .cem-summary-item {
        display: flex;
        justify-content: space-between;
        background: #f7f8fb;
        padding: 10px;
        border-radius: 8px;
        font-size: 14px;
    }

    /* Loader */
    .cem-loader-box {
        width: 90%;
        padding: 20px;
    }
}



.cem-summary_before{
    font-family:Dananum;
    display:flex;
    justify-content:center;
    align-items:center;
    font-size:16px;
    color:#033A88;
    margin-bottom:10px;
    /*position:relative;*/
}
/*.cem-summary_before::after{*/
/*    content:'';*/
/*    width:80%;*/
/*    border-bottom:1px dashed #033A88;*/
/*    display:block;*/
/*    position: absolute;*/
/*    bottom: 0px;*/
/*}*/


.cem-extra-form_before{
    font-family:Dananum;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    font-size:12px;
    color:#000;
    margin-bottom:15px;
}

.cem-extra-form_before_first{
    font-size:16px;
    color:#033A88;
}

.cem-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.cem-disabled .cem-price {
    color: #999;
}


.cem-extra-form {
    margin-bottom: 20px;
}

.cem-row input{
    font-family:Dananum;
}

.cem-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    /*margin-bottom: 12px;*/
}

.cem-row > * {
    flex: 1 1 calc(50% - 6px); /* دو ستون با فاصله 12px */
}

@media (max-width: 768px) {
    .cem-row > * {
        flex: 1 1 100%; /* یک ستون روی موبایل */
    }
}





/*.cem-banner-plans {*/
/*    display:flex;*/
/*    gap:20px;*/
/*    justify-content:center;*/
/*}*/

/*.cem-banner-card {*/
/*    width:240px;*/
/*    border-radius:12px;*/
/*    overflow:hidden;*/
/*    cursor:pointer;*/
/*    border:2px solid transparent;*/
/*}*/

/*.cem-banner-card.active {*/
/*    border-color:#033A88;*/
/*}*/

/*.cem-banner-preview img {*/
/*    width:100%;*/
/*    display:block;*/
/*    margin:20px auto;*/
/*}*/


/* CEM minimal overflow guard: فقط برای جلوگیری از بیرون‌زدن دسته‌بندی‌ها، بدون ریدیزاین فرم */
.cem-wrapper,
.cem-wrapper * {
    box-sizing: border-box;
}

.cem-wrapper,
#cem-form,
.cem-form,
.cem-content,
.cem-tabs,
.cem-tree,
.cem-tree li,
.cem-tree ul,
.cem-row,
.cem-upload-box,
.cem-upload-filename,
#cem-summary,
.cem-summary,
.cem-summary-item {
    max-width: 100%;
}

.cem-wrapper,
.cem-content,
.cem-tree,
.cem-tree ul,
.cem-tree li,
.cem-checkbox,
.cem-row > * {
    min-width: 0;
}

.cem-wrapper,
.cem-content,
.cem-tree {
    overflow-x: hidden;
}

.cem-checkbox > span:not(.cem-price),
.cem-checkbox > strong,
.cem-summary-item > span,
.cem-upload-filename {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.cem-price {
    flex-shrink: 0;
}

.cem-loader-backdrop {
    max-width: 100%;
}

@media (max-width: 640px) {
    .cem-checkbox {
        align-items: flex-start;
    }

    .cem-price {
        white-space: normal;
    }
}

/* ===== Category price discount display ===== */
.cem-price-discounted {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    color: #033A88;
}

.cem-price-discounted del {
    color: #8a8f98;
    font-size: 12px;
    text-decoration-thickness: 2px;
}

.cem-price-discounted strong {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eaf6ef;
    color: #168447;
    font-size: 13px;
    line-height: 1.6;
}

.cem-price-discounted em {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff2d8;
    color: #9a5b00;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

/* ===== Duration selector ===== */
.cem-duration-section {
    margin: 22px 0;
    padding: 18px;
    border: 1px solid #e1e8f5;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff, #f7faff);
}

.cem-duration-section.cem-error-box {
    border-color: #e63946;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, .08);
}

.cem-duration-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.cem-duration-heading span {
    color: #033A88;
    font-size: 16px;
    font-weight: 800;
}

.cem-duration-heading small {
    color: #667085;
    font-size: 12px;
}

.cem-duration-plans {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.cem-duration-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
    padding: 25px;
    border: 1px solid #dce5f5;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.cem-duration-card:hover,
.cem-duration-card.active {
    transform: translateY(-2px);
    border-color: #033A88;
    box-shadow: 0 14px 30px rgba(3, 58, 136, .10);
}

.cem-duration-card input {
    position: absolute;
    inset-inline-start: 10px;
    top: 10px;
    width: auto;
    margin: 0;
}

.cem-duration-title {
    color: #111827;
    font-size: 17px;
    font-weight: 900;
}

.cem-duration-card strong {
    color: #033A88;
    font-size: 15px;
}

.cem-duration-card em {
    margin-top: auto;
    color: #667085;
    font-size: 12px;
    font-style: normal;
    line-height: 1.7;
}

/* ===== Invoice summary ===== */
#cem-duration-summary,
.cem-duration-summary {
    margin: 14px 0 12px;
    padding: 12px;
    border-radius: 14px;
    background: #f7f9fd;
}

.cem-summary-item {
    gap: 8px;
    flex-wrap: wrap;
}

.cem-summary-item small {
    flex-basis: 100%;
    color: #8a8f98;
    font-size: 11px;
}

.cem-empty-summary {
    padding: 12px;
    border-radius: 12px;
    background: #f7f8fb;
    color: #667085;
    text-align: center;
}

.cem-invoice-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed #dce5f5;
}

.cem-invoice-line:last-child {
    border-bottom: 0;
}

.cem-invoice-line span {
    color: #667085;
}

.cem-invoice-line strong {
    color: #111827;
}

.cem-invoice-discount strong {
    color: #168447;
}

.cem-invoice-waiting strong {
    color: #9a5b00;
}

.cem-payable-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #033A88;
    color: #fff;
    font-size: 16px;
}

@media (max-width: 768px) {
    .cem-duration-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .cem-duration-plans {
        grid-template-columns: 1fr;
    }

    .cem-price-discounted,
    .cem-invoice-line,
    .cem-payable-total {
        align-items: flex-start;
    }
}


/* ===== CEM 6.0.2: Separate discounts + account plan panel ===== */
.cem-price-discounted {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cem-price-discounted del,
.cem-summary-regular-price {
    color: #d92d20;
    text-decoration-line: line-through;
    text-decoration-color: #d92d20;
    text-decoration-thickness: 2px;
    opacity: .9;
}

.cem-price-discounted strong {
    color: #168447;
    font-weight: 900;
}

.cem-summary-regular-price {
    flex-basis: 100%;
    font-size: 12px;
}

.cem-account-plans {
    display: flex;
    flex-direction: column;
    gap: 16px;
    direction: rtl;
}

.cem-account-plans h2 {
    margin: 0;
    color: #033A88;
    font-size: 22px;
    font-weight: 900;
}

.cem-account-plans-intro,
.cem-account-empty {
    margin: 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: #f7f9fd;
    color: #667085;
}

.cem-account-plan-card {
    padding: 18px;
    border: 1px solid #dce5f5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(3, 58, 136, .07);
}

.cem-account-plan-card.is-expired {
    opacity: .82;
}

.cem-account-plan-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.cem-account-plan-type {
    display: inline-flex;
    margin-bottom: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #033A88;
    font-size: 12px;
    font-weight: 800;
}

.cem-account-plan-card h3 {
    margin: 0;
    color: #111827;
    font-size: 18px;
    font-weight: 900;
}

.cem-account-plan-status {
    flex: 0 0 auto;
}

.cem-account-status,
.cem-status-expired {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f2f4f7;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.cem-status-expired {
    background: #fff1f3;
    color: #b42318;
}

.cem-account-plan-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.cem-account-plan-grid > div {
    padding: 12px;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    background: #fbfcff;
}

.cem-account-plan-grid span {
    display: block;
    margin-bottom: 6px;
    color: #667085;
    font-size: 12px;
}

.cem-account-plan-grid strong {
    color: #111827;
    font-size: 13px;
    font-weight: 900;
}

.cem-account-categories {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f7f9fd;
    color: #344054;
    font-size: 13px;
    line-height: 1.8;
}

.cem-account-categories span {
    color: #033A88;
    font-weight: 900;
}

.cem-account-progress {
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

.cem-account-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #168447;
}

.cem-account-plan-card.is-expired .cem-account-progress span {
    background: #d92d20;
}

@media (max-width: 768px) {
    .cem-account-plan-head {
        flex-direction: column;
    }

    .cem-account-plan-grid {
        grid-template-columns: 1fr;
    }
}

.cem-form button[type="submit"].cem-submitting,
.cem-form button[type="submit"]:disabled {
    opacity: .7;
    cursor: wait;
}

.cem-price-discounted del {
    text-decoration-line: line-through;
    text-decoration-color: #d92d20;
    text-decoration-thickness: 2px;
}



/* =====================================================
   MP Checkout Auth UI
===================================================== */
.mp-checkout-auth{
    margin: 0 0 16px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: linear-gradient(180deg,#ffffff,#f8fafc);
    box-shadow: 0 6px 18px rgba(15,23,42,.05);
    clear: both;
}
.mp-auth-intro{
    font-size: 13px;
    color: #334155;
    line-height: 1.9;
    margin-bottom: 10px;
}
.mp-auth-actions,
.mp-auth-otp-step{
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.mp-auth-send-code,
.mp-auth-verify-code{
    border: 0;
    border-radius: 10px;
    background: #033a88;
    color: #fff;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: transform .15s ease, opacity .15s ease;
}
.mp-auth-send-code:hover,
.mp-auth-verify-code:hover{ transform: translateY(-1px); opacity: .94; }
.mp-auth-send-code:disabled,
.mp-auth-verify-code:disabled{ opacity: .65; cursor: not-allowed; transform: none; }
.mp-auth-otp-code{
    width: 170px !important;
    max-width: 100%;
    text-align: center;
    direction: ltr;
    letter-spacing: 4px;
    font-size: 16px;
    margin: 0 !important;
}
.mp-auth-status{
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.8;
}
.mp-auth-status-ok{ color: #047857; }
.mp-auth-status-error{ color: #dc2626; }
.mp-auth-status-info{ color: #475569; }
.mp-checkout-auth.is-busy{ opacity: .85; }
@media (max-width: 640px){
    .mp-auth-actions,
    .mp-auth-otp-step{ flex-direction: column; align-items: stretch; }
    .mp-auth-send-code,
    .mp-auth-verify-code,
    .mp-auth-otp-code{ width: 100% !important; }
}
