/* Mobile bottom navigation — light frosted dock, purple/cyan accent */

@media (min-width: 1024px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}

.mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    pointer-events: none;
    padding: 0 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.mobile-bottom-nav__inner {
    pointer-events: auto;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.15rem;
    max-width: 32rem;
    margin: 0 auto;
    padding: 0.35rem 0.5rem 0.25rem;
    border-radius: 1.25rem 1.25rem 1rem 1rem;
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.94) 0%,
        rgba(243, 232, 255, 0.9) 45%,
        rgba(236, 254, 255, 0.88) 100%
    );
    border: 1px solid rgba(133, 78, 242, 0.22);
    box-shadow:
        0 -8px 32px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.85) inset,
        0 4px 20px rgba(133, 78, 242, 0.08);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
}

.mobile-bottom-nav__glow {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 0;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, #854ef2, #22d3ee, #854ef2, transparent);
    opacity: 0.75;
    filter: blur(0.5px);
    pointer-events: none;
}

.mobile-bottom-nav__item {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.2rem;
    min-height: 52px;
    border: 0;
    background: transparent;
    color: #64748b;
    text-decoration: none;
    border-radius: 0.85rem;
    transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav__item:active {
    transform: scale(0.96);
}

.mobile-bottom-nav__icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    font-size: 1.05rem;
    border-radius: 0.65rem;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.mobile-bottom-nav__label {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-bottom-nav__badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.mobile-bottom-nav__item.is-active {
    color: #5b21b6;
}

.mobile-bottom-nav__item.is-active .mobile-bottom-nav__icon-wrap {
    background: linear-gradient(135deg, rgba(133, 78, 242, 0.2), rgba(34, 211, 238, 0.18));
    box-shadow:
        0 4px 14px rgba(133, 78, 242, 0.28),
        0 0 0 1px rgba(133, 78, 242, 0.25) inset;
    color: #7c3aed;
}

.mobile-bottom-nav__item.is-active .mobile-bottom-nav__label {
    color: #6d28d9;
    font-weight: 700;
}

.mobile-bottom-nav__item:focus-visible {
    outline: 2px solid rgba(133, 78, 242, 0.45);
    outline-offset: 2px;
}

/* Content clearance */
@media (max-width: 1023px) {
    html.has-mobile-bottom-nav body.has-mobile-bottom-nav #main-content-scroll,
    html.has-mobile-bottom-nav body.has-mobile-bottom-nav main.flex-1.min-h-0 {
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }

    html.has-mobile-bottom-nav body.has-mobile-bottom-nav.layout-attendance-has-record-bar #main-content-scroll {
        padding-bottom: calc(9.5rem + env(safe-area-inset-bottom, 0px));
    }

    html.has-mobile-bottom-nav body.has-mobile-bottom-nav {
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }

    html.has-mobile-bottom-nav {
        --feenix-mobile-dock-h: calc(5.25rem + env(safe-area-inset-bottom, 0px));
        --feenix-fab-chat-size: 60px;
        --feenix-fab-stack-gap: 0.5rem;
        --feenix-fab-chat-bottom: calc(var(--feenix-mobile-dock-h, 5.25rem) + 0.65rem + env(safe-area-inset-bottom, 0px));
    }

    html.has-mobile-bottom-nav #chat-widget-root #chat-widget {
        bottom: var(--feenix-fab-chat-bottom) !important;
        right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
        z-index: 48 !important;
    }

    html.has-mobile-bottom-nav #chat-widget #chat-panel {
        max-height: min(520px, calc(100dvh - var(--feenix-mobile-dock-h, 5.25rem) - 7rem)) !important;
        height: min(520px, calc(100dvh - var(--feenix-mobile-dock-h, 5.25rem) - 7rem)) !important;
    }

    html.has-mobile-bottom-nav #scroll-to-top-btn {
        bottom: calc(var(--feenix-fab-chat-bottom) + var(--feenix-fab-chat-size) + var(--feenix-fab-stack-gap)) !important;
        right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
        z-index: 48 !important;
    }

    html.has-mobile-bottom-nav body.layout-attendance-has-record-bar {
        --feenix-fab-chat-bottom: calc(var(--feenix-mobile-dock-h, 5.25rem) + 4.25rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 1023px) {
    .mobile-bottom-nav {
        z-index: 56;
    }
}
