﻿/* In-Page Navigation - Clean Visual Separation */
.page-navigation {
    position: sticky; /* Keep it sticky from the start */
    top: var(--main-nav-height-static, 76px); /* Use static height initially */
    background-color: white;
    box-shadow: 0 0 6px rgba(0,0,0,0.03);
    z-index: 100;
    padding: 1rem 0;
    transition: all 0.3s ease;
    border-top: 1px solid #e8ecef;
    border-bottom: 1px solid #e8ecef;
    background-color: #ffffff;
}

    .page-navigation.scrolled {
        padding: 0.75rem 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Enhanced shadow when scrolled */
        border-top: 1px solid #e8ecef;
        border-bottom: 1px solid #e8ecef;
        margin: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }


.nav-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.nav-label {
    font-weight: 600;
    color: #2c5aa0;
    margin-right: 1.5rem;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

    .nav-label i {
        margin-right: 0.5rem;
        color: #e67e22;
    }

.nav-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-item-tab {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background-color: #f8f9fa;
    color: #2c5aa0;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

    .nav-item-tab i {
        margin-right: 0.5rem;
        font-size: 0.9rem;
        color: #0096d2;
    }

    .nav-item-tab:hover {
        background-color: rgba(0, 150, 210, 0.1);
        transform: translateY(-2px);
        text-decoration: none;
        color: #2c5aa0;
    }

    .nav-item-tab.active {
        background-color: #2c5aa0;
        color: white;
    }

        .nav-item-tab.active i {
            color: #e67e22;
        }

/* JavaScript-Controlled Sticky Behavior */
#inPageNav {
    transition: all 0.3s ease; /* Smooth transition */
}

    #inPageNav.scrolled {
        position: fixed;
        top: var(--main-nav-height, 60px); /* Uses dynamic height with 60px fallback */
        left: 0;
        right: 0;
        z-index: 999; /* Ensure it's above content but below main nav */
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

/* When main header is scrolled, adjust jump-to behavior */
.stfm-custom-header.header-scrolled ~ main .page-navigation {
    top: var(--main-nav-height, 60px) !important;
}

.stfm-custom-header.header-scrolled ~ main #inPageNav.scrolled {
    top: var(--main-nav-height, 60px) !important;
}

/* Additional margin-top fix for when header is scrolled - prevents clipping */
.stfm-custom-header.header-scrolled ~ main .page-navigation,
.stfm-custom-header.header-scrolled ~ main #inPageNav {
    margin-top: 20px !important;
}

/* Reset margin-top when header is not scrolled */
.stfm-custom-header:not(.header-scrolled) ~ main .page-navigation,
.stfm-custom-header:not(.header-scrolled) ~ main #inPageNav {
    margin-top: 0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-navigation {
        margin: 1rem 0;
        padding: 0.75rem 0;
    }

    .nav-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .nav-label {
        margin-right: 0;
    }

    .nav-items {
        width: 100%;
        justify-content: center;
    }

    .nav-item-tab {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .nav-items {
        flex-direction: column;
        width: 100%;
    }

    .nav-item-tab {
        justify-content: center;
        width: 100%;
    }
}
