/* NAVBAR CONTAINER */
.navbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 15px 25px;
    background: #ffffff;
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 20px;
}

/* LOGO - Left */
.navbar .logo {
    grid-column: 1;
    display: flex;
    align-items: center;
}

.navbar .logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar .logo-img {
    height: 50px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
}

/* NAV LINKS - Center */
.navbar ul {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
    justify-content: center;
    grid-column: 2;
}

.nav-right {
    grid-column: 3;
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: flex-end;
}

.navbar ul li a {
    color: #333333;
    text-decoration: none;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    transition: 0.2s;
    padding: 5px 0;
}

.navbar ul li a:hover {
    color: #0066cc;
    border-bottom: 2px solid #0066cc;
}

/* MOBILE MENU BUTTON */
.menu-btn {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #0066cc;
}

/* MOBILE MENU BEHAVIOR */
@media (max-width: 768px) {
    .navbar ul {
        position: absolute;
        top: 60px;
        right: 0;
        background: #ffffff;
        width: 200px;
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        display: none;
        border-left: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    .navbar ul.active {
        display: flex;
    }

    .menu-btn {
        display: block;
    }
}

/* AUTH AREA IN NAVBAR */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    min-width: 200px;
    height: 32px;
    opacity: 0;
    transition: opacity 0.1s;
}

/* Show auth area once ready */
.nav-auth.auth-initialized {
    opacity: 1;
}

/* Hide all auth elements by default - prevent any flash */
.nav-auth a,
.nav-auth button,
.nav-auth .auth-user {
    display: none !important;
}

/* Show login link when ready and logged out */
.nav-auth a.auth-ready.logged-out {
    display: inline-block !important;
}

/* Show logout button when logged in */
.nav-auth button.auth-ready.logged-in {
    display: inline-block !important;
}

/* Profile Icon Button */
.profile-icon-btn {
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 8px;
    display: none !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    width: 48px;
    height: 48px;
}

/* Only show profile icon when user is logged in */
.profile-icon-btn.auth-ready.logged-in {
    display: flex !important;
}

/* Explicitly hide when logged out */
.profile-icon-btn.logged-out {
    display: none !important;
}

.profile-icon-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.profile-icon-btn svg {
    width: 32px;
    height: 32px;
    fill: #0066cc;
}

/* Never show user email */
.nav-auth .auth-user {
    display: none !important;
}

.nav-auth a {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    background: #0066cc;
    color: #fff;
    border: 1px solid #0066cc;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: 0.2s;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
}

.nav-auth a:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.nav-auth button {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    background: #0066cc;
    color: #fff;
    border: 1px solid #0066cc;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    transition: 0.2s;
    font-weight: 500;
}

.nav-auth button:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.nav-auth .auth-user {
    color: #0066cc;
    font-size: 0.85rem;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-weight: 500;
}

@media (max-width: 768px) {
    .nav-auth {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .nav-auth a {
        width: 100%;
    }

    .nav-auth button {
        width: 100%;
    }
}

/* MOBILE LOGOUT BUTTON */
.logout-mobile {
    display: none;
}

/* Show mobile logout inside dropdown, hide desktop logout */
@media (max-width: 768px) {
    #navLogout {
        display: none !important;
        /* hide desktop logout */
    }

    .logout-mobile {
        display: block;
        margin-top: 10px;
    }

    .logout-mobile button {
        width: 100%;
        padding: 8px;
        background: #0066cc;
        border: 1px solid #0066cc;
        color: #fff;
        font-family: 'Segoe UI', Arial, sans-serif;
        border-radius: 4px;
        text-align: left;
        font-weight: 500;
    }

    .logout-mobile button:hover {
        background: #0052a3;
        border-color: #0052a3;
    }
}