/* ═══════════════════════════════════════════════════════════
   IMF Bottom Navigation Bar — v1.1.0
   Fix: PWA install banner conflict, Elementor popup z-index,
        hidden items, safe-area handling
   ═══════════════════════════════════════════════════════════ */

:root {
    --imf-pink:       #FF4591;
    --imf-pink-dark:  #e0297a;
    --imf-blue:       #3b82f6;
    --imf-green:      #22c55e;
    --imf-bg:         #ffffff;
    --imf-text:       #6D767F;
    --imf-height:     64px;
    --imf-radius:     20px 20px 0 0;
    --imf-shadow:     0 -4px 24px rgba(0,0,0,0.10);
    --imf-transition: 0.22s cubic-bezier(.4,0,.2,1);
}

/* ── KILL the Elementor popup nav (ID 65) — it conflicts ── */
#elementor-popup-modal-65 {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ── Body spacer ── */
html body {
    padding-bottom: calc(var(--imf-height) + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: hidden !important;
}

/* ── PWA banner: push our bar down when it appears ── */
/* Chrome's install banner pushes the viewport — we stay fixed at 0 */
#imf-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* Render ABOVE Elementor (z-index 9999) and WooCommerce cart */
    z-index: 2147483647 !important;
    height: var(--imf-height);
    /* Extra bottom padding for safe-area (iPhone notch/home bar) */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--imf-bg);
    border-radius: var(--imf-radius);
    box-shadow: var(--imf-shadow);
    border-top: 1px solid rgba(255,69,145,0.10);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Prevent any parent transform from breaking fixed positioning */
    transform: translateZ(0);
    will-change: transform;
    /* Block clicks from passing through */
    pointer-events: all !important;
    /* Never clip children (badges, etc.) */
    overflow: visible !important;
}

/* ── When PWA banner is visible, browser resizes viewport.
       Our nav is fixed so it stays put — no extra fix needed.
       But we hide the banner itself if possible via meta. ── */

.imf-nav-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    height: var(--imf-height);
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 4px;
    overflow: visible !important;
}

/* ── Individual item ── */
.imf-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: 80px;
    text-decoration: none !important;
    background: none !important;
    border: none !important;
    padding: 6px 2px 4px !important;
    cursor: pointer !important;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
    position: relative !important;
    transition: transform var(--imf-transition) !important;
    overflow: visible !important;
    /* Ensure never hidden */
    visibility: visible !important;
    opacity: 1 !important;
}

.imf-nav-item:active { transform: scale(0.88) !important; }

/* ── Icon shell ── */
.imf-nav-icon {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;
    height: 26px !important;
    overflow: visible !important;
}

.imf-nav-icon svg {
    width: 21px !important;
    height: 21px !important;
    fill: var(--imf-text) !important;
    transition: fill var(--imf-transition), transform var(--imf-transition) !important;
    display: block !important;
    flex-shrink: 0 !important;
}

/* ── Label ── */
.imf-nav-label {
    font-size: 10px !important;
    font-weight: 600 !important;
    color: var(--imf-text) !important;
    white-space: nowrap !important;
    letter-spacing: 0.01em !important;
    transition: color var(--imf-transition) !important;
    line-height: 1 !important;
    display: block !important;
}

/* ── Active state ── */
.imf-nav-item--active .imf-nav-icon svg,
.imf-nav-item:hover .imf-nav-icon svg {
    fill: var(--imf-pink) !important;
}

.imf-nav-item--active .imf-nav-label,
.imf-nav-item:hover .imf-nav-label {
    color: var(--imf-pink) !important;
}

/* Active indicator bar on top */
.imf-nav-item--active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--imf-pink), var(--imf-pink-dark));
}

.imf-nav-item--active .imf-nav-icon {
    transform: translateY(-2px);
}

/* ── Badge ── */
.imf-badge {
    position: absolute !important;
    top: -6px !important;
    right: -8px !important;
    min-width: 16px !important;
    height: 16px !important;
    border-radius: 9px !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    line-height: 16px !important;
    text-align: center !important;
    padding: 0 3px !important;
    border: 2px solid var(--imf-bg) !important;
    z-index: 10 !important;
    pointer-events: none !important;
    animation: imf-badge-pulse 2s ease-in-out infinite !important;
}

.imf-badge--notif {
    background: linear-gradient(135deg, #ff3a75, #cc1a5e) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(255,58,117,0.45) !important;
}

.imf-badge--msg {
    background: var(--imf-blue) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(59,130,246,0.45) !important;
}

@keyframes imf-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.18); }
}

