/* ══════════════════════════════════════════════════════════
   ENHANCED FLOATING NAV
   Always visible · Labels · Progress ring · Active states
   ══════════════════════════════════════════════════════════ */

/* ── Shell (anchor point, bottom-right) ─────────────────── */
.fnav-shell {
    position: fixed;
    left: 1.25rem;
    bottom: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Always on screen — no display:none ever */
}

@media (max-width: 640px) {
    .fnav-shell {
        left: 0.75rem;
        bottom: 1rem;
    }
}

/* ── Scroll progress ring ───────────────────────────────── */
.fnav-progress-ring {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 52px;
    height: 52px;
    pointer-events: none;
    z-index: 2;
    transition: opacity 0.3s ease;
}

/* ── Toggle button (always visible compass) ─────────────── */
.fnav-toggle {
    position: relative;
    z-index: 3;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #ffffff;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    box-shadow:
        0 4px 16px rgba(124, 58, 237, 0.45),
        0 1px 3px rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.15);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1),
                box-shadow 0.25s ease,
                background 0.25s ease;
    outline: none;
}

.fnav-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow:
        0 6px 24px rgba(124, 58, 237, 0.6),
        0 2px 6px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.18);
}

.fnav-toggle:active {
    transform: scale(0.95);
}

.fnav-toggle.is-open {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    transform: rotate(45deg);
    box-shadow:
        0 6px 20px rgba(236, 72, 153, 0.5),
        0 2px 4px rgba(0,0,0,0.2);
}

.fnav-toggle.is-open:hover {
    transform: rotate(45deg) scale(1.08);
}

/* ── Nav pill ───────────────────────────────────────────── */
.fnav-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 6px;
    border-radius: 20px;
    background: rgba(10, 8, 30, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.22);
    box-shadow:
        0 20px 48px rgba(0,0,0,0.4),
        0 2px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-width: 140px;

    /* Hidden by default — slides up */
    transform-origin: bottom center;
    transform: scale(0.85) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.3s cubic-bezier(0.34,1.56,0.64,1),
        opacity 0.22s ease;
    margin-bottom: 4px;
}

.fnav-nav.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* Stagger children on open */
.fnav-nav.is-open .fnav-btn:nth-child(1) { transition-delay: 0.02s; }
.fnav-nav.is-open .fnav-btn:nth-child(2) { transition-delay: 0.04s; }
.fnav-nav.is-open .fnav-btn:nth-child(3) { transition-delay: 0.06s; }
.fnav-nav.is-open .fnav-btn:nth-child(4) { transition-delay: 0.08s; }
.fnav-nav.is-open .fnav-btn:nth-child(5) { transition-delay: 0.10s; }
.fnav-nav.is-open .fnav-btn:nth-child(6) { transition-delay: 0.12s; }
.fnav-nav.is-open .fnav-btn:nth-child(8) { transition-delay: 0.14s; }
.fnav-nav.is-open .fnav-btn:nth-child(9) { transition-delay: 0.16s; }

/* ── Nav buttons ────────────────────────────────────────── */
.fnav-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.7rem;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.01em;
    text-align: left;
    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s cubic-bezier(0.34,1.56,0.64,1);
    outline: none;
    white-space: nowrap;
}

.fnav-btn:hover {
    background: rgba(139, 92, 246, 0.18);
    color: #ffffff;
    transform: translateX(-2px);
}

.fnav-btn:active {
    transform: scale(0.96);
}

/* Active/current section highlight */
.fnav-btn.is-active {
    background: rgba(139, 92, 246, 0.22);
    color: #c4b5fd;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.3);
}

.fnav-btn.is-active .fnav-icon {
    color: #a78bfa;
}

/* Icon wrapper */
.fnav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.55);
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.fnav-btn:hover .fnav-icon {
    color: #a78bfa;
}

/* Label */
.fnav-label {
    font-size: 0.78rem;
    font-weight: 500;
    flex: 1;
}

/* Divider */
.fnav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 3px 4px;
}

/* ── Tooltip fallback (shows on hover when nav is closed) ── */
.fnav-toggle::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 8, 30, 0.92);
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(139,92,246,0.25);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Light mode adjustments ─────────────────────────────── */
/* The nav pill uses dark bg always — looks fine on both modes */

/* ── Pulse dot on toggle when nav is closed (attention) ─── */
.fnav-toggle .fnav-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ec4899;
    border: 2px solid rgba(10,8,30,0.5);
    animation: fnav-pulse-anim 2s ease-in-out infinite;
}

@keyframes fnav-pulse-anim {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.7; }
}

.fnav-toggle.is-open .fnav-pulse {
    display: none;
}

/* ── Mobile: pill goes horizontal at very small screens ──── */
@media (max-width: 400px) {
    .fnav-nav {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: 0;
        max-width: calc(100vw - 2rem);
        bottom: 56px;
        left: 0;
    }
    .fnav-label {
        display: none;
    }
    .fnav-btn {
        flex-direction: column;
        gap: 2px;
        padding: 0.45rem;
        min-width: 40px;
        align-items: center;
    }
}
