/* ==========================================
   APPLICATION BOTTOM NAVIGATION
========================================== */

.app-bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-content-width,430);
    min-height: var(--app-bottom-nav-height,76px);
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) 76px minmax(0,1fr) minmax(0,1fr);
    align-items: center;
    padding: 0 8px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(226,232,240,.92);
    background: rgba(255,255,255,.96);
    box-shadow: 0 -8px 30px rgba(15,23,42,.07);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 1000;
}

.app-bottom-nav__item {
    position: relative;
    min-width: 0;
    height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #94A3B8;
    font-size: 10px;
    font-weight: 600;
    transition: color .16s ease, transform .16s ease;
}

    .app-bottom-nav__item:hover {
        color: #64748B;
    }

    .app-bottom-nav__item:active {
        transform: scale(.96);
    }

    .app-bottom-nav__item.is-active,
    .app-bottom-nav__item.active,
    .app-bottom-nav__item[aria-current="page"] {
        color: var(--primary,#16A34A);
    }

.app-bottom-nav__icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .app-bottom-nav__icon svg {
        width: 23px;
        height: 23px;
    }

.app-bottom-nav__label {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ---------- Active indicator ---------- */

.app-bottom-nav__item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 24px;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: var(--primary,#16A34A);
    opacity: 0;
    transform: translateX(-50%) scaleX(.45);
    transition: opacity .16s ease, transform .16s ease;
}

.app-bottom-nav__item.is-active::before,
.app-bottom-nav__item.active::before,
.app-bottom-nav__item[aria-current="page"]::before {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
}

/* ---------- Center action slot ---------- */

.app-bottom-nav__center {
    position: relative;
    height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding-bottom: 9px;
    color: #64748B;
    font-size: 10px;
    font-weight: 600;
}

.app-bottom-nav__primary-action {
    position: absolute;
    top: -25px;
    left: 50%;
    width: 62px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 6px solid var(--background,#F8FAFC);
    border-radius: 50%;
    background: var(--primary,#16A34A);
    color: #fff;
    box-shadow: 0 10px 28px rgba(22,163,74,.32);
    transform: translateX(-50%);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

    .app-bottom-nav__primary-action:hover {
        transform: translateX(-50%) translateY(-2px);
        box-shadow: 0 13px 32px rgba(22,163,74,.36);
    }

    .app-bottom-nav__primary-action:active {
        transform: translateX(-50%) scale(.95);
    }

    .app-bottom-nav__primary-action svg {
        width: 28px;
        height: 28px;
        transition: transform .2s ease;
    }

    .app-bottom-nav__primary-action.is-open svg,
    .app-bottom-nav__primary-action[aria-expanded="true"] svg {
        transform: rotate(45deg);
    }

.app-bottom-nav__center-label {
    max-width: 70px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

@media(max-width:360px) {

    .app-bottom-nav {
        grid-template-columns: minmax(0,1fr) minmax(0,1fr) 68px minmax(0,1fr) minmax(0,1fr);
    }

    .app-bottom-nav__label,
    .app-bottom-nav__center-label {
        font-size: 9px;
    }

    .app-bottom-nav__primary-action {
        width: 58px;
        height: 58px;
    }
}

/* ==========================================
   APP BOTTOM NAV
========================================== */

.app-bottom-nav {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: 0;
    width: min(100%,430px);
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(5,minmax(0,1fr));
    align-items: end;
    min-height: 72px;
    padding: 8px 8px max( 8px, env(safe-area-inset-bottom) );
    border-top: 1px solid rgba(22,163,74,.10);
    background: linear-gradient( 180deg, rgba(255,255,255,.98) 0%, rgba(240,253,244,.98) 100% );
    box-shadow: 0 -8px 28px rgba(15,23,42,.07);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}


    /* ==========================================
   CENTER GLOW
========================================== */

    .app-bottom-nav::before {
        content: "";
        position: absolute;
        width: 132px;
        height: 74px;
        left: 50%;
        top: -22px;
        transform: translateX(-50%);
        border-radius: 50%;
        background: radial-gradient( circle, rgba(34,197,94,.15) 0%, rgba(34,197,94,.06) 42%, rgba(34,197,94,0) 72% );
        pointer-events: none;
    }


/* ==========================================
   NAV ITEM
========================================== */

.app-bottom-nav__item {
    position: relative;
    z-index: 2;
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 2px;
    border: 0;
    background: transparent;
    color: #94A3B8;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color .16s ease, transform .16s ease;
}

    .app-bottom-nav__item:hover {
        color: #64748B;
    }

    .app-bottom-nav__item:active {
        transform: scale(.96);
    }

    .app-bottom-nav__item.is-active {
        color: var(--primary,#16A34A);
    }


/* ==========================================
   NAV ICON
========================================== */

.app-bottom-nav__icon {
    width: 23px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .app-bottom-nav__icon svg {
        width: 22px;
        height: 22px;
        display: block;
    }


/* ==========================================
   NAV LABEL
========================================== */

.app-bottom-nav__label {
    display: block;
    overflow: hidden;
    max-width: 100%;
    color: inherit;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.app-bottom-nav__item.is-active
.app-bottom-nav__label {
    font-weight: 700;
}


/* ==========================================
   CENTER SLOT
========================================== */

.app-bottom-nav__center {
    position: relative;
    z-index: 3;
    min-height: 54px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}


/* ==========================================
   PRIMARY QUICK ACTION
========================================== */

.app-bottom-nav__primary-action {
    position: absolute;
    z-index: 5;
    width: 58px;
    height: 58px;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient( 135deg, #22C55E 0%, #16A34A 55%, #15803D 100% );
    color: #fff;
    box-shadow: 0 0 0 7px rgba(255,255,255,.94), 0 9px 24px rgba(22,163,74,.30);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
}

    .app-bottom-nav__primary-action svg {
        width: 25px;
        height: 25px;
        display: block;
    }

    .app-bottom-nav__primary-action:hover {
        box-shadow: 0 0 0 7px rgba(255,255,255,.97), 0 11px 28px rgba(22,163,74,.34);
    }

    .app-bottom-nav__primary-action:active {
        transform: translateX(-50%) scale(.96);
    }


    /* ==========================================
   QUICK ACTION OPEN STATE
========================================== */

    .app-bottom-nav__primary-action.is-open {
        transform: translateX(-50%) rotate(45deg);
    }


/* ==========================================
   CENTER LABEL
========================================== */

.app-bottom-nav__center-label {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    color: #64748B;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}


/* ==========================================
   ACTIVE INDICATOR
========================================== */

.app-bottom-nav__item.is-active::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    width: 20px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--primary,#16A34A);
}


/* ==========================================
   SAFE CONTENT SPACE
========================================== */

.app-main {
    padding-bottom: calc( 90px + env(safe-area-inset-bottom) );
}


/* ==========================================
   SMALL SCREEN
========================================== */

@media(max-width:360px) {

    .app-bottom-nav {
        min-height: 69px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .app-bottom-nav__icon {
        width: 21px;
        height: 21px;
    }

        .app-bottom-nav__icon svg {
            width: 20px;
            height: 20px;
        }

    .app-bottom-nav__label,
    .app-bottom-nav__center-label {
        font-size: 9px;
    }

    .app-bottom-nav__primary-action {
        width: 56px;
        height: 56px;
        top: -28px;
    }

        .app-bottom-nav__primary-action svg {
            width: 24px;
            height: 24px;
        }
}


/* ==========================================
   REDUCED MOTION
========================================== */

@media(prefers-reduced-motion:reduce) {

    .app-bottom-nav__item,
    .app-bottom-nav__primary-action {
        transition: none;
    }
}