/* ==========================================================================
   Kando mobile menu — منوی موبایل شناور
   فقط زیر 768px نمایش داده می‌شود. رنگ‌ها و اندازه‌ها از متغیرهای CSS روی .kpm-nav می‌آیند
   (از تنظیمات قالب > عمومی > منوی موبایل).
   ========================================================================== */

.kpm-nav,
.kpm-scrim {
    display: none;
}

@media only screen and (max-width: 767px) {
    .kpm-nav {
        display: block;
        position: fixed;
        inset-inline: var(--kpm-gap, 14px);
        bottom: calc(var(--kpm-gap, 14px) + env(safe-area-inset-bottom, 0px));
        z-index: 998;
        font-family: inherit;
    }

    .kpm-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 997;
        background: rgba(20, 24, 50, .28);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s;
    }

    .kpm-scrim.is-show {
        opacity: 1;
        pointer-events: auto;
    }

    /* ---------- نوار اصلی ---------- */
    .kpm-bar {
        position: relative;
        display: flex;
        align-items: stretch;
        height: 66px;
        padding: 6px;
        background: var(--kpm-bg, #fff);
        border-radius: var(--kpm-radius, 22px);
        box-shadow: 0 10px 30px rgba(30, 34, 70, .16), 0 2px 6px rgba(30, 34, 70, .06);
    }

    /* حباب رنگی آیتم فعال (با JS جابه‌جا می‌شود) */
    .kpm-ind {
        position: absolute;
        top: 6px;
        bottom: 6px;
        inset-inline-start: 6px;
        width: calc((100% - 12px) / var(--kpm-n, 5));
        border-radius: calc(var(--kpm-radius, 22px) - 6px);
        background: color-mix(in srgb, var(--kpm-accent, #1e2f9d) 14%, transparent);
        transition: inset-inline-start .35s cubic-bezier(.34, 1.4, .5, 1), opacity .2s;
        pointer-events: none;
        opacity: 0;
    }

    .kpm-nav.kpm-ready .kpm-ind.has-active {
        opacity: 1;
    }

    /* ---------- آیتم‌ها ---------- */
    .kpm-item {
        position: relative;
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        margin: 0;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
        color: var(--kpm-text, #8a8fa3);
        font: inherit;
        font-size: 10.5px;
        line-height: 1.3;
        white-space: nowrap;
        text-decoration: none;
        cursor: pointer;
        border-radius: calc(var(--kpm-radius, 22px) - 6px);
        transition: color .2s, transform .2s;
    }

    .kpm-item i {
        font-size: 20px;
        line-height: 1;
        transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
    }

    .kpm-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .kpm-item:hover,
    .kpm-item:focus-visible {
        color: var(--kpm-accent, #1e2f9d);
        outline: 0;
    }

    .kpm-item:hover i {
        transform: translateY(-2px);
    }

    .kpm-item:active {
        transform: scale(.94);
    }

    .kpm-item.is-active {
        color: var(--kpm-accent, #1e2f9d);
        font-weight: 700;
    }

    .kpm-item.is-active i {
        transform: translateY(-1px) scale(1.08);
    }

    .kpm-nolabels .kpm-label {
        display: none;
    }

    .kpm-nolabels .kpm-item i {
        font-size: 23px;
    }

    /* نشان عددی */
    .kpm-badge {
        position: absolute;
        top: 7px;
        inset-inline-end: calc(50% - 22px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 8px;
        background: #ff5a6e;
        color: #fff;
        font-size: 9.5px;
        font-weight: 700;
        line-height: 16px;
        text-align: center;
    }

    /* ---------- دکمه «بیشتر» ---------- */
    .kpm-more i {
        transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
    }

    .kpm-nav.is-open .kpm-more {
        color: var(--kpm-accent, #1e2f9d);
    }

    .kpm-nav.is-open .kpm-more i {
        transform: scale(1.2);
    }

    /* ---------- پنل بازشوی بالای منو ---------- */
    .kpm-sheet {
        position: absolute;
        inset-inline: 0;
        bottom: calc(100% + 10px);
        display: flex;
        flex-wrap: wrap;
        padding: 8px;
        background: var(--kpm-bg, #fff);
        border-radius: var(--kpm-radius, 22px);
        box-shadow: 0 14px 34px rgba(30, 34, 70, .2), 0 2px 6px rgba(30, 34, 70, .06);
        opacity: 0;
        transform: translateY(16px) scale(.96);
        transform-origin: bottom center;
        pointer-events: none;
        visibility: hidden;
        transition: opacity .25s, transform .35s cubic-bezier(.34, 1.4, .5, 1), visibility 0s .35s;
    }

    .kpm-nav.is-open .kpm-sheet {
        opacity: 1;
        transform: none;
        pointer-events: auto;
        visibility: visible;
        transition: opacity .25s, transform .35s cubic-bezier(.34, 1.4, .5, 1), visibility 0s;
    }

    .kpm-sheet .kpm-item {
        flex: 0 0 25%;
        height: 62px;
        opacity: 0;
        translate: 0 10px;
        transition: color .2s, transform .2s, background .2s, opacity .3s, translate .35s;
    }

    .kpm-nav.is-open .kpm-sheet .kpm-item {
        opacity: 1;
        translate: 0 0;
    }

    .kpm-nav.is-open .kpm-sheet .kpm-item:nth-child(1) { transition-delay: .04s; }
    .kpm-nav.is-open .kpm-sheet .kpm-item:nth-child(2) { transition-delay: .08s; }
    .kpm-nav.is-open .kpm-sheet .kpm-item:nth-child(3) { transition-delay: .12s; }
    .kpm-nav.is-open .kpm-sheet .kpm-item:nth-child(4) { transition-delay: .16s; }
    .kpm-nav.is-open .kpm-sheet .kpm-item:nth-child(n+5) { transition-delay: .2s; }

    .kpm-sheet .kpm-item:hover,
    .kpm-sheet .kpm-item.is-active {
        background: color-mix(in srgb, var(--kpm-accent, #1e2f9d) 12%, transparent);
    }

    /* جا برای منوی شناور در انتهای صفحه */
    body {
        padding-bottom: calc(var(--kpm-gap, 14px) + 78px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .kpm-nav *,
    .kpm-scrim {
        transition: none !important;
    }
}
