/*
 * MM IDB JalaliDatePicker viewport adapter v2.0.0
 * Vendor files stay untouched. This layer owns only positioning/containment.
 */

/* The picker is always viewport-positioned. This prevents pageXOffset/pageYOffset
   from creating document width/height and works identically on desktop/mobile. */
.mm-jdp,
body.mm-idb-public-body .mm-jdp,
body.mm-idb-active .mm-jdp {
    position: fixed !important;
    right: auto !important;
    bottom: auto !important;
    width: 294px !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    z-index: 2147483000 !important;
    overscroll-behavior: contain !important;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif !important;
}

.mm-jdp *,
.mm-jdp button,
.mm-jdp input,
.mm-jdp select {
    box-sizing: border-box !important;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif !important;
}

/* While open, never let the picker create horizontal page scrolling. */
html.mm-idb-jdp-open,
html.mm-idb-jdp-open body {
    overflow-x: hidden !important;
    overflow-x: clip !important;
}

/* Public forms should never have a horizontal page axis, independently of the picker. */
html.mm-idb-public-root,
body.mm-idb-public-body {
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow-x: clip !important;
}

body.mm-idb-public-body .mm-idb-public-shell,
body.mm-idb-public-body .mm-idb-public-card,
body.mm-idb-public-body .mm-idb-public-form,
body.mm-idb-public-body .mm-idb-public-form-section,
body.mm-idb-public-body .mm-idb-public-grid,
body.mm-idb-public-body .mm-idb-form-step,
body.mm-idb-public-body .mm-idb-form-stepper {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Admin internal-entry page: clip only while the picker is open so the normal
   Perfex layout/sidebar keeps its native scrolling behaviour at all other times. */
body.mm-idb-active.mm-idb-jdp-open #wrapper,
body.mm-idb-active.mm-idb-jdp-open #mm-idb-app,
body.mm-idb-active.mm-idb-jdp-open .content {
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-x: clip !important;
}

@media (max-width: 767px) {
    .mm-jdp,
    body.mm-idb-public-body .mm-jdp,
    body.mm-idb-active .mm-jdp {
        width: min(294px, calc(100vw - 16px)) !important;
        max-width: calc(100vw - 16px) !important;
        border-radius: 16px !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.mm-idb-public-body .mm-idb-public-shell,
    body.mm-idb-public-body .mm-idb-public-card,
    body.mm-idb-public-body .mm-idb-public-header,
    body.mm-idb-public-body .mm-idb-public-hero,
    body.mm-idb-public-body .mm-idb-public-form,
    body.mm-idb-public-body .mm-idb-public-form-section,
    body.mm-idb-public-body .mm-idb-public-grid,
    body.mm-idb-public-body .mm-idb-public-footer,
    body.mm-idb-public-body .mm-idb-form-step,
    body.mm-idb-public-body .mm-idb-form-stepper,
    body.mm-idb-public-body .mm-idb-step-actions {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body.mm-idb-public-body .mm-idb-public-field,
    body.mm-idb-public-body .mm-idb-public-field.is-half,
    body.mm-idb-public-body .mm-idb-public-field.is-third,
    body.mm-idb-public-body .mm-idb-public-field.is-full,
    body.mm-idb-public-body .mm-idb-public-separator,
    body.mm-idb-public-body .mm-idb-public-content-block {
        min-width: 0 !important;
        max-width: 100% !important;
    }
}

/* v2.1.0 — انتخاب مستقیم ماه و سال بدون دستکاری فایل Vendor */
.mm-jdp .mm-jdp-title {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
}
.mm-jdp .mm-idb-jdp-month-select,
.mm-jdp .mm-idb-jdp-year-select {
    height: 34px !important;
    border: 1px solid #e1e7f0 !important;
    border-radius: 9px !important;
    background: #f8fafc !important;
    color: #28364f !important;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    outline: 0 !important;
    padding: 0 8px !important;
    box-shadow: none !important;
    cursor: pointer !important;
}
.mm-jdp .mm-idb-jdp-month-select { width: 102px !important; }
.mm-jdp .mm-idb-jdp-year-select { width: 72px !important; direction: ltr !important; text-align: center !important; }
.mm-jdp .mm-idb-jdp-month-select:focus,
.mm-jdp .mm-idb-jdp-year-select:focus {
    border-color: #7888e6 !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(79, 99, 221, .08) !important;
}
@media (max-width: 420px) {
    .mm-jdp .mm-jdp-head { gap: 4px !important; }
    .mm-jdp .mm-idb-jdp-month-select { width: 96px !important; }
    .mm-jdp .mm-idb-jdp-year-select { width: 68px !important; }
}
