/* ========================================
   MOBILE MENU - iOS STYLE + WALLET
   v2.4.1
   @fix: body.mm-open без position:fixed (усуває стрибок хедера)
   @fix: safe-area padding-bottom — прибрано дублювання
   ======================================== */

/* Desktop: приховати */
@media (min-width: 769px) {
    .mm-toggle, .mm-overlay, .mm-panel { display: none !important; }
}

/* Системний шрифт */
.mm-panel, .mm-panel * {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Контейнер в хедері */
.elementor-shortcode:has(.mm-toggle) {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

/* === КНОПКА TOGGLE === */
.mm-toggle {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.mm-toggle svg {
    width: 28px !important;
    height: 28px !important;
    fill: #212529 !important;
}

.mm-toggle span {
    display: none !important;
}

/* === OVERLAY з BLUR === */
.mm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.mm-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === ПАНЕЛЬ МЕНЮ === */
.mm-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0; /* ключове */
    width: 85%;
    max-width: 320px;
    height: auto; /* ок, можна навіть прибрати */
    background: #f8f9fa;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border-radius: 0 !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow: hidden;
    overscroll-behavior: contain;
}

.mm-panel.active {
    transform: translateX(0);
}

/*
 * FIX v2.4.1: прибрано position:fixed, width:100%, height:100%
 * Ці властивості викликали зміщення sticky/fixed хедера при відкритті меню.
 * Тепер блокуємо лише overflow — JS додає paddingRight для компенсації scrollbar.
 */
body.mm-open {
    overflow: hidden !important;
}

/* === ЕКРАНИ === */
.mm-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.mm-screen.active {
    opacity: 1;
    visibility: visible;
}

.mm-main { transform: translateX(-30%); }
.mm-main.active { transform: translateX(0); }

.mm-brands { transform: translateX(100%); }
.mm-brands.active { transform: translateX(0); }

/* === LOGO AREA (reserved) === */
.mm-logo-area {
    height: 80px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

/* === НАВІГАЦІЯ === */
.mm-nav {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 12px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mm-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 0;
    color: #212529 !important;
    text-decoration: none !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid #D0DBE2;
}

.mm-item:last-child {
    border-bottom: none;
}

.mm-item:active {
    background: #3b82f6;
    color: #fff !important;
}

.mm-item:active .mm-icon,
.mm-item:active .mm-arrow {
    fill: #fff !important;
}

.mm-icon {
    width: 28px !important;
    height: 28px !important;
    fill: #D0DBE2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.mm-arrow {
    width: 28px !important;
    height: 28px !important;
    fill: #D0DBE2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* === BACK BUTTON === */
.mm-back {
    width: 32px !important;
    height: 32px !important;
    background: none !important;
    border: none !important;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
    transition: transform 0.15s, background 0.15s;
    padding: 0 !important;
}

.mm-back:active {
    transform: scale(0.92);
    background: #f1f3f5 !important;
}

.mm-back svg {
    width: 24px !important;
    height: 24px !important;
    fill: #007AFF !important;
}

/* === BADGE === */
.mm-label {
    flex: 1;
    position: relative;
    display: inline;
}

.mm-badge {
    position: relative;
    top: -10px;
    margin-left: 2px;
    background: #3b82f6;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 14px;
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* === FOOTER (користувач) === */
.mm-footer {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0 !important;
    /* FIX v2.4.1: прибрано дублювання padding-bottom.
       @supports блок нижче є єдиним джерелом safe-area відступу. */
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mm-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Кнопка входу з градієнтом */
.mm-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border-radius: 14px;
    text-decoration: none;
    transition: transform 0.15s, opacity 0.15s;
}

.mm-login:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.mm-login-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mm-login-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.mm-login-text {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

/* Залогінений користувач */
.mm-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin: -8px;
    text-decoration: none;
    border-radius: 14px;
    transition: transform 0.15s, background 0.15s;
}

.mm-user:active {
    transform: scale(0.98);
    background: #f8f9fa;
}

/* Аватар з градієнтом */
.mm-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mm-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mm-user-info {
    flex: 1;
    min-width: 0;
}

.mm-user-name {
    font-size: 18px !important;
    font-weight: 500 !important;
    color: #212529 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 20px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.mm-user-sub {
    font-size: 13px !important;
    color: #868e96 !important;
    margin-top: 2px !important;
    display: block !important;
    line-height: 1.3 !important;
    height: auto !important;
}

/* === WALLET BALANCE === */
.mm-wallet {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    background: #10b981;
    border-radius: 14px;
    margin-top: 14px;
}

.mm-wallet-text {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* === HEADER (екран брендів) === */
.mm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

.mm-title {
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #212529 !important;
}

/* === БРЕНДИ === */
.mm-brands {
    background: #f8f9fa;
}

.mm-brands-grid {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    align-content: start;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mm-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    text-decoration: none;
    border-radius: 14px;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease-out;
}

.mm-brand:active {
    transform: scale(0.92);
}

.mm-brand-logo {
    width: 56px;
    height: 56px;
    background: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}

.mm-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding-left: 5px;
    padding-right: 5px;
}

.mm-brand-name {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
    text-align: center;
    line-height: 1.3;
}