/* ── Avatar group (logged-in last item) ── */
.imf-nav-item--avatar-wrap {
    flex: 1 1 0% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 3px !important;
    padding: 4px 2px !important;
    overflow: visible !important;
}

.imf-avatar-notif-group {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
}

/* Bell button — sits top-left of avatar */
.imf-notif-btn {
    position: absolute !important;
    top: -8px !important;
    left: -16px !important;
    background: none !important;
    border: none !important;
    padding: 2px !important;
    cursor: pointer !important;
    outline: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-tap-highlight-color: transparent !important;
    z-index: 5 !important;
    overflow: visible !important;
}

.imf-notif-btn svg {
    width: 15px !important;
    height: 15px !important;
    fill: var(--imf-pink) !important;
    transition: transform var(--imf-transition) !important;
}

.imf-notif-btn:hover svg,
.imf-notif-btn:active svg { transform: rotate(-15deg) scale(1.15) !important; }

/* Avatar image */
.imf-avatar-link {
    position: relative !important;
    display: inline-block !important;
    -webkit-tap-highlight-color: transparent !important;
}

.imf-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--imf-pink) !important;
    transition: box-shadow var(--imf-transition), transform var(--imf-transition) !important;
}

.imf-avatar-link:hover .imf-avatar,
.imf-avatar-link:active .imf-avatar {
    transform: scale(1.06) !important;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--imf-pink-dark) !important;
}

/* Online dot */
.imf-avatar-online {
    position: absolute !important;
    bottom: 1px !important;
    right: 1px !important;
    width: 8px !important;
    height: 8px !important;
    background: var(--imf-green) !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
    animation: imf-online-pulse 2.5s ease-in-out infinite !important;
}

@keyframes imf-online-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.55); }
    70%  { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ── Messages button ── */
.imf-nav-item--action {
    background: none !important;
    border: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* ── Notification panel popup ── */
.imf-notif-panel {
    position: fixed !important;
    bottom: calc(var(--imf-height) + env(safe-area-inset-bottom, 0px) + 10px) !important;
    right: 12px !important;
    left: auto !important;
    width: 300px !important;
    max-height: 50vh !important;
    background: #fff !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.18) !important;
    border: 1px solid rgba(255,69,145,0.12) !important;
    z-index: 2147483646 !important;
    overflow: hidden !important;
    display: none !important;
    flex-direction: column !important;
}

.imf-notif-panel.imf-panel--open {
    display: flex !important;
    animation: imf-panel-in 0.22s cubic-bezier(.4,0,.2,1);
}

@keyframes imf-panel-in {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.imf-panel-header {
    background: linear-gradient(135deg, var(--imf-pink), var(--imf-pink-dark));
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.imf-panel-title { color: #fff; font-size: 14px; font-weight: 800; }

.imf-panel-close {
    background: rgba(255,255,255,0.22);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background var(--imf-transition);
}
.imf-panel-close:hover { background: rgba(255,255,255,0.38); }

.imf-panel-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 8px 0;
}

.imf-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid #f5e8f0;
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.imf-panel-footer a {
    color: var(--imf-pink);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 400px) {
    :root { --imf-height: 60px; }
    .imf-nav-label  { font-size: 9px !important; }
    .imf-avatar     { width: 32px !important; height: 32px !important; }
    .imf-nav-icon svg { width: 19px !important; height: 19px !important; }
    .imf-notif-btn  { left: -14px !important; }
    .imf-notif-panel { width: calc(100vw - 24px) !important; right: 12px !important; left: 12px !important; }
}

/* ── Dark mode ── */
@media (prefers-color-scheme: dark) {
    #imf-bottom-nav {
        --imf-bg:   #18182b;
        --imf-text: #9ca3af;
        background: rgba(24,24,43,0.96) !important;
        border-top-color: rgba(255,69,145,0.18) !important;
    }
    .imf-notif-panel  { background: #18182b !important; }
    .imf-panel-footer { border-top-color: rgba(255,69,145,0.15) !important; }
    .imf-badge        { border-color: #18182b !important; }
    .imf-avatar       { box-shadow: 0 0 0 2px #18182b, 0 0 0 3px var(--imf-pink) !important; }
    .imf-avatar-online { border-color: #18182b !important; }
}

/* ── Conflict fixes: hide competing navbars from Elementor popup 65 ── */
/* These selectors match the popup render from PeepSo widget nav */
.elementor-location-popup .elementor-element-62c5f95e,
.elementor-location-popup .elementor-element-2f5ec2bc {
    display: none !important;
}
