/**
 * Mobile Bottom Navigation — premium animated glass bar
 */

.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    body {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }

    body.employer-portal-page .bottom-nav {
        display: none !important;
    }

    .bottom-nav {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        padding: 0 max(8px, env(safe-area-inset-left, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-right, 0px));
        pointer-events: none;
        animation: mbnSlideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    @keyframes mbnSlideUp {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .mbn-shell {
        position: relative;
        pointer-events: auto;
        margin: 0 6px 8px;
        border-radius: 22px 22px 18px 18px;
        background:
            linear-gradient(165deg, rgba(22, 22, 28, 0.97) 0%, rgba(10, 10, 14, 0.98) 100%);
        border: 1px solid rgba(255, 215, 0, 0.14);
        box-shadow:
            0 -8px 32px rgba(0, 0, 0, 0.45),
            0 0 0 1px rgba(255, 255, 255, 0.04) inset,
            0 12px 40px rgba(255, 215, 0, 0.06);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        overflow: hidden;
    }

    .mbn-glow-line {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 2px;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 153, 51, 0.4) 20%,
            var(--premium-gold, #ffd700) 50%,
            rgba(19, 136, 8, 0.5) 80%,
            transparent 100%
        );
        background-size: 200% 100%;
        animation: mbnGlowSweep 4s ease-in-out infinite;
        z-index: 2;
    }

    @keyframes mbnGlowSweep {
        0%, 100% { background-position: 100% 0; opacity: 0.6; }
        50% { background-position: 0% 0; opacity: 1; }
    }

    .mbn-shimmer {
        position: absolute;
        inset: 0;
        background: linear-gradient(
            105deg,
            transparent 40%,
            rgba(255, 255, 255, 0.04) 48%,
            rgba(255, 215, 0, 0.08) 50%,
            rgba(255, 255, 255, 0.04) 52%,
            transparent 60%
        );
        transform: translateX(-120%);
        animation: mbnShimmer 8s ease-in-out infinite;
        pointer-events: none;
        z-index: 1;
    }

    @keyframes mbnShimmer {
        0%, 85%, 100% { transform: translateX(-120%); }
        45% { transform: translateX(120%); }
    }

    .mbn-indicator {
        position: absolute;
        bottom: 6px;
        left: 0;
        height: 3px;
        width: 48px;
        border-radius: 99px;
        background: linear-gradient(90deg, #f59e0b, var(--premium-gold, #ffd700), #fcd34d);
        box-shadow: 0 0 14px rgba(255, 215, 0, 0.55), 0 0 4px rgba(255, 215, 0, 0.8);
        transform: translateX(0) scaleX(0.6);
        opacity: 0;
        transition:
            transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
            width 0.35s ease,
            opacity 0.25s ease;
        z-index: 3;
        pointer-events: none;
    }

    .mbn-indicator.mbn-ready {
        opacity: 1;
        transform: translateX(var(--mbn-x, 0)) scaleX(1);
        width: var(--mbn-w, 48px);
    }

    .mbn-inner {
        position: relative;
        z-index: 4;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        padding: 8px 4px 10px;
        gap: 2px;
    }

    .mbn-item {
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 6px 4px 4px;
        text-decoration: none;
        color: var(--muted-gray, #8b8b8b);
        font-size: 0.58rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        border-radius: 14px;
        transition: color 0.3s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        -webkit-tap-highlight-color: transparent;
        overflow: hidden;
        min-width: 0;
    }

    .mbn-item:active {
        transform: scale(0.92);
    }

    .mbn-icon-wrap {
        position: relative;
        width: 40px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .mbn-icon-ring {
        position: absolute;
        inset: 2px 6px;
        border-radius: 12px;
        background: transparent;
        border: 1px solid transparent;
        transition: all 0.38s cubic-bezier(0.22, 1, 0.36, 1);
        transform: scale(0.7);
        opacity: 0;
    }

    .mbn-item i {
        font-size: 1.2rem;
        line-height: 1;
        transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease, color 0.3s ease;
        position: relative;
        z-index: 1;
    }

    .mbn-label {
        line-height: 1.1;
        white-space: nowrap;
        transition: transform 0.3s ease, opacity 0.3s ease, color 0.3s ease;
        opacity: 0.85;
    }

    /* Active state */
    .mbn-item.active {
        color: var(--premium-gold, #ffd700);
    }

    .mbn-item.active .mbn-icon-wrap {
        transform: translateY(-3px);
    }

    .mbn-item.active .mbn-icon-ring {
        opacity: 1;
        transform: scale(1);
        background: linear-gradient(145deg, rgba(255, 215, 0, 0.18), rgba(255, 153, 51, 0.08));
        border-color: rgba(255, 215, 0, 0.28);
        box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
    }

    .mbn-item.active i {
        animation: mbnIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.45));
    }

    @keyframes mbnIconPop {
        0% { transform: scale(0.85); }
        55% { transform: scale(1.18); }
        100% { transform: scale(1); }
    }

    .mbn-item.active .mbn-label {
        opacity: 1;
        font-weight: 700;
        transform: scale(1.04);
    }

    /* Per-tab idle micro-motion */
    .mbn-item[data-mbn-tab="home"] i { animation: mbnHomeFloat 3s ease-in-out infinite; }
    .mbn-item.active[data-mbn-tab="home"] i { animation: mbnIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), mbnHomeFloat 3s ease-in-out 0.5s infinite; }

    @keyframes mbnHomeFloat {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-1px); }
    }

    .mbn-item[data-mbn-tab="jobs"]:not(.active) i {
        animation: mbnBriefcaseNudge 4s ease-in-out infinite;
    }

    @keyframes mbnBriefcaseNudge {
        0%, 100% { transform: rotate(0deg); }
        25% { transform: rotate(-4deg); }
        75% { transform: rotate(4deg); }
    }

    .mbn-item[data-mbn-tab="activity"].active i {
        animation: mbnIconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), mbnClockTick 2.5s ease-in-out infinite;
    }

    @keyframes mbnClockTick {
        0%, 100% { transform: rotate(0deg); }
        50% { transform: rotate(18deg); }
    }

    /* Ripple */
    .mbn-ripple {
        position: absolute;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(255, 215, 0, 0.35) 0%, transparent 70%);
        transform: scale(0);
        animation: mbnRipple 0.55s ease-out forwards;
        pointer-events: none;
        z-index: 0;
    }

    @keyframes mbnRipple {
        to {
            transform: scale(2.8);
            opacity: 0;
        }
    }

    /* WhatsApp float clearance */
    .whatsapp-float {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Theme overrides */
    body.gt-theme-active .mbn-shell {
        background: color-mix(in srgb, var(--gt-surface, #14141e) 94%, transparent) !important;
        border-color: color-mix(in srgb, var(--gt-primary, #ffd700) 18%, transparent) !important;
    }

    body.gt-theme-active .mbn-item.active {
        color: var(--gt-primary, var(--premium-gold)) !important;
        -webkit-text-fill-color: var(--gt-primary, var(--premium-gold)) !important;
    }

    body.gt-theme-active .mbn-indicator {
        background: linear-gradient(90deg, color-mix(in srgb, var(--gt-primary) 80%, #f59e0b), var(--gt-primary), color-mix(in srgb, var(--gt-primary) 70%, #fff));
    }
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav,
    .mbn-glow-line,
    .mbn-shimmer,
    .mbn-item i,
    .mbn-indicator {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}