/**
 * Floating contact menu (front end).
 * Structural rules only; colours and offsets come from inline CSS variables
 * (--mk-cm-bg, --mk-cm-panel-bg, --mk-cm-left/right, --mk-cm-bottom, --mk-cm-lift).
 */

.mk-cm {
    position: fixed;
    z-index: 9997;
    left: var(--mk-cm-left, 24px);
    right: var(--mk-cm-right, 24px);
    bottom: var(--mk-cm-bottom, 24px);
    display: none;
    direction: rtl;
    font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
}

/* Revealed by JavaScript, so a broken/disabled script never shows a dead button. */
.mk-cm.is-ready {
    display: block;
}

.mk-cm__toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--mk-cm-bg, var(--mk-primary, #2f514a));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
    transition: transform .2s ease, box-shadow .2s ease;
}

.mk-cm__toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, .26);
}

.mk-cm__toggle:focus-visible {
    outline: 3px solid var(--mk-cm-bg, var(--mk-primary, #2f514a));
    outline-offset: 3px;
}

.mk-cm__toggle svg {
    display: block;
}

.mk-cm__toggle-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.mk-cm__toggle-close,
.mk-cm.is-open .mk-cm__toggle-open {
    display: none;
}

.mk-cm.is-open .mk-cm__toggle-close {
    display: block;
}

.mk-cm__panel {
    position: absolute;
    bottom: calc(100% + 14px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 224px;
    max-width: min(88vw, 300px);
    padding: 10px;
    border-radius: 16px;
    background: var(--mk-cm-panel-bg, #fff);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(.97);
    transform-origin: bottom;
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.mk-cm.pos-left .mk-cm__panel {
    left: 0;
}

.mk-cm.pos-right .mk-cm__panel {
    right: 0;
}

.mk-cm.is-open .mk-cm__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.mk-cm__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--mk-text, #242424);
    text-decoration: none;
    background: color-mix(in srgb, currentColor 6%, transparent);
    transition: background .15s ease, transform .15s ease;
}

.mk-cm__item:hover,
.mk-cm__item:focus-visible {
    background: color-mix(in srgb, var(--mk-cm-bg, var(--mk-primary, #2f514a)) 15%, transparent);
    transform: translateX(-2px);
    outline: none;
}

.mk-cm__item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--mk-cm-bg, var(--mk-primary, #2f514a));
}

.mk-cm__item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mk-cm-bg, var(--mk-primary, #2f514a));
    color: #fff;
}

.mk-cm__item-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mk-cm__item-label {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.mk-cm__item-value {
    font-size: 12px;
    opacity: .72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 767px) {
    .mk-cm {
        bottom: calc(var(--mk-cm-bottom, 24px) + var(--mk-cm-lift, 0px) + env(safe-area-inset-bottom, 0px));
    }

    .mk-cm--no-mobile {
        display: none !important;
    }

    .mk-cm__toggle {
        width: 54px;
        height: 54px;
    }
}

@media (min-width: 768px) {
    .mk-cm--no-desktop {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mk-cm__panel,
    .mk-cm__toggle,
    .mk-cm__item {
        transition: none !important;
    }
}
