/* Pill Navbar Base Styles */
.pillnav {
    border-radius: 3rem;
    background: #232323;
    padding: 1rem 2rem;
}

/* Navbar Container */
.pillnav-container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Consistent Styling for Nav Links & Buttons */
.pillnav-link, 
.pillnav-container .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 120px;
    height: 45px;
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase !important;
    color: #e0e0e0 !important;
    background: transparent !important;
    border: 1px solid white !important;
    border-radius: 3rem;
    padding: 0 25px;
    transition: all 0.3s ease-in-out;
    text-decoration: none;
    line-height: normal;
}

.pillnav-link:hover, 
.pillnav-container .btn:hover {
    background: white;
    color: black !important;
    transform: scale(0.98);
}

/* Logout Button Special Styling */
.pillnav .btn-danger {
    background: #6a1a1a !important;
}

.pillnav .btn-danger:hover {
    color: #801f1f !important;
    transform: scale(0.98);
}

/* Vertical Divider */
.vertical-line {
    width: 2px;
    background-color: #666;
    height: 40px;
    margin: 0 10px;
}

/* Custom Animated Navbar Toggler */
.custom-toggler {
    display: none; /* Hidden by default on large screens */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1050;
}

.custom-toggler .bar {
    width: 30px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.4s;
    border-radius: 3px;
}

/* Animated Toggler Open State */
.custom-toggler.open .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.custom-toggler.open .bar:nth-child(2) {
    opacity: 0;
}

.custom-toggler.open .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Hide Bootstrap Default Toggler */
.navbar-toggler-icon {
    display: none;
}

/* Remove outline from toggler */
.navbar-toggler {
    border: none !important;
}

.navbar-toggler:focus {
    box-shadow: none !important;
    border: none !important;
}

@media (max-width: 992px) {
    .navbar-collapse {
        display: none; /* Ensure menu starts hidden */
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .navbar-collapse.show {
        display: flex !important;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    /* First row: 4 links in a grid */
    .top-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr); /* 4 items */
        gap: 0.5rem; /* Uniform gap */
        justify-content: center;
        width: fit-content;
        margin: auto;
    }

    /* Centered Divider */
    .vertical-line {
        width: 60%; /* Reduce width slightly */
        height: 2px;
        background-color: #666;
        margin: 10px auto; /* Centered */
        display: block;
    }

    /* Last row: 3 links in a grid with same gap */
    .bottom-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr); /* 3 evenly spaced items */
        gap: 0.5rem; /* Ensure same gap as top row */
        justify-content: center;
        width: fit-content;
        margin: auto;
    }

    /* Ensure buttons in last row are equally spaced */
    .bottom-row .pillnav-link {
        flex: 1;
        max-width: 120px; /* Keep them square */
    }

    /* Ensure buttons are square */
    .pillnav-link, 
    .pillnav-container .btn {
        width: 100px;
        height: 100px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        font-weight: 500;
        text-transform: uppercase;
        color: #e0e0e0;
        border: 1px solid white;
        border-radius: 10px;
        padding: 0;
        transition: all 0.3s ease-in-out;
        margin: auto;
    }

    .pillnav-link:hover, 
    .pillnav-container .btn:hover {
        background: white !important;
        color: black;
        transform: scale(0.98);
    }

    /* Ensure toggler is visible */
    .custom-toggler {
        display: block;
    }
}

@media (min-width: 992px) {
    .pillnav-container {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: end;
        gap: 2rem; /* Increase spacing between links */
        width: 100%;
        margin-left: auto;
    }

    .pillnav-link, 
    .pillnav-container .btn {
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        font-weight: 500;
        text-transform: uppercase;
        color: #e0e0e0;
        border: 1px solid white;
        border-radius: 3rem;
        padding: 0 25px;
        transition: all 0.3s ease-in-out;
        text-decoration: none;
        line-height: normal;
        margin: 0 10px; /* Ensure spacing between elements */
    }

    /* Fix potential height issues */
    .pillnav-container .btn,
    .pillnav-link {
        display: flex;
        align-items: center;
        height: 50px; /* Ensures all elements match */
    }

    /* Fix for Sync Bot alignment */
    .bottom-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem; /* Adds consistent spacing */
    }

    .bottom-row .pillnav-link,
    .bottom-row .btn {
        height: 50px;
        line-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pillnav-link:hover, 
    .pillnav-container .btn:hover {
        background: white !important;
        color: black;
        transform: scale(0.98);
    }

    /* Ensure divider is properly aligned */
    .vertical-line {
        width: 2px;
        height: 40px;
        background-color: #666;
        align-self: center; /* Ensures it's perfectly in line */
    }

    /* Hide custom toggler on large screens */
    .custom-toggler {
        display: none;
    }
}