/* Shared NestX topbar. Link this after page-specific styles so it can normalize old pages. */
:root {
    --nx-ink: #13283c;
    --nx-muted: #647587;
    --nx-line: rgba(19,40,60,0.08);
    --nx-brand: #185fa5;
    --nx-brand-dark: #0d3f73;
    --nx-teal: #0f8a8a;
    --nx-danger: #b42318;
}

.topbar {
    width: 100%;
    padding: 14px 18px !important;
    background: #fff !important;
    border-bottom: 1px solid var(--nx-line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: 0 1px 0 rgba(19,40,60,0.02);
}

.brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: max-content;
    max-width: 100%;
    color: var(--nx-ink) !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    line-height: 1.15;
    text-decoration: none !important;
}

.brand:hover {
    color: var(--nx-brand-dark) !important;
    opacity: 1 !important;
}

.brand-logo {
    width: 86px !important;
    height: 40px !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    border: 1px solid var(--nx-line);
    background: #06111d;
    display: block;
    flex: 0 0 auto;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.brand-name {
    color: var(--nx-brand-dark);
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.brand-caption {
    margin-top: 3px;
    padding-bottom: 0 !important;
    color: var(--nx-muted) !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    line-height: 1.2;
    white-space: nowrap;
}

.top-user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.user-greet {
    color: var(--nx-ink) !important;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-greet b {
    font-weight: 700;
    color: var(--nx-brand-dark);
}

.btn-toplink,
.btn-logout {
    min-height: 38px;
    border: 1px solid #d7e4ef !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    color: var(--nx-ink) !important;
    background: #f8fbfd !important;
    font-size: 0.86rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-toplink:hover,
.btn-logout:hover {
    border-color: var(--nx-brand) !important;
    background: #eef6fb !important;
    color: var(--nx-brand-dark) !important;
}

.btn-logout {
    color: var(--nx-danger) !important;
}

.btn-logout:hover {
    border-color: #f2b8b5 !important;
    background: #fff1f0 !important;
    color: #8f1d14 !important;
}

.btn-toplink.topbar-line {
    border-color: rgba(15,138,138,0.22) !important;
    background: rgba(15,138,138,0.08) !important;
    color: #0a6868 !important;
}

.topbar-badge {
    display: none;
    min-width: 19px;
    padding: 1px 6px;
    border-radius: 99px;
    margin-left: 2px;
    background: var(--nx-danger);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.seller-footer-nav,
.seller-footer-spacer,
.buyer-footer-nav,
.buyer-footer-spacer {
    display: none !important;
}

@media (min-width: 640px) {
    .topbar {
        padding: 18px 28px !important;
    }

    .brand-logo {
        width: 96px !important;
        height: 44px !important;
    }

    .brand-name {
        font-size: 1.08rem;
    }
}

@media (max-width: 768px) {
    .topbar {
        align-items: flex-start;
    }

    .top-user {
        width: auto;
        justify-content: flex-start;
        align-items: center;
        flex-direction: row;
        gap: 7px;
        overflow: visible;
        flex-wrap: wrap;
        padding-bottom: 2px;
    }

    .top-user .btn-toplink,
    .top-user .btn-logout {
        display: none !important;
    }

    .top-user .btn-toplink.topbar-profile {
        display: inline-flex !important;
        min-height: 30px;
        padding: 5px 12px !important;
        border-radius: 9px !important;
        background: var(--nx-brand) !important;
        color: #fff !important;
        border-color: var(--nx-brand) !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        line-height: 1.1;
        align-self: center;
        box-shadow: 0 3px 10px rgba(24,95,165,0.18);
    }

    .top-user .btn-toplink.topbar-profile:hover,
    .top-user .btn-toplink.topbar-profile:focus {
        background: var(--nx-brand-dark) !important;
        border-color: var(--nx-brand-dark) !important;
        color: #fff !important;
    }

    .user-greet {
        flex: 0 1 auto;
        max-width: calc(100vw - 36px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .seller-footer-nav,
    .buyer-footer-nav {
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 4px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--nx-line);
        background: rgba(255,255,255,0.97);
        box-shadow: 0 -10px 26px rgba(19,40,60,0.12);
        backdrop-filter: blur(12px);
    }

    .seller-footer-spacer,
    .buyer-footer-spacer {
        display: block !important;
        height: 78px;
    }

    .seller-footer-link,
    .buyer-footer-link {
        position: relative;
        display: flex;
        min-width: 0;
        min-height: 54px;
        padding: 6px 3px;
        border-radius: 12px;
        color: var(--nx-ink);
        text-decoration: none;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 1.15;
    }

    .seller-footer-link:hover,
    .seller-footer-link:focus,
    .buyer-footer-link:hover,
    .buyer-footer-link:focus {
        background: #eef6fb;
        color: var(--nx-brand-dark);
        outline: none;
    }

    .seller-footer-link.is-line,
    .buyer-footer-link.is-primary {
        color: #0a6868;
    }

    .seller-footer-link.is-logout,
    .buyer-footer-link.is-logout {
        color: var(--nx-danger);
    }

    .seller-footer-icon,
    .buyer-footer-icon {
        display: block;
        font-size: 1.12rem;
        line-height: 1;
    }

    .seller-footer-text,
    .buyer-footer-text {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .seller-footer-nav .topbar-badge,
    .buyer-footer-nav .topbar-badge {
        position: absolute;
        top: 4px;
        right: 15%;
        display: none;
    }
}

@media (max-width: 360px) {
    .topbar {
        padding: 12px 14px !important;
    }

    .brand-logo {
        width: 78px !important;
        height: 36px !important;
    }

    .brand-name {
        font-size: 0.92rem;
    }

    .brand-caption {
        font-size: 0.72rem !important;
    }
}
