.user-profile {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-radius: 25px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
    margin-left: 8px;
    z-index: 1000; /* Reduzido para evitar conflitos */
    height: 38px;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;
    max-width: 180px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 0;
    width: auto;
    flex-shrink: 1;
}

/* Estilo para o nome do usuário */
.user-name {
    display: inline-block;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
    position: relative;
    padding: 0 2px;
    font-size: 0.85em;
    line-height: 1.2;
    vertical-align: middle;
}

/* Estilo para o avatar do usuário */
.user-avatar {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease;
}

/* Removendo transformações que podem causar vazamento */
.user-profile:hover .user-avatar {
    transform: none;
}

/* Dropdown do usuário */
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    min-width: 240px; /* Aumentado para garantir espaço para o texto */
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    contain: content;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Reset de margens e paddings */
    margin: 0;
    padding: 0;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    padding: 10px 15px; /* Reduzido o padding para dar mais espaço ao texto */
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em; /* Reduzido ligeiramente o tamanho da fonte */
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    background: white;
    overflow: hidden;
    background-clip: padding-box;
    transform: none !important;
    /* Garante que o texto não quebre linha */
    min-width: 0;
    /* Permite que o texto seja cortado com reticências */
    text-overflow: ellipsis;
}

.user-dropdown a:hover {
    background-color: #f5f5f5;
    /* Mantém o mesmo padding do estado normal */
    padding: 10px 15px;
    /* Remove margens que possam causar vazamento */
    margin: 0;
    /* Remove qualquer transformação */
    transform: none !important;
    /* Remove qualquer borda arredondada que possa causar vazamento */
    border-radius: 0;
    /* Garante que o hover cubra toda a largura */
    width: 100%;
    /* Garante que o hover fique acima de outros elementos */
    z-index: 1;
    /* Garante que o texto não quebre linha */
    white-space: nowrap;
    /* Permite que o texto seja cortado com reticências */
    text-overflow: ellipsis;
    /* Garante que o hover não ultrapasse as bordas */
    overflow: hidden;
    /* Força o fundo a ficar dentro das bordas */
    background-clip: padding-box;
    /* Garante que o hover não ultrapasse as bordas */
    position: relative;
}

.user-dropdown i {
    width: 20px;
    margin-right: 10px; /* Reduzido o espaçamento para dar mais espaço ao texto */
    text-align: center;
    color: #6b7280;
    flex-shrink: 0; /* Impede que o ícone seja reduzido */
    font-size: 0.9em; /* Garante que o ícone não fique muito grande */
}

/* Mostrar dropdown apenas quando a classe active estiver presente */
.user-profile.active .user-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .user-profile {
        padding: 4px 6px 4px 6px;
        height: 34px;
        max-width: 130px;
        margin-left: 4px;
        width: auto;
        gap: 4px;
    }
    
    .user-avatar {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }
    
    .user-name {
        max-width: 70px;
        font-size: 0.8em;
        line-height: 1.1;
    }
    
    .user-avatar {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .user-name {
        font-size: 12px;
        max-width: 90px;
    }
}

@media (max-width: 480px) {
    .user-profile {
        padding: 3px 8px 3px 5px;
        height: 34px;
        max-width: 140px;
    }
    
    .user-avatar {
        width: 22px;
        height: 22px;
    }
    
    .user-name {
        font-size: 11px;
        max-width: 80px;
    }
}

.user-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fee !important;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
}

.user-dropdown {
    position: absolute !important;
    top: 100% !important;
    right: -8px !important;
    left: auto !important;
    margin-top: 10px !important;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    width: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    white-space: nowrap;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    padding: 5px 0;
}

.user-profile.active .user-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex !important;
    align-items: center;
    padding: 12px 20px;
    color: black !important;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 1.55em;
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    min-width: 200px;
}

.user-dropdown a:hover {
    background: #0d1676;
    color: #fee !important;
}

.user-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
    color: black !important;
    
}
.user-dropdown a:first-child:hover {
    color: #fee !important;
}

.user-dropdown a:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    color: #dc3545;
    /* Garante que o último item não tenha borda inferior */
    overflow: hidden;
    /* Força o fundo a ficar dentro das bordas */
    background-clip: padding-box;
    /* Remove qualquer margem ou padding extra */
    margin: 0;
    padding: 10px 20px;
}

.user-dropdown a:last-child:hover {
    background: #dc3545;
    /* Garante que o hover não ultrapasse as bordas */
    margin: 0;
    padding: 10px 20px;
    /* Remove qualquer transformação */
    transform: none !important;
    /* Mantém o texto branco no hover */
    color: white !important;
}

/* Ajustes para quando o header tem a classe rolagem */
header.rolagem .user-profile {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header.rolagem .user-profile:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 5px 15px rgba(242, 242, 242, 0.3);
}

header.rolagem .user-avatar {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #0d1676 !important;
}

header.rolagem .user-name {
    color: #fee !important;
}

.span{
    color: #fff !important;
}

/* Responsividade para o perfil do usuário */
@media (max-width: 995px) {
    .user-profile {
        margin-left: 15px;
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .user-name {
        font-size: 13px;
        max-width: 100px;
    }
    
    .user-dropdown {
        min-width: 160px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .user-profile {
        position: fixed;
        top: 2rem;
        right: 2rem;
        margin-left: 0;
        padding: 0.5rem;
        z-index: 9998;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
        border: none;
    }
    
    .user-profile:hover {
        background: rgba(255, 255, 255, 1);
        transform: scale(1.1);
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    
    .user-name {
        display: none;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 16px;
        background: #0d1676;
        color: white;
    }
    
    .user-dropdown {
        position: fixed !important;
        top: 5rem !important;
        right: 2rem !important;
        left: auto !important;
        transform: none !important;
        min-width: 180px;
        max-width: 220px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .user-profile:hover .user-dropdown {
        transform: none !important;
    }
    
    /* Ajuste para quando o menu mobile está aberto */
    nav.active ~ .user-profile {
        display: none;
    }
}

@media (max-width: 480px) {
    .user-profile {
        top: 1.5rem;
        right: 1.5rem;
        padding: 6px 10px;
    }
    
    .user-dropdown {
        top: 4rem !important;
        right: 1.5rem !important;
        min-width: 160px;
        font-size: 12px;
    }
    
    .user-dropdown a {
        padding: 10px 14px;
        font-size: 12px;
    }
